linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Arnaud Lacombe <lacombar@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	gthelen@google.com, tartler@cs.fau.de,
	Dmitry Fink <Dmitry.Fink@palm.com>,
	Darren Hart <dvhart@linux.intel.com>,
	Eric B Munson <ebmunson@us.ibm.com>,
	Bruce Ashfield <Bruce.Ashfield@windriver.com>,
	Michal Marek <mmarek@suse.cz>,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kconfig: Add merge_config.sh script
Date: Mon, 21 Nov 2011 15:29:25 -0800	[thread overview]
Message-ID: <1321918165.6445.42.camel@work-vm> (raw)
In-Reply-To: <CACqU3MWBDHJoAA5RfOdELDw-ZgsQh0f5aUPtJ4vMi-DnhjSvqQ@mail.gmail.com>

On Sat, 2011-11-19 at 01:24 -0500, Arnaud Lacombe wrote:
> Hi,
> 
> On Thu, Nov 17, 2011 at 5:54 PM, john stultz <johnstul@us.ibm.com> wrote:
> > On Thu, 2011-11-17 at 17:44 -0500, Arnaud Lacombe wrote:
> >> Hi,
> >>
> >> On Thu, Nov 17, 2011 at 4:58 PM, john stultz <johnstul@us.ibm.com> wrote:
> >> > Hey Andrew,
> >> >        I've tried sending this via Michal a few times, but haven't heard much
> >> > back. So I wanted to check if you would consider merging it via your
> >> > tree, or if you had any suggestions of who would be better to
> >> > review/merge this.
> >> >
> >> One of the worry I would have is that the script is merging config
> >> blindly, ie. there is no dependency checking done. I have some some
> >> work-in-progress to help resolving this, but still lots of thought to
> >> be implemented.
> >
> > So the script actually does warn you if a specified option is dropped
> > due to missing dependencies or if the option is removed.  So, I guess
> > could you clarify your concern a bit more?
> >
> well, assuming the following Kconfig's snippet:
> 
> choice
>         bool "choice"
> config A
>         bool "A"
> config B
>         bool "B"
> endchoice
> 
> and trying to merge:
> 
>  - `config1':
> 
> CONFIG_A=y
> 
>  - `config2':
> 
> Result in:
> 
>  % sh scripts/kconfig/merge_config.sh config1 config2
> Merging config1
> Merging config2
> scripts/kconfig/conf --alldefconfig Kconfig
> ./.tmp.config.uMY8Z97l9T:2:warning: override: B changes choice state
> #
> # configuration written to .config
> #
> 
> % cat .config
> #
> # Automatically generated file; DO NOT EDIT.
> # Linux Kernel Configuration
> #
> # CONFIG_A is not set
> CONFIG_B=y
> 
> so we still get the warning from the incantation of `alldefconfig',
> but the one in the script is defeated.
> 
> Moreover, there might still be performance optimization to realize,
> considering a base 'defconfig' amended by disabling
> CONFIG_DECOMPRESS_GZIP, we get:
> 
> % time sh scripts/kconfig/merge_config.sh base amend
> Merging base
> Merging amend
> Value of CONFIG_DECOMPRESS_GZIP is redefined by fragment amend:
> Previous value: CONFIG_DECOMPRESS_GZIP=y
> New value: # CONFIG_DECOMPRESS_GZIP is not set
> 
> scripts/kconfig/conf --alldefconfig Kconfig
> #
> # configuration written to .config
> #
> sh scripts/kconfig/merge_config.sh base amend  158.20s user 30.19s
> system 100% cpu 3:07.86 total

Yep. So you've caught a bug! Thanks for pointing this out!

> Just by getting rid of the two `| grep ...' in the last step:
> 
> --- a/scripts/kconfig/merge_config.sh
> +++ b/scripts/kconfig/merge_config.sh
> @@ -104,8 +104,8 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET
>  # Check all specified config values took (might have missed-dependency issues)
>  for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
> 
> -       REQUESTED_VAL=$(sed -n "$SED_CONFIG_EXP" $TMP_FILE | grep -w -e "$CFG")
> -       ACTUAL_VAL=$(sed -n "$SED_CONFIG_EXP" .config | grep -w -e "$CFG")
> +       REQUESTED_VAL=$(sed -n "/\<$CFG\>/!d; $SED_CONFIG_EXP" $TMP_FILE)
> +       ACTUAL_VAL=$(sed -n "/\<$CFG\>/!d; $SED_CONFIG_EXP" .config)
>         if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
>                 echo "Value requested for $CFG not in final .config"
>                 echo "Requested value:  $REQUESTED_VAL"

