[PATCH] kconfig: introduce nonint_oldconfig and loose_nonint_oldconfig

Previous thread: [PATCH] reiserfs: Fix corruption during shrinking of xattrs by Jeff Mahoney on Tuesday, April 13, 2010 - 12:39 pm. (3 messages)

Next thread: 2.6.33.1: USB camera hung_task_timeout_secs >120 seconds by Martin Mokrejs on Tuesday, April 13, 2010 - 12:43 pm. (1 message)
From: Aristeu Rozanski
Date: Tuesday, April 13, 2010 - 12:47 pm

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.

Signed-off-by: Aristeu Rozanski <aris@redhat.com> 

--- linus-2.6.orig/scripts/kconfig/Makefile	2010-04-13 15:15:10.000000000 -0400
+++ linus-2.6/scripts/kconfig/Makefile	2010-04-13 15:15:23.000000000 -0400
@@ -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
--- linus-2.6.orig/scripts/kconfig/conf.c	2010-04-13 15:15:10.000000000 -0400
+++ linus-2.6/scripts/kconfig/conf.c	2010-04-13 15:15:54.000000000 -0400
@@ -23,6 +23,8 @@ enum {
 	ask_all,
 	ask_new,
 	ask_silent,
+	dont_ask,
+	dont_ask_dont_tell,
 	set_default,
 	set_yes,
 	set_mod,
@@ -360,7 +362,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 +411,8 @@ conf_childs:
 		indent -= 2;
 }
 
+static int return_value;
+
 static void check_conf(struct menu *menu)
 {
 	struct symbol *sym;
@@ -418,10 +425,19 @@ static void check_conf(struct menu *menu
 	if (sym && !sym_has_value(sym)) {
 		if (sym_is_changable(sym) ||
 		    ...
From: Randy Dunlap
Date: Tuesday, April 13, 2010 - 1:00 pm

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)


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

From: Aristeu Rozanski
Date: Tuesday, April 13, 2010 - 1:18 pm

hm, I can't see the -B there, maybe the functionality he's referring to is
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?

-- 
Aristeu

--

From: Randy Dunlap
Date: Tuesday, April 13, 2010 - 1:24 pm

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

...

+		case 'B':
+			input_mode = dont_ask_dont_tell;

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

-- 
~Randy
--

From: Aristeu Rozanski
Date: Tuesday, April 13, 2010 - 1:44 pm

ah, duh, you mean he's the author of loose_nonint_oldconfig. I somewhat thought
ok, will refresh and resend

-- 
Aristeu

--

From: Aristeu Rozanski
Date: Tuesday, April 13, 2010 - 2:03 pm

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

Signed-off-by: Arjan van de Ven <arjan@redhat.com> [defunct email]
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Aristeu Rozanski <aris@redhat.com>

--- linus-2.6.orig/scripts/kconfig/Makefile	2010-04-13 16:30:47.000000000 -0400
+++ linus-2.6/scripts/kconfig/Makefile	2010-04-13 16:48:24.000000000 -0400
@@ -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
--- linus-2.6.orig/scripts/kconfig/conf.c	2010-04-13 16:30:47.000000000 -0400
+++ linus-2.6/scripts/kconfig/conf.c	2010-04-13 16:53:20.000000000 -0400
@@ -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 == ...
From: Kyle McMartin
Date: Tuesday, April 13, 2010 - 2:26 pm

Thanks for prepping this for submission, Aris.

Whatevered-by: Kyle McMartin <kyle@redhat.com>
--

From: Michal Marek
Date: Wednesday, April 14, 2010 - 6:22 am

So loose_nonint_oldconfig is just a less chatty version of
$ yes '' | make oldconfig


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

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

From: Aristeu Rozanski
Date: Thursday, May 6, 2010 - 9:48 am

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

Signed-off-by: Arjan van de Ven <arjan@redhat.com> [defunct email]
Whatevered-by: Kyle McMartin <kyle@redhat.com>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
---
 scripts/kconfig/Makefile |   10 +++++++++
 scripts/kconfig/conf.c   |   52 ++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 53 insertions(+), 9 deletions(-)

--- linus-2.6.orig/scripts/kconfig/Makefile	2010-04-15 14:12:59.000000000 -0400
+++ linus-2.6/scripts/kconfig/Makefile	2010-05-06 12:37:28.000000000 -0400
@@ -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  '  ...
From: Américo Wang
Date: Friday, May 7, 2010 - 12:02 am

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

Thanks.
--

From: Randy Dunlap
Date: Friday, May 7, 2010 - 7:28 am

non-interactive

-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--

From: Américo Wang
Date: Tuesday, May 11, 2010 - 11:12 pm

Got it, thanks!
--

From: Michal Marek
Date: Wednesday, June 2, 2010 - 5:44 am

Sorry for the delay. Applied now.

Michal
--

From: Arjan van de Ven
Date: Tuesday, April 13, 2010 - 1:43 pm

this gets funny with employers chaning etc ;)


Signed-off-by: Arjan van de Ven <arjan@redhat.com> [defunct email]
Acked-by: Arjan van de Ven <arjan@linux.intel.com>


--

Previous thread: [PATCH] reiserfs: Fix corruption during shrinking of xattrs by Jeff Mahoney on Tuesday, April 13, 2010 - 12:39 pm. (3 messages)

Next thread: 2.6.33.1: USB camera hung_task_timeout_secs >120 seconds by Martin Mokrejs on Tuesday, April 13, 2010 - 12:43 pm. (1 message)