Skip to contentSkip to conversation

Config.in.legacy: add an option to get rid of all legacy at once

PATCH New Arnout Vandecappelle (Essensium/Mind) 2 participants 3 messages Jan 25, 2015 – Apr 8, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Config.in.legacy: add an option to get rid of all legacy at once

The new option BR2_SKIP_LEGACY completely disables the legacy handling, which effectively removes all the legacy options from the .config.

This option will become particularly useful for the next commit, which improves legacy handling for randconfig.

---
 Config.in.legacy | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Config.in.legacy +15 -0
index 69608c7..fbe0b88 100644
@@ -52,6 +52,9 @@
 #
 # [End of example]
 
+# BR2_SKIP_LEGACY is defined at the end of the file: it looks nicer in the menu
+if !BR2_SKIP_LEGACY
+
 config BR2_LEGACY
 	bool
 	help
@@ -1186,3 +1189,15 @@ config BR2_BFIN_FLAT
 	select BR2_LEGACY
 
 endmenu
+
+endif # BR2_SKIP_LEGACY
+
+config BR2_SKIP_LEGACY
+	bool "Forget all legacy options"
+	help
+	  Remove all the legacy options from this configuration.
+
+	  Warning: if you upgrade buildroot in the future, you will no
+	  longer be warned of legacy options that have been removed. We
+	  therefore advise to use this option only temporarily to
+	  quickly get rid of all legacy options you still have.
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 *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.

Note that it is necessary for BR2_SKIP_LEGACY to be user-visible, otherwise it will not be taken into account by 'make oldconfig' and you would be questioned about the legacy options. Also, because randconfig may randomly turn this option off or on, it is necessary to select it and not simply default to BR2_SKIP_LEGACY_FROM_ENV.

---
I ran into a lot of corner cases while developing this, so it will require testing!

---
 Config.in.legacy | 11 ++++++++++-
 Makefile         | 21 ++++++++-------------
 2 files changed, 18 insertions(+), 14 deletions(-)
Config.in.legacy +10 -1
index fbe0b88..801315b 100644
@@ -52,8 +52,17 @@
 #
 # [End of example]
 
+# Allow the non-interactive configurations (randconfig, allpackageyesconfig,
+# ...) to disable the legacy handling completely since it is not relevant.
+# Otherwise allpackageyesconfig will also select all legacy options which
+# means it cannot be built.
+config BR2_SKIP_LEGACY_FROM_ENV
+	bool
+	select BR2_SKIP_LEGACY
+	option env=SKIP_LEGACY
+
 # BR2_SKIP_LEGACY is defined at the end of the file: it looks nicer in the menu
-if !BR2_SKIP_LEGACY
+if !BR2_SKIP_LEGACY && !BR2_SKIP_LEGACY_FROM_ENV
 
 config BR2_LEGACY
 	bool
Makefile +8 -13
index 6cee027..dd2b7b6 100644
@@ -706,7 +706,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
@@ -734,23 +735,20 @@ oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 
 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)
 
 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)
 
 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)
 
 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
@@ -758,10 +756,7 @@ randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 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
@@ -769,7 +764,7 @@ allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 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
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 *config: improve handling of BR2_LEGACY

Arnout, All,

On 2015-01-25 16:31 +0100, Arnout Vandecappelle (Essensium/Mind) spake thusly:

Quoted 10 lines

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.

Note that it is necessary for BR2_SKIP_LEGACY to be user-visible, otherwise it will not be taken into account by 'make oldconfig' and you would be questioned about the legacy options. Also, because randconfig may randomly turn this option off or on, it is necessary to select it and not simply default to BR2_SKIP_LEGACY_FROM_ENV.

I was not very happy with a user-visible skip-legacy option, so I respinned a version without it.

Care to have a look and see if it still addresses all your concerns?

Thanks for this initial spin! :-)

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 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'