So, its not the greps in my mind that are the issue, its the
SED_CONF_EXP lines. Those shouldn't be applied to the REQUESTED and
ACTUAL values, since they would strip out any difference between the
two, causing the comparison to be moot.

I was trying to fix the script from complaining like:
	Value requested for CONFIG_EXPERT not in final .config
	Requested value:  # CONFIG_EXPERT=y
	Actual value:     # CONFIG_EXPERT is not set

But clearly the change was wrong.

Anyway, reverting back to something like the following should fix it:

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index b146b76..adac068 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -105,8 +105,8 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET
 # Check all specified config values took (might have missed-dependency issues)
 for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
 
-	REQUESTED_VAL=$(sed -n "$SED_CONFIG_EXP" $TMP_FILE | grep -w -e "$CFG")
-	ACTUAL_VAL=$(sed -n "$SED_CONFIG_EXP" .config | grep -w -e "$CFG")
+	REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
+	ACTUAL_VAL=$(grep -w -e "$CFG" .config)
 	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
 		echo "Value requested for $CFG not in final .config"
 		echo "Requested value:  $REQUESTED_VAL"


Andrew: Would you prefer small fixes ontop of the patch you took, or
just a new patch that includes this along with Darren's and Arnaud's
fixes? 

thanks
-john


  parent reply	other threads:[~2011-11-21 23:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 21:58 [PATCH] kconfig: Add merge_config.sh script john stultz
2011-11-17 22:44 ` Arnaud Lacombe
2011-11-17 22:54   ` john stultz
2011-11-19  6:24     ` Arnaud Lacombe
2011-11-21 18:22       ` Darren Hart
2011-11-21 23:29       ` john stultz [this message]
2011-11-21 23:41       ` john stultz
2011-11-19  6:51 ` Arnaud Lacombe
2011-11-21 18:32   ` Darren Hart
2011-11-21 22:06   ` John Stultz
2011-11-21 22:48   ` john stultz
2011-11-21 22:55     ` john stultz
2011-11-22  6:25     ` Arnaud Lacombe
2011-11-20 12:56 ` Michal Marek
2011-11-20 18:05   ` Arnaud Lacombe
2011-11-21 18:34     ` Darren Hart
2011-11-21 19:42 ` [PATCH 1/2] merge_config.sh: use signal names compatible with dash and bash Darren Hart
2011-11-21 19:42   ` [PATCH 2/2] merge_config.sh: whitespace cleanup Darren Hart
2011-11-21 20:14     ` John Stultz
2011-11-21 20:05   ` [PATCH 1/2] merge_config.sh: use signal names compatible with dash and bash John Stultz
  -- strict thread matches above, loose matches on Subject: below --
2011-10-24 22:48 [PATCH] kconfig: Add merge_config.sh script John Stultz
2011-10-24 23:05 ` Darren Hart
2011-10-04 23:45 John Stultz
2011-09-21  5:22 John Stultz
2011-09-21  6:44 ` Richard Cochran
2011-09-21 15:18   ` John Stultz
2011-09-21 15:28     ` Darren Hart
2011-09-22 20:05   ` Sam Ravnborg
2011-09-21 12:10 ` Michal Marek
2011-09-21 15:36   ` John Stultz
2011-09-21 21:42 ` Dmitry Fink (Palm GBU)
2011-09-22  1:20 ` Dmitry Fink (Palm GBU)
2011-09-22 16:18   ` Arnaud Lacombe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321918165.6445.42.camel@work-vm \
    --to=johnstul@us.ibm.com \
    --cc=Bruce.Ashfield@windriver.com \
    --cc=Dmitry.Fink@palm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvhart@linux.intel.com \
    --cc=ebmunson@us.ibm.com \
    --cc=gthelen@google.com \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=sam@ravnborg.org \
    --cc=tartler@cs.fau.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).