Skip to contentSkip to conversation

infra/pkg-kconfig: do not rely on package's .config as a timestamp

PATCH New Yann E. MORIN 2 participants 5 messages May 30, 2019 – Jun 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 infra/pkg-kconfig: do not rely on package's .config as a timestamp

Since linux-4.19, the kernel's build system internally touches its .config file.

However, we currently used that file as a timestamp to detect whether our kconfig fixups were to be (re)applied or not, which in turn is used to decide whether we should (re)build the package or not.

But with latest kernel versions, this timestamp heuristic is now broken, and we always rebuild the kernel on subsequent builds.

We fix that by introducing a spearate timestamp file of our own, which we know the kernel (or the kconfig-based packages, for that matters) does not use.

Cc Thomas De Schampheleire <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Arnout Vandecappelle <[email protected]>
---
 package/pkg-kconfig.mk | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
package/pkg-kconfig.mk +14 -7
index 60aae387ca..d62be0fd03 100644
@@ -24,7 +24,7 @@ define kconfig-package-update-config
 	fi
 	$(Q)mkdir -p $(dir $($(PKG)_KCONFIG_FILE))
 	cp -f $($(PKG)_DIR)/$(1) $($(PKG)_KCONFIG_FILE)
-	$(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
+	$(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_STAMP_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
 endef
 
 PKG_KCONFIG_COMMON_OPTS = \
@@ -61,6 +61,12 @@ $(2)_KCONFIG_FIXUP_CMDS ?=
 $(2)_KCONFIG_FRAGMENT_FILES ?=
 $(2)_KCONFIG_DOTCONFIG ?= .config
 
+# Do not use $(2)_KCONFIG_DOTCONFIG as stamp file, because the package
+# buildsystem (e.g. linux >= 4.19) may touch it, thus rendering our
+# timestamps out of date, thus re-trigerring the build of the package.
+# Instead, use a specific file of our own as timestamp.
+$(2)_KCONFIG_STAMP_DOTCONFIG = .stamp_dotconfig
+
 # The config file as well as the fragments could be in-tree, so before
 # depending on them the package should be extracted (and patched) first.
 #
@@ -116,23 +122,24 @@ endef
 # fragments are merged together to .config, after the package has been patched.
 # Since the file could be a defconfig file it needs to be expanded to a
 # full .config first.
-$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
+$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
 	$$(Q)$$(if $$($(2)_KCONFIG_DEFCONFIG), \
 		$$($(2)_KCONFIG_MAKE) $$($(2)_KCONFIG_DEFCONFIG), \
-		$$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@))
+		$$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@D)/$$($(2)_KCONFIG_DOTCONFIG))
 	$$(Q)support/kconfig/merge_config.sh -m -O $$(@D) \
-		$$(@) $$($(2)_KCONFIG_FRAGMENT_FILES)
+		$$(@D)/$$($(2)_KCONFIG_DOTCONFIG) $$($(2)_KCONFIG_FRAGMENT_FILES)
 	$$($(2)_REGEN_DOT_CONFIG)
+	$$(Q)touch $$(@D)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
 
 # If _KCONFIG_FILE or _KCONFIG_FRAGMENT_FILES exists, this dependency is
 # already implied, but if we only have a _KCONFIG_DEFCONFIG we have to add
 # it explicitly. It doesn't hurt to always have it though.
-$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $(1)-patch
+$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): | $(1)-patch
 
 # Some packages may need additional tools to be present by the time their
 # kconfig structure is parsed (e.g. the linux kernel may need to call to
 # the compiler to test its features).
-$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES)
+$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES)
 
 # In order to get a usable, consistent configuration, some fixup may be needed.
 # The exact rules are specified by the package .mk file.
@@ -142,7 +149,7 @@ define $(2)_FIXUP_DOT_CONFIG
 	$$(Q)touch $$($(2)_DIR)/.stamp_kconfig_fixup_done
 endef
 
-$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG)
+$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
 	$$($(2)_FIXUP_DOT_CONFIG)
 
 # Before running configure, the configuration file should be present and fixed
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 infra/pkg-kconfig: do not rely on package's .config as a timestamp

Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Since linux-4.19, the kernel's build system internally touches its .config file.

However, we currently used that file as a timestamp to detect whether our kconfig fixups were to be (re)applied or not, which in turn is used to decide whether we should (re)build the package or not.

But with latest kernel versions, this timestamp heuristic is now broken, and we always rebuild the kernel on subsequent builds.

Quoted 8 lines

We fix that by introducing a spearate timestamp file of our own, which we know the kernel (or the kconfig-based packages, for that matters) does not use.

Cc Thomas De Schampheleire <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Arnout Vandecappelle <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 infra/pkg-kconfig: do not rely on package's .config as a timestamp

Peter, All,

On 2019-05-31 00:41 +0200, Peter Korsgaard spake thusly:

Quoted 16 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Since linux-4.19, the kernel's build system internally touches its .config file.

However, we currently used that file as a timestamp to detect whether our kconfig fixups were to be (re)applied or not, which in turn is used to decide whether we should (re)build the package or not.

But with latest kernel versions, this timestamp heuristic is now broken, and we always rebuild the kernel on subsequent builds.

We fix that by introducing a spearate timestamp file of our own, which we know the kernel (or the kconfig-based packages, for that matters) does not use.

Quoted 6 lines
Quoted 4 lines
Cc Thomas De Schampheleire <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Arnout Vandecappelle <[email protected]>

Committed, thanks.

Thanks.

This is also a candidate for 2019.02.x, on which it applies cleanly.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 infra/pkg-kconfig: do not rely on package's .config as a timestamp

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Hi,

Quoted 5 lines
Quoted 1 line

Committed, thanks.

Thanks.

This is also a candidate for 2019.02.x, on which it applies cleanly.

Yes, I will sync 2019.02.x after I get 2019.05 out the door.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 infra/pkg-kconfig: do not rely on package's .config as a timestamp

In reply to Yann E. MORIN
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Since linux-4.19, the kernel's build system internally touches its .config file.

However, we currently used that file as a timestamp to detect whether our kconfig fixups were to be (re)applied or not, which in turn is used to decide whether we should (re)build the package or not.

But with latest kernel versions, this timestamp heuristic is now broken, and we always rebuild the kernel on subsequent builds.

Quoted 8 lines

We fix that by introducing a spearate timestamp file of our own, which we know the kernel (or the kconfig-based packages, for that matters) does not use.

Cc Thomas De Schampheleire <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Arnout Vandecappelle <[email protected]>

Committed to 2019.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard