diff mbox

[v2,2/2] randconfig: seed with BR2_RAND_PRESEED_CONFIG_FILES

Message ID 1413138065-6138-2-git-send-email-arnout@mind.be
State Superseded
Headers show

Commit Message

Arnout Vandecappelle Oct. 12, 2014, 6:21 p.m. UTC
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.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
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

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 Makefile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Yann E. MORIN Oct. 14, 2014, 7:32 a.m. UTC | #1
Arnout, All,

On 2014-10-12 20:21 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
> 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.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> 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
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
>  Makefile | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 5bcaa77..fb99de1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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),)
> +	@cp $(BR2_RAND_PRESEED_CONFIG_FILES) $(CONFIG_DIR)/.config.nopkg
> +endif

I guess you meant something like:
    @cat $(BR2_RAND_PRESEED_CONFIG_FILES) $>(CONFIG_DIR)/.config.nopkg

Here's what I get with cp:
    $ cp foo bar buz
    cp: target ‘buz’ is not a directory

>  	@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

Why do you explicitly grep for packages here?

Regards,
Yann E. MORIN.
Arnout Vandecappelle Oct. 14, 2014, 9:08 a.m. UTC | #2
On 14/10/14 09:32, Yann E. MORIN wrote:
> Arnout, All,
>
> On 2014-10-12 20:21 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
[snip]
> > diff --git a/Makefile b/Makefile
> > index 5bcaa77..fb99de1 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -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),)
> > +    @cp $(BR2_RAND_PRESEED_CONFIG_FILES) $(CONFIG_DIR)/.config.nopkg
> > +endif
>
> I guess you meant something like:
>     @cat $(BR2_RAND_PRESEED_CONFIG_FILES) $>(CONFIG_DIR)/.config.nopkg
>
> Here's what I get with cp:
>     $ cp foo bar buz
>     cp: target ‘buz’ is not a directory

 Well spotted, thanks. I changed _FILE into _FILES at the last moment
but never tested it.



>
> >      @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
>
> Why do you explicitly grep for packages here?

 .config.nopkg will already contain the config of everything else (cfr.
the line above). So if you keep the full preseed file, you'll get duplicate
definitions in the .config.nopkg.

 Of course, if you do

cp foo .config
make randpackageconfig BR2_RAND_PRESEED_CONFIG_FILES=bar

then the .config only contains whatever you had in foo, which is presumably
a toolchain config fragment. But that use case is better handled with

make randconfig BR2_RAND_PRESEED_CONFIG_FILES="foo bar"


 Regards,
 Arnout
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 5bcaa77..fb99de1 100644
--- a/Makefile
+++ b/Makefile
@@ -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),)
+	@cp $(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)