Skip to contentSkip to conversation

*config: improve handling of BR2_LEGACY

PATCH New Arnout Vandecappelle (Essensium/Mind) 2 participants 2 messages Apr 10, 2015 – Apr 11, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 *config: improve handling of BR2_LEGACY

In 8a46d4bf1f the randpackageconfig and allpackageyesconfig were extended with disabling all the legacy options, otherwise the resulting config couldn't be built. However, that didn't work for randconfig and allyesconfig.

This commit reverts 8a46d4bf1f and replaces it with a different
approach: skipping of the legacy config options is passed explicitly through the environment variable SKIP_LEGACY, which forces BR2_SKIP_LEGACY to y. The new option BR2_SKIP_LEGACY completely disables the legacy handling, which effectively removes all the legacy options from the .config.

However, in that case no values are set for the legacy options so a subsequent oldconfig will query them. Therefore, run an additional olddefconfig.

[yann.morin.1998 at free.fr: do not rely on a user-visible option, works
perfectly well with only blind options set from the environment]

---
Changes v3 -> v4: (Arnout)
- remove redundant BR2_SKIP_LEGACY_ENV
- improve commit message
- add an explanatory comment

Changes v2 -> v3: (Yann)
- add the missing pieces (calling olddefconfig)

Changes v1 -> v2: (Yann)
- don't use a user-visible option

---
 Config.in.legacy |  8 ++++++++
 Makefile         | 32 +++++++++++++++++++-------------
 2 files changed, 27 insertions(+), 13 deletions(-)
Config.in.legacy +8 -0
index 0fc794f..97bc939 100644
@@ -52,6 +52,12 @@
 #
 # [End of example]
 
+config BR2_SKIP_LEGACY
+	bool
+	option env="SKIP_LEGACY"
+
+if !BR2_SKIP_LEGACY
+
 config BR2_LEGACY
 	bool
 	help
@@ -1288,3 +1294,5 @@ config BR2_BFIN_FLAT
 	select BR2_LEGACY
 
 endmenu
+
+endif # !SKIP_LEGACY
Makefile +19 -13
index 5f9a2c3..23fd6da 100644
@@ -696,7 +696,8 @@ COMMON_CONFIG_ENV = \
 	KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
 	KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
 	BR2_CONFIG=$(BR2_CONFIG) \
-	BR2_EXTERNAL=$(BR2_EXTERNAL)
+	BR2_EXTERNAL=$(BR2_EXTERNAL) \
+	SKIP_LEGACY=
 
 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
@@ -718,51 +719,56 @@ config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
 
+# For the config targets that automatically select options, we pass
+# BR2_LEGACY=y to disable the legacy options. However, in that case
+# no values are set for the legacy options so a subsequent oldconfig
+# will query them. Therefore, run an additional olddefconfig.
+
 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	mkdir -p $(BUILD_DIR)/buildroot-config
 	@$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
 
 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
+	@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
+	@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
 
 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
+	@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig $(CONFIG_CONFIG_IN)
+	@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
 
 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
+	@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
+	@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
 
 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
-	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
-		while read config pkg; do \
-		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
-	@$(COMMON_CONFIG_ENV) \
+	@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
 		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
 		$< --randconfig $(CONFIG_CONFIG_IN)
 	@rm -f $(CONFIG_DIR)/.config.nopkg
+	@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
 
 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
-	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
-		while read config pkg; do \
-		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
-	@$(COMMON_CONFIG_ENV) \
+	@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
 		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
 		$< --allyesconfig $(CONFIG_CONFIG_IN)
 	@rm -f $(CONFIG_DIR)/.config.nopkg
+	@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
 
 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
-	@$(COMMON_CONFIG_ENV) \
+	@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
 		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
 		$< --allnoconfig $(CONFIG_CONFIG_IN)
 	@rm -f $(CONFIG_DIR)/.config.nopkg
+	@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
 
 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
Signature · 1 line
2.1.4
#1 lore raw

PATCH v4 1/1 *config: improve handling of BR2_LEGACY

Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:

In 8a46d4bf1f the randpackageconfig and allpackageyesconfig were extended with disabling all the legacy options, otherwise the resulting config couldn't be built. However, that didn't work for randconfig and allyesconfig.

This commit reverts 8a46d4bf1f and replaces it with a different
approach: skipping of the legacy config options is passed explicitly through the environment variable SKIP_LEGACY, which forces BR2_SKIP_LEGACY to y. The new option BR2_SKIP_LEGACY completely disables the legacy handling, which effectively removes all the legacy options from the .config.

However, in that case no values are set for the legacy options so a subsequent oldconfig will query them. Therefore, run an additional olddefconfig.

[yann.morin.1998 at free.fr: do not rely on a user-visible option, works
perfectly well with only blind options set from the environment]

---
Changes v3 -> v4: (Arnout)
- remove redundant BR2_SKIP_LEGACY_ENV
- improve commit message
- add an explanatory comment

Makefile config: $(BUILD_DIR)/buildroot-config/conf outputmakefile · line 723

Quoted 5 lines
Makefile +2 -0
@@ -718,51 +719,56 @@ config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
 
+# For the config targets that automatically select options, we pass
+# BR2_LEGACY=y to disable the legacy options. However, in that case

This should be SKIP_LEGACY=y. Committed with that fixed, thanks.

Signature · 1 line
Bye, Peter Korsgaard