Skip to contentSkip to conversation

kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig

PATCH In review Aristeu Rozanski 6 participants 14 messages Apr 13, 2010 – Jun 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files. The patch's author AFAIK is Arjan van de Ven. Arjan, please add a Signed-off-by if you're the original author.

scripts/kconfig/Makefile +5 -0
@@ -69,6 +69,11 @@ localyesconfig: $(obj)/streamline_config
 	fi
 	$(Q)rm -f .tmp.config
 
+nonint_oldconfig: $(obj)/conf
+	$< -b $(Kconfig)
+loose_nonint_oldconfig: $(obj)/conf
+	$< -B $(Kconfig)
+
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
 # The symlink is used to repair a deficiency in arch/um
scripts/kconfig/conf.c +36 -8

101 lines not on this page · raw message

Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Tue, 13 Apr 2010 15:47:48 -0400 Aristeu Rozanski wrote:

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files. The patch's author AFAIK is Arjan van de Ven. Arjan, please add a Signed-off-by if you're the original author.

Roland McGrath added the loose parts according to his email of 2008.Mar.05:
"I added this one (loose_nonint_oldconfig target, -B option to conf)."

after Dave Jones posted this patch.

(adding linux-kbuild mailing list & kbuild maintainer)

scripts/kconfig/conf.c int main(int ac, char **av) · line 645

Quoted 10 lines
scripts/kconfig/conf.c +1 -1
@@ -613,5 +641,5 @@ int main(int ac, char **av)
 			exit(1);
 		}
 	}
-	return 0;
+	return return_value;
 }

Having 'make oldconfig' exit with Exit status: 139 (for example) can be confusing. I know that from experience. It took me a bit to find out what that meant. That part could be improved...

---
~Randy

#2 lore raw
Quoted 10 lines
Quoted 7 lines

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files. The patch's author AFAIK is Arjan van de Ven. Arjan, please add a Signed-off-by if you're the original author.

Roland McGrath added the loose parts according to his email of 2008.Mar.05:
"I added this one (loose_nonint_oldconfig target, -B option to conf)."

hm, I can't see the -B there, maybe the functionality he's referring to is the def_no?

Quoted 11 lines

after Dave Jones posted this patch.

(adding linux-kbuild mailing list & kbuild maintainer)

Quoted 1 line
Quoted 11 lines

scripts/kconfig/conf.c int main(int ac, char **av) · line 645

Quoted 7 lines
scripts/kconfig/conf.c +1 -1
@@ -613,5 +641,5 @@ int main(int ac, char **av)
 			exit(1);
 		}
 	}
-	return 0;
+	return return_value;
 }

Having 'make oldconfig' exit with Exit status: 139 (for example) can be confusing. I know that from experience. It took me a bit to find out what that meant. That part could be improved...

ok, no real reason to keep incrementing that. no different error codes exist other than "1". Do you think we need to introduce different return codes?

Signature · 1 line
Aristeu
#3 lore raw
Quoted 8 lines · Aristeu Rozanski
Quoted 8 lines
Quoted 7 lines

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files. The patch's author AFAIK is Arjan van de Ven. Arjan, please add a Signed-off-by if you're the original author.

Quoted 4 lines
Quoted 2 lines

Roland McGrath added the loose parts according to his email of 2008.Mar.05:
"I added this one (loose_nonint_oldconfig target, -B option to conf)."

hm, I can't see the -B there, maybe the functionality he's referring to is the def_no?

+loose_nonint_oldconfig: $(obj)/conf
+ $< -B $(Kconfig)

...

+ case 'B':
+ input_mode = dont_ask_dont_tell;
+ break;

Quoted 22 lines
Quoted 11 lines

after Dave Jones posted this patch.

(adding linux-kbuild mailing list & kbuild maintainer)

Quoted 1 line
Quoted 11 lines

scripts/kconfig/conf.c int main(int ac, char **av) · line 645

Quoted 7 lines
scripts/kconfig/conf.c +1 -1
@@ -613,5 +641,5 @@ int main(int ac, char **av)
 			exit(1);
 		}
 	}
-	return 0;
+	return return_value;
 }

Having 'make oldconfig' exit with Exit status: 139 (for example) can be confusing. I know that from experience. It took me a bit to find out what that meant. That part could be improved...

Quoted 3 lines

ok, no real reason to keep incrementing that. no different error codes exist other than "1". Do you think we need to introduce different return codes?

