Fix pkg-kconfig infra
PATCH v3 1/1 Fix pkg-kconfig infra
This series fixes a nasty regression introduced with the pkg-kconfig infrastructure recently applied, whereby kconfig packages are always rebuilt on each 'make', as detected by Yann.
This series incorporates an alternative solution than v2 sent out by Yann. Instead of re-touching the stamp file, make sure that such timing problems cannot occur by calling 'make oldconfig' from within pkg-kconfig itself, instead of from the package. Looking at the to-be-converted linux package, oldconfig is also run there, so it makes sense to add this to pkg-kconfig.
Contrary to Yann's solution, if a package makes another change to .config from the configure script, a rebuild will happen still. I consider that an error in the package. Any 'fixup' of the config is supposed to be in the KCONFIG_FIXUP_CMDS.
---
Yann E. Morin (1)
infra/pkg-kconfig: join comments to the related code-block
Thomas De Schampheleire (1)
infra/pkg-kconfig: incorporate oldconfig call to avoid endless rebuilds
package/busybox/busybox.mk | 2 -- package/pkg-kconfig.mk | 9 ++------- package/uclibc/uclibc.mk | 6 ------ 3 files changed, 2 insertions(+), 15 deletions(-)
PATCH v3 1/1 infra/pkg-kconfig: join comments to the related code-block
From: "Yann E. MORIN" <[email protected]>
The current layout of comments wrt. to the related code-blocks is a bit hard to handle visually.
Remove empty lines between the comments and their respective related code-blocks.
---
v3: no changes
package/pkg-kconfig.mk | 7 ------- 1 file changed, 7 deletions(-)
package/pkg-kconfig.mk +0 -7
@@ -32,36 +32,30 @@ $(call inner-generic-package,$(1),$(2),$(3),$(4)) # Default values - $(2)_KCONFIG_EDITORS ?= menuconfig $(2)_KCONFIG_OPT ?= $(2)_KCONFIG_FIXUP_CMDS ?= # FOO_KCONFIG_FILE is required - ifndef $(2)_KCONFIG_FILE $$(error Internal error: no value specified for $(2)_KCONFIG_FILE) endif # The .config file is obtained by copying it from the specified source # configuration file, after the package has been patched. - $$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE) | $(1)-patch $$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config # In order to get a usable, consistent configuration, some fixup may be needed. # The exact rules are specified by the package .mk file. - $$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config $$($(2)_KCONFIG_FIXUP_CMDS) $$(Q)touch $$@ # Before running configure, the configuration file should be present and fixed - $$($(2)_TARGET_CONFIGURE): $$($(2)_DIR)/.stamp_kconfig_fixup_done # Configuration editors (menuconfig, ...) - $$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_done $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \ $$($(2)_KCONFIG_OPT) $$(subst $(1)-,,$$@)
@@ -69,7 +63,6 @@ rm -f $$($(2)_DIR)/.stamp_{target,staging}_installed # Target to copy back the configuration to the source configuration file - $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
PATCH v3 1/1 infra/pkg-kconfig: incorporate oldconfig call to avoid endless rebuilds
In reply to Thomas De SchampheleireThe configure step of the busybox package performs 'make oldconfig', which causes the .config file to be updated. Thus, the .config file is more recent than our stamp file .stamp_kconfig_fixup_done. On a subsequent build, our dependency rules would kick in, and run the config fixup again, thus kicking in the package's configure, build and install steps yet once more, that, ad infinitum.
One solution is to modify kconfig-package to introduce an explicit touch of the .kconfig_fixup_config_done stamp file, as post-configure hook.
Another solution, implemented by this patch, is to move the oldconfig call from the package's .mk file to the kconfig-package infrastructure and make sure it is done as part of the fixup commands. This way, the stamp file will only be touched once, after the full fixup (including oldconfig) and no endless rebuilds will occur.
---
v3: implement alternative implementation
package/busybox/busybox.mk | 2 -- package/pkg-kconfig.mk | 9 ++------- package/uclibc/uclibc.mk | 6 ------ 3 files changed, 2 insertions(+), 15 deletions(-)
package/busybox/busybox.mk +0 -2
@@ -205,8 +205,6 @@ endef define BUSYBOX_CONFIGURE_CMDS - @yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \ - -C $(@D) oldconfig $(BUSYBOX_NOCLOBBER_INSTALL) endef
package/pkg-kconfig.mk +2 -0
@@ -50,6 +50,8 @@ # The exact rules are specified by the package .mk file. $$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config $$($(2)_KCONFIG_FIXUP_CMDS) + @yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \ + $$($(2)_KCONFIG_OPT) oldconfig $$(Q)touch $$@ # Before running configure, the configuration file should be present and fixed
package/uclibc/uclibc.mk +0 -6
@@ -431,12 +431,6 @@ $(UCLIBC_LOCALE_CONFIG) $(UCLIBC_WCHAR_CONFIG) $(UCLIBC_STRIP_CONFIG) - yes "" | $(MAKE1) -C $(@D) \ - $(UCLIBC_MAKE_FLAGS) \ - PREFIX=$(STAGING_DIR) \ - DEVEL_PREFIX=/usr/ \ - RUNTIME_PREFIX=$(STAGING_DIR) \ - oldconfig endef define UCLIBC_CONFIGURE_CMDS
PATCH v3 1/1 infra/pkg-kconfig: incorporate oldconfig call to avoid endless rebuilds
Thomas?, All,
On 2014-08-05 12:36 +0200, Thomas De Schampheleire spake thusly:
Quoted 16 lines
The configure step of the busybox package performs 'make oldconfig', which causes the .config file to be updated. Thus, the .config file is more recent than our stamp file .stamp_kconfig_fixup_done. On a subsequent build, our dependency rules would kick in, and run the config fixup again, thus kicking in the package's configure, build and install steps yet once more, that, ad infinitum.
One solution is to modify kconfig-package to introduce an explicit touch of the .kconfig_fixup_config_done stamp file, as post-configure hook.
Another solution, implemented by this patch, is to move the oldconfig call from the package's .mk file to the kconfig-package infrastructure and make sure it is done as part of the fixup commands. This way, the stamp file will only be touched once, after the full fixup (including oldconfig) and no endless rebuilds will occur.
Quoted 3 lines
Reported-by "Yann E. MORIN" <[email protected]>Suggested-by "Yann E. MORIN" <[email protected]>Signed-off-by Thomas De Schampheleire <[email protected]>
[tested with running multiple 'make' in sequence; tested that
busybox-menuconfig still forces a fixup and a rebuild]
Regards,
Yann E. MORIN.
Quoted 48 lines
---
v3: implement alternative implementationpackage/busybox/busybox.mk | 2 -- package/pkg-kconfig.mk | 9 ++------- package/uclibc/uclibc.mk | 6 ------ 3 files changed, 2 insertions(+), 15 deletions(-)diff -r
f81734945d5b-r707fc324a92epackage/busybox/busybox.mkpackage/busybox/busybox.mk +0
-2@@ -205,8 +205,6 @@ endef define BUSYBOX_CONFIGURE_CMDS - @yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \ - -C $(@D) oldconfig $(BUSYBOX_NOCLOBBER_INSTALL) endefdiff -r
f81734945d5b-r707fc324a92epackage/pkg-kconfig.mkpackage/pkg-kconfig.mk +2
-0@@ -50,6 +50,8 @@ # The exact rules are specified by the package .mk file. $$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config $$($(2)_KCONFIG_FIXUP_CMDS) + @yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \ + $$($(2)_KCONFIG_OPT) oldconfig $$(Q)touch $$@ # Before running configure, the configuration file should be present and fixeddiff -r
f81734945d5b-r707fc324a92epackage/uclibc/uclibc.mkpackage/uclibc/uclibc.mk +0
-6@@ -431,12 +431,6 @@ $(UCLIBC_LOCALE_CONFIG) $(UCLIBC_WCHAR_CONFIG) $(UCLIBC_STRIP_CONFIG) - yes "" | $(MAKE1) -C $(@D) \ - $(UCLIBC_MAKE_FLAGS) \ - PREFIX=$(STAGING_DIR) \ - DEVEL_PREFIX=/usr/ \ - RUNTIME_PREFIX=$(STAGING_DIR) \ - oldconfig endef define UCLIBC_CONFIGURE_CMDS
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v3 1/1 infra/pkg-kconfig: incorporate oldconfig call to avoid endless rebuilds
"Yann E. MORIN" <[email protected]> schreef:
Quoted 62 lines
Thomas?, All,
On 2014-08-05 12:36 +0200, Thomas De Schampheleire spake thusly:
Quoted 16 lines
The configure step of the busybox package performs 'make oldconfig', which causes the .config file to be updated. Thus, the .config file is more recent than our stamp file .stamp_kconfig_fixup_done. On a subsequent build, our dependency rules would kick in, and run the config fixup again, thus kicking in the package's configure, build and install steps yet once more, that, ad infinitum.
One solution is to modify kconfig-package to introduce an explicit touch of the .kconfig_fixup_config_done stamp file, as post-configure hook.
Another solution, implemented by this patch, is to move the oldconfig call from the package's .mk file to the kconfig-package infrastructure and make sure it is done as part of the fixup commands. This way, the stamp file will only be touched once, after the full fixup (including oldconfig) and no endless rebuilds will occur.
Quoted 3 lines
Reported-by "Yann E. MORIN" <[email protected]>Suggested-by "Yann E. MORIN" <[email protected]>Signed-off-by Thomas De Schampheleire <[email protected]>[tested with running multiple 'make' in sequence; tested that busybox-menuconfig still forces a fixup and a rebuild]
Tested-by "Yann E. MORIN" <[email protected]>Acked-by "Yann E. MORIN" <[email protected]>Regards,
Yann E. MORIN.Quoted 31 lines
---
v3: implement alternative implementationpackage/busybox/busybox.mk | 2 -- package/pkg-kconfig.mk | 9 ++------- package/uclibc/uclibc.mk | 6 ------ 3 files changed, 2 insertions(+), 15 deletions(-)diff -r
f81734945d5b-r707fc324a92epackage/busybox/busybox.mkpackage/busybox/busybox.mk +0
-2@@ -205,8 +205,6 @@ endef define BUSYBOX_CONFIGURE_CMDS - @yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \ - -C $(@D) oldconfig $(BUSYBOX_NOCLOBBER_INSTALL) endefdiff -r
f81734945d5b-r707fc324a92epackage/pkg-kconfig.mkpackage/pkg-kconfig.mk +2
-0@@ -50,6 +50,8 @@ # The exact rules are specified by the package .mk file. $$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config $$($(2)_KCONFIG_FIXUP_CMDS) + @yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \ + $$($(2)_KCONFIG_OPT) oldconfig $$(Q)touch $$@
Quoted 15 lines
Quoted 5 lines
package/pkg-kconfig.mk +0
-0# Before running configure, the configuration file should be present and fixeddiff -r
f81734945d5b-r707fc324a92epackage/uclibc/uclibc.mkpackage/uclibc/uclibc.mk line 434
Quoted 10 lines
package/uclibc/uclibc.mk +0
-6@@ -431,12 +431,6 @@ $(UCLIBC_LOCALE_CONFIG) $(UCLIBC_WCHAR_CONFIG) $(UCLIBC_STRIP_CONFIG) - yes "" | $(MAKE1) -C $(@D) \ - $(UCLIBC_MAKE_FLAGS) \ - PREFIX=$(STAGING_DIR) \ - DEVEL_PREFIX=/usr/ \ - RUNTIME_PREFIX=$(STAGING_DIR) \ - oldconfig endef
One small note that I did not explicitly mention in the
commit message: this MAKE1 becomes a MAKE in the infra. I don't think this a problem, but full disclosure...
Best regards,
Thomas
PATCH v3 1/1 Fix pkg-kconfig infra
In reply to Thomas De SchampheleireDear Thomas De Schampheleire,
Quoted 5 lines · Thomas De Schampheleire
Yann E. Morin (1)
infra/pkg-kconfig: join comments to the related code-blockThomas De Schampheleire (1)
infra/pkg-kconfig: incorporate oldconfig call to avoid endless rebuilds
Thanks, series applied.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com