Skip to contentSkip to conversation

randconfig, allyesconfig: fix handling of legacy options

PATCH New Arnout Vandecappelle (Essensium/Mind) 3 participants 8 messages Oct 14, 2014 – Jan 24, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 randconfig, allyesconfig: fix handling of legacy options

Randconfig and allyesconfig should never select legacy options, so use the same trick as allpackageyesconfig and randpackageconfig to remove them.

---
 Makefile | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
Makefile +16 -2
index 907a0fc..5bcaa77 100644
@@ -731,11 +731,25 @@ 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)
+	@rm -f $(CONFIG_DIR)/.config.nopkg
+	@grep '^config ' Config.in.legacy | \
+		while read config pkg; do \
+		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
+	@$(COMMON_CONFIG_ENV) \
+		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
+		$< --randconfig $(CONFIG_CONFIG_IN)
+	@rm -f $(CONFIG_DIR)/.config.nopkg
 
 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
+	@rm -f $(CONFIG_DIR)/.config.nopkg
+	@grep '^config ' Config.in.legacy | \
+		while read config pkg; do \
+		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
+	@$(COMMON_CONFIG_ENV) \
+		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
+		$< --allyesconfig $(CONFIG_CONFIG_IN)
+	@rm -f $(CONFIG_DIR)/.config.nopkg
 
 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
Signature · 1 line
2.1.1
#1 lore raw

PATCH v3 2/2 randconfig: seed with BR2_RAND_PRESEED_CONFIG_FILES

Currently, randconfig is completely unusable. Instead, we use randpackageconfig, with two use cases: in the autobuilders, and when doing manual testing of the validity of depends/select chains. In both cases, we actually want the possibility to explicitly select some packages or to set a string value or to randomise between a choice or to test bootloaders and kernels - all of this is currently impossible.

This patch adds a BR2_RAND_PRESEED_CONFIG_FILES environment variable that can be set to a (set of) files with config options that should be set or unset. randconfig and randpackageconfig will force these values.

---
v3:
- use 'cat' instead of 'cp', to support multiple files. [Yann]

v2:
- split off the fix for legacy
- apply to both randconfig and randpackageconfig
- rename to BR2_RAND_PRESEED_CONFIG_FILES because it supports multiple files

---
 Makefile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Makefile +10 -2
index 5bcaa77..070c2e8 100644
@@ -732,6 +732,9 @@ oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@rm -f $(CONFIG_DIR)/.config.nopkg
+ifneq ($(BR2_RAND_PRESEED_CONFIG_FILES),)
+	@cat $(BR2_RAND_PRESEED_CONFIG_FILES) > $(CONFIG_DIR)/.config.nopkg
+endif
 	@grep '^config ' Config.in.legacy | \
 		while read config pkg; do \
 		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
@@ -758,6 +761,9 @@ allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
+ifneq ($(BR2_RAND_PRESEED_CONFIG_FILES),)
+	@grep BR2_PACKAGE_ $(BR2_RAND_PRESEED_CONFIG_FILES) >> $(CONFIG_DIR)/.config.nopkg
+endif
 	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
 		while read config pkg; do \
 		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
@@ -870,13 +876,15 @@ help:
 	@echo '  oldconfig              - resolve any unresolved symbols in .config'
 	@echo '  silentoldconfig        - Same as oldconfig, but quietly, additionally update deps'
 	@echo '  olddefconfig           - Same as silentoldconfig but sets new symbols to their default value'
-	@echo '  randconfig             - New config with random answer to all options'
+	@echo '  randconfig             - New config with random answer to all options -'
+	@echo '                             options can be forced by setting BR2_RAND_PRESEED_CONFIG_FILES'
 	@echo '  defconfig              - New config with default answer to all options'
 	@echo '                             BR2_DEFCONFIG, if set, is used as input'
 	@echo '  savedefconfig          - Save current config as ./defconfig (minimal config)'
 	@echo '  allyesconfig           - New config where all options are accepted with yes'
 	@echo '  allnoconfig            - New config where all options are answered with no'
-	@echo '  randpackageconfig      - New config with random answer to package options'
+	@echo '  randpackageconfig      - New config with random answer to package options -'
+	@echo '                             options can be forced by setting BR2_RAND_PRESEED_CONFIG_FILES'
 	@echo '  allyespackageconfig    - New config where pkg options are accepted with yes'
 	@echo '  allnopackageconfig     - New config where package options are answered with no'
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
Signature · 1 line
2.1.1
#2 lore raw