I would prefer a fixed value, like 86. or 11. or a useful printf text message.

Signature · 1 line
~Randy
#4 lore raw
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 7 lines

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files. The patch's author AFAIK is Arjan van de Ven. Arjan, please add a Signed-off-by if you're the original author.

Roland McGrath added the loose parts according to his email of 2008.Mar.05:
"I added this one (loose_nonint_oldconfig target, -B option to conf)."

hm, I can't see the -B there, maybe the functionality he's referring to is the def_no?

Review

Quoted 8 lines
(quoted diff) +5 -0
+loose_nonint_oldconfig: $(obj)/conf
+	$< -B $(Kconfig)
 
...
 
+		case 'B':
+			input_mode = dont_ask_dont_tell;
+			break;

ah, duh, you mean he's the author of loose_nonint_oldconfig. I somewhat thought you said the loose_nonint_oldconfig functionality was already in :)

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

after Dave Jones posted this patch.

(adding linux-kbuild mailing list & kbuild maintainer)

scripts/kconfig/conf.c int main(int ac, char **av) · line 645

Quoted 10 lines
scripts/kconfig/conf.c +1 -1
@@ -613,5 +641,5 @@ int main(int ac, char **av)
 			exit(1);
 		}
 	}
-	return 0;
+	return return_value;
 }

Having 'make oldconfig' exit with Exit status: 139 (for example) can be confusing. I know that from experience. It took me a bit to find out what that meant. That part could be improved...

Quoted 5 lines
Quoted 3 lines

ok, no real reason to keep incrementing that. no different error codes exist other than "1". Do you think we need to introduce different return codes?

I would prefer a fixed value, like 86. or 11. or a useful printf text message.

ok, will refresh and resend

Signature · 1 line
Aristeu
#5 lore raw

PATCH 1/1 kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig (v2)

In reply to Randy Dunlap

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files.

Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig.

v2:
- when -B and -b are used, return "2" so the reason can be distinguished from other errors

scripts/kconfig/Makefile +5 -0
@@ -69,6 +69,11 @@ localyesconfig: $(obj)/streamline_config
 	fi
 	$(Q)rm -f .tmp.config
 
+nonint_oldconfig: $(obj)/conf
+	$< -b $(Kconfig)
+loose_nonint_oldconfig: $(obj)/conf
+	$< -B $(Kconfig)
+
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
 # The symlink is used to repair a deficiency in arch/um
scripts/kconfig/conf.c +39 -8

110 lines not on this page · raw message

#7 lore raw

Re: [PATCH] kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig (v2)

In reply to Aristeu Rozanski
Quoted 3 lines · Aristeu Rozanski

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options

Nice.

Quoted 1 line

while loose_nonint_oldconfig will simply let the config option unset.

So loose_nonint_oldconfig is just a less chatty version of

$ yes '' | make oldconfig
? Also, you should update make help.
Quoted 18 lines

They're useful in distro kernel packages
where the config files are built using a combination of smaller config files.

Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig.

v2:
- when -B and -b are used, return "2" so the reason can be distinguished from other errors

scripts/kconfig/Makefile localyesconfig: $(obj)/streamline_config · line 75

Quoted 7 lines
scripts/kconfig/Makefile +4 -0
@@ -69,6 +69,11 @@ localyesconfig: $(obj)/streamline_config
 	fi
 	$(Q)rm -f .tmp.config
 
+nonint_oldconfig: $(obj)/conf
+	$< -b $(Kconfig)
+loose_nonint_oldconfig: $(obj)/conf
+	$< -B $(Kconfig)

Add an empty line between the two rules.

Quoted 49 lines
scripts/kconfig/Makefile +1 -0
+
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
 # The symlink is used to repair a deficiency in arch/um
scripts/kconfig/conf.c +11 -1
@@ -16,6 +16,9 @@
 #define LKC_DIRECT_LINK
 #include "lkc.h"
 
+/* Return codes */
+#define EUNSETOPT	2	/* if -B is used and unset config options were found */
+
 static void conf(struct menu *menu);
 static void check_conf(struct menu *menu);
 