PATCH v3 2/2 randconfig: seed with BR2_RAND_PRESEED_CONFIG_FILES

Arnout, All,

On 2014-10-14 11:24 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:

Quoted 7 lines

Currently, randconfig is completely unusable. Instead, we use randpackageconfig, with two use cases: in the autobuilders, and when doing manual testing of the validity of depends/select chains. In both cases, we actually want the possibility to explicitly select some packages or to set a string value or to randomise between a choice or to test bootloaders and kernels - all of this is currently impossible.

Quoted 8 lines

This patch adds a BR2_RAND_PRESEED_CONFIG_FILES environment variable that can be set to a (set of) files with config options that should be set or unset. randconfig and randpackageconfig will force these values.

Regards,
Yann E. MORIN.

Quoted 60 lines

---
v3:
- use 'cat' instead of 'cp', to support multiple files. [Yann]

v2:
- split off the fix for legacy
- apply to both randconfig and randpackageconfig
- rename to BR2_RAND_PRESEED_CONFIG_FILES because it supports multiple files

---
 Makefile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Makefile +10 -2
index 5bcaa77..070c2e8 100644
@@ -732,6 +732,9 @@ oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@rm -f $(CONFIG_DIR)/.config.nopkg
+ifneq ($(BR2_RAND_PRESEED_CONFIG_FILES),)
+	@cat $(BR2_RAND_PRESEED_CONFIG_FILES) > $(CONFIG_DIR)/.config.nopkg
+endif
 	@grep '^config ' Config.in.legacy | \
 		while read config pkg; do \
 		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
@@ -758,6 +761,9 @@ allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
+ifneq ($(BR2_RAND_PRESEED_CONFIG_FILES),)
+	@grep BR2_PACKAGE_ $(BR2_RAND_PRESEED_CONFIG_FILES) >> $(CONFIG_DIR)/.config.nopkg
+endif
 	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
 		while read config pkg; do \
 		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
@@ -870,13 +876,15 @@ help:
 	@echo '  oldconfig              - resolve any unresolved symbols in .config'
 	@echo '  silentoldconfig        - Same as oldconfig, but quietly, additionally update deps'
 	@echo '  olddefconfig           - Same as silentoldconfig but sets new symbols to their default value'
-	@echo '  randconfig             - New config with random answer to all options'
+	@echo '  randconfig             - New config with random answer to all options -'
+	@echo '                             options can be forced by setting BR2_RAND_PRESEED_CONFIG_FILES'
 	@echo '  defconfig              - New config with default answer to all options'
 	@echo '                             BR2_DEFCONFIG, if set, is used as input'
 	@echo '  savedefconfig          - Save current config as ./defconfig (minimal config)'
 	@echo '  allyesconfig           - New config where all options are accepted with yes'
 	@echo '  allnoconfig            - New config where all options are answered with no'
-	@echo '  randpackageconfig      - New config with random answer to package options'
+	@echo '  randpackageconfig      - New config with random answer to package options -'
+	@echo '                             options can be forced by setting BR2_RAND_PRESEED_CONFIG_FILES'
 	@echo '  allyespackageconfig    - New config where pkg options are accepted with yes'
 	@echo '  allnopackageconfig     - New config where package options are answered with no'
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
Signature · 1 line
2.1.1
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.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v3 1/2 randconfig, allyesconfig: fix handling of legacy options

In reply to Arnout Vandecappelle (Essensium/Mind)

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 32 lines · Arnout Vandecappelle (Essensium/Mind)

Randconfig and allyesconfig should never select legacy options, so use the same trick as allpackageyesconfig and randpackageconfig to remove them.

---
 Makefile | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
Makefile +9 -2
index 907a0fc..5bcaa77 100644
@@ -731,11 +731,25 @@ 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)
+	@rm -f $(CONFIG_DIR)/.config.nopkg
+	@grep '^config ' Config.in.legacy | \
+		while read config pkg; do \
+		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
+	@$(COMMON_CONFIG_ENV) \
+		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
+		$< --randconfig $(CONFIG_CONFIG_IN)
+	@rm -f $(CONFIG_DIR)/.config.nopkg
 
 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
+	@rm -f $(CONFIG_DIR)/.config.nopkg

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

Quoted 10 lines
Makefile +7 -0
+	@grep '^config ' Config.in.legacy | \
+		while read config pkg; do \
+		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
+	@$(COMMON_CONFIG_ENV) \
+		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
+		$< --allyesconfig $(CONFIG_CONFIG_IN)
+	@rm -f $(CONFIG_DIR)/.config.nopkg
 
 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config

I was going to apply this, and then I tested it, to discover that it then causes the same problem as the one we have with randpackageconfig
today: none of the choice options get randomized anymore. So before this patch, if you do "randconfig", you get proper randomization. After this patch, if you do "randconfig", it only generates i386 configurations.

I admit it's not really an issue introduced by the patch as the issue already exists for randpackageconfig. But it's very annoying :/

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v3 1/2 randconfig, allyesconfig: fix handling of legacy options

Hello,

Quoted 9 lines · Thomas Petazzoni

I was going to apply this, and then I tested it, to discover that it then causes the same problem as the one we have with randpackageconfig
today: none of the choice options get randomized anymore. So before this patch, if you do "randconfig", you get proper randomization. After this patch, if you do "randconfig", it only generates i386 configurations.

I admit it's not really an issue introduced by the patch as the issue already exists for randpackageconfig. But it's very annoying :/

Any comment about this?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v3 1/2 randconfig, allyesconfig: fix handling of legacy options

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · Thomas Petazzoni

I was going to apply this, and then I tested it, to discover that it then causes the same problem as the one we have with randpackageconfig
today: none of the choice options get randomized anymore. So before this patch, if you do "randconfig", you get proper randomization. After this patch, if you do "randconfig", it only generates i386 configurations.

Quoted 4 lines
Quoted 2 lines

I admit it's not really an issue introduced by the patch as the issue already exists for randpackageconfig. But it's very annoying :/

Any comment about this?

Well, as you explained to me in Dusseldorf, the main reason to use randconfig
is to test against buggy Config.in depends/select chains. If the choices wouldn't get properly randomized anymore, that would really kill this use case. So I guess that's a no go.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#6 lore raw

PATCH v3 1/2 randconfig, allyesconfig: fix handling of legacy options

Dear Arnout Vandecappelle,

Quoted 9 lines · Arnout Vandecappelle
Quoted 4 lines
Quoted 2 lines

I admit it's not really an issue introduced by the patch as the issue already exists for randpackageconfig. But it's very annoying :/

Any comment about this?

Well, as you explained to me in Dusseldorf, the main reason to use randconfig
is to test against buggy Config.in depends/select chains. If the choices wouldn't get properly randomized anymore, that would really kill this use case. So I guess that's a no go.

Well, the other day, I actually attempted to use randconfig to really have random configurations, and see how broken they are. But randconfig is unusable today, since it selects a bunch of legacy options, which prevents the build from starting.

I'm not sure I actually use randconfig to test buggy Config.in depends/select. I actually tend to use randpackageconfig: I fix a certain arch/toolchain combination, and sent to a bit of randpackageconfig. Which indeed means that I'm not testing everything since the choices are not randomized.

Do we have a hope of getting properly randomized choices one day. Are there other options?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH v3 1/2 randconfig, allyesconfig: fix handling of legacy options

Quoted 14 lines · Thomas Petazzoni

Dear Arnout Vandecappelle,

Quoted 9 lines · Arnout Vandecappelle
Quoted 4 lines
Quoted 2 lines

I admit it's not really an issue introduced by the patch as the issue already exists for randpackageconfig. But it's very annoying :/

Any comment about this?

Well, as you explained to me in Dusseldorf, the main reason to use randconfig
is to test against buggy Config.in depends/select chains. If the choices wouldn't get properly randomized anymore, that would really kill this use case. So I guess that's a no go.

Quoted 4 lines

Well, the other day, I actually attempted to use randconfig to really have random configurations, and see how broken they are. But randconfig is unusable today, since it selects a bunch of legacy options, which prevents the build from starting.

The use case that currently does work is:

while true; do make randconfig; done

If there is something wrong with depends/select chains, you'll get the
occasional error like

warning: (BR2_PACKAGE_FOO) selects BR2_PACKAGE_BAR which has unmet direct dependencies (!BR2_STATIC_LIBS && BR2_PACKAGE_HAS_UDEV)

My invalid fix of randconfig would make that use case less relevant, because
the invalid chain may depend on some choice value.

I guess it must have been Yann who explained it to me, not you :-)

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F