@@ -23,6 +26,8 @@ enum {
 	ask_all,
 	ask_new,
 	ask_silent,
+	dont_ask,
+	dont_ask_dont_tell,
 	set_default,
 	set_yes,
 	set_mod,
@@ -360,7 +365,10 @@ static void conf(struct menu *menu)
 
 		switch (prop->type) {
 		case P_MENU:
-			if (input_mode == ask_silent && rootEntry != menu) {
+			if ((input_mode == ask_silent ||
+			     input_mode == dont_ask ||
+			     input_mode == dont_ask_dont_tell) &&
+			    rootEntry != menu) {
 				check_conf(menu);
 				return;
 			}
@@ -406,6 +414,8 @@ conf_childs:
 		indent -= 2;
 }
 
+static int return_value;
+
 static void check_conf(struct menu *menu)
 {
 	struct symbol *sym;
@@ -418,10 +428,19 @@ static void check_conf(struct menu *menu
 	if (sym && !sym_has_value(sym)) {
 		if (sym_is_changable(sym) ||

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 435

Quoted 10 lines
scripts/kconfig/conf.c +5 -4
 		    (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
-			if (!conf_cnt++)
-				printf(_("*\n* Restart config...\n*\n"));
-			rootEntry = menu_get_parent_menu(menu);
-			conf(rootEntry);
+			if (input_mode == dont_ask ||
+			    input_mode == dont_ask_dont_tell) {
+				if (input_mode == dont_ask &&
+				    sym->name && !sym_is_choice_value(sym)) {
+					fprintf(stderr,"CONFIG_%s\n",sym->name);

You should print "The following variables are not set:" or something like that before the first variable, otherwise it's not very clear what the list means.

scripts/kconfig/conf.c static void check_conf(struct menu *menu · line 436

Quoted 1 line
scripts/kconfig/conf.c +1 -0
+					return_value = EUNSETOPT;

The name 'return_value' is a little confusing, we call exit(0) or exit(1) at several places, but this variable only affects a single statement. What about

static int unset_variables;
...
unset_variables++;
...
return unset_variables ? EUNSETOPT : 0;

? Also, define the static var at the beginning of the file, where the remaining variables are defined.

Quoted 60 lines
scripts/kconfig/conf.c +21 -2
+				}
+			} else {
+				if (!conf_cnt++)
+					printf(_("*\n* Restart config...\n*\n"));
+				rootEntry = menu_get_parent_menu(menu);
+				conf(rootEntry);
+			}
 		}
 	}
 
@@ -439,7 +458,7 @@ int main(int ac, char **av)
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
-	while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
+ 	while ((opt = getopt(ac, av, "osbBdD:nmyrh")) != -1) {
 		switch (opt) {
 		case 'o':
 			input_mode = ask_silent;
@@ -448,6 +467,12 @@ int main(int ac, char **av)
 			input_mode = ask_silent;
 			sync_kconfig = 1;
 			break;
+		case 'b':
+			input_mode = dont_ask;
+			break;
+		case 'B':
+			input_mode = dont_ask_dont_tell;
+			break;
 		case 'd':
 			input_mode = set_default;
 			break;
@@ -525,6 +550,8 @@ int main(int ac, char **av)
 	case ask_silent:
 	case ask_all:
 	case ask_new:
+	case dont_ask:
+	case dont_ask_dont_tell:
 		conf_read(NULL);
 		break;
 	case set_no:
@@ -586,12 +613,16 @@ int main(int ac, char **av)
 		conf(&rootmenu);
 		input_mode = ask_silent;
 		/* fall through */
+	case dont_ask:
+	case dont_ask_dont_tell:
 	case ask_silent:
 		/* Update until a loop caused no more changes */
 		do {
 			conf_cnt = 0;
 			check_conf(&rootmenu);
-		} while (conf_cnt);
+		} while (conf_cnt &&
+			 (input_mode != dont_ask &&
+			  input_mode != dont_ask_dont_tell));
 		break;
 	}
 

scripts/kconfig/conf.c int main(int ac, char **av) · line 647

Quoted 5 lines
scripts/kconfig/conf.c +1 -1
@@ -613,5 +644,5 @@ int main(int ac, char **av)
 			exit(1);
 		}
 	}
-	return 0;
+	return return_value;

IMO nonint_oldconfig should not update the .config if it's going to fail. At least I find this output quite confusing:

$ make nonint_oldconfig
scripts/kconfig/conf -b arch/x86/Kconfig
CONFIG_FOO
#
# configuration written to .config
#
make[1]: *** [nonint_oldconfig] Error 2
make: *** [nonint_oldconfig] Error 2

and a subsequent make nonint_oldconfig call does not fail.

Michal

#8 lore raw

PATCH 1/1 kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig (v3)

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files.

Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig.

v2:
- when -B and -b are used, return "2" so the reason can be distinguished from other errors
v3:
- help updated
- nonint_oldconfig won't update the config file if options are missing

---
 scripts/kconfig/Makefile |   10 +++++++++
 scripts/kconfig/conf.c   |   52 ++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 53 insertions(+), 9 deletions(-)
scripts/kconfig/Makefile +10 -0
@@ -69,6 +69,12 @@ localyesconfig: $(obj)/streamline_config
 	fi
 	$(Q)rm -f .tmp.config
 
+nonint_oldconfig: $(obj)/conf
+	$< -b $(Kconfig)
+
+loose_nonint_oldconfig: $(obj)/conf
+	$< -B $(Kconfig)
+
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
 # The symlink is used to repair a deficiency in arch/um
@@ -132,6 +138,10 @@ help:
 	@echo  '  allmodconfig	  - New config selecting modules when possible'
 	@echo  '  allyesconfig	  - New config where all options are accepted with yes'
 	@echo  '  allnoconfig	  - New config where all options are answered with no'
+	@echo  '  nonint_oldconfig - Checks the current configuration and fails if an option is '
+	@echo  '                    not set'
+	@echo  '  loose_nonint_oldconfig - Same as nonint_oldconfig, but updates the config file with '
+	@echo  '                    missing config options as unset'
 
 # lxdialog stuff
 check-lxdialog  := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
scripts/kconfig/conf.c +43 -9

120 lines not on this page · raw message

#9 lore raw

Re: [PATCH] kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig (v3)

Quoted 9 lines · Aristeu Rozanski

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files.

Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig.

Quoted 6 lines

v2:
- when -B and -b are used, return "2" so the reason can be distinguished from other errors
v3:
- help updated
- nonint_oldconfig won't update the config file if options are missing

The patch looks fine, but, why the name 'nonint_oldconfig'? My English is not good enough to see what 'nonint' standards for...

Thanks.

#10 lore raw

Re: [PATCH] kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig (v3)

Quoted 17 lines · Américo Wang
Quoted 9 lines · Aristeu Rozanski

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files.

Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig.

Quoted 6 lines

v2:
- when -B and -b are used, return "2" so the reason can be distinguished from other errors
v3:
- help updated
- nonint_oldconfig won't update the config file if options are missing

Quoted 2 lines

The patch looks fine, but, why the name 'nonint_oldconfig'? My English is not good enough to see what 'nonint' standards for...

non-interactive

Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
#11 lore raw

Re: [PATCH] kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig (v3)

Quoted 18 lines · Randy Dunlap
Quoted 17 lines · Américo Wang
Quoted 15 lines · Aristeu Rozanski

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files.

Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig.

v2:
- when -B and -b are used, return "2" so the reason can be distinguished from other errors
v3:
- help updated
- nonint_oldconfig won't update the config file if options are missing

Quoted 5 lines
Quoted 2 lines

The patch looks fine, but, why the name 'nonint_oldconfig'? My English is not good enough to see what 'nonint' standards for...

non-interactive

Got it, thanks!

#12 lore raw

Re: [PATCH] kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig (v3)

In reply to Aristeu Rozanski
Quoted 16 lines · Aristeu Rozanski

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files.

Arjan van de Ven wrote the initial nonint_config and Roland McGrath added the loose_nonint_oldconfig.

v2:
- when -B and -b are used, return "2" so the reason can be distinguished from other errors
v3:
- help updated
- nonint_oldconfig won't update the config file if options are missing

Quoted 5 lines

Sorry for the delay. Applied now.

Michal

Acked-by on v1 1/1
#13 lore raw
In reply to Aristeu Rozanski
Quoted 9 lines · Aristeu Rozanski

This patch has been around for a long time in Fedora and Red Hat Enterprise Linux kernels and it may be useful for others. The nonint_oldconfig target will fail and print the unset config options while loose_nonint_oldconfig will simply let the config option unset. They're useful in distro kernel packages where the config files are built using a combination of smaller config files. The patch's author AFAIK is Arjan van de Ven. Arjan, please add a Signed-off-by if you're the original author.

this gets funny with employers chaning etc ;)