linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@linux.intel.com>
To: Darren Hart <dvhart@linux.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	John Stultz <johnstul@us.ibm.com>,
	Dmitry Fink <Dmitry.Fink@palm.com>
Subject: Re: [PATCH 1/2] merge_config.sh: do not print non-matching lines in the sed expressions
Date: Mon, 26 Sep 2011 20:30:13 -0700	[thread overview]
Message-ID: <4E814345.2070102@linux.intel.com> (raw)
In-Reply-To: <a3c278930a1995e5c78486a20763a1ec780f63c4.1317093857.git.dvhart@linux.intel.com>

On 09/26/2011 08:25 PM, Darren Hart wrote:
> The script picks up on comment lines and run into failed grep commands and
> spew lots of warnings about "#" not being set and so forth.
> 
> sed will print non-matching lines without the -n option. Add -n and a p (print)
> to each sed command. This will ensure only the CONFIG_* lines are used for
> value comparison, and comment lines are ignored. # CONFIG_XYZ is not set are
> still matched and not treated as comments. This addresses an issue Dmitry raised
> without another pipe and call to grep.
> 
> Move the sed expression into a variable to avoid getting the regular expressions
> in the two call sites out of sync.
> 
> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> CC: Dmitry Fink <Dmitry.Fink@palm.com>
> ---
>  scripts/kconfig/merge_config.sh |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
> index fda0139..a644724 100755
> --- a/scripts/kconfig/merge_config.sh
> +++ b/scripts/kconfig/merge_config.sh
> @@ -25,11 +25,12 @@ MERGE_LIST=$*
>  
>  TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
>  
> +SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
> +
>  # Merge files, printing warnings on overrided values
>  for MERGE_FILE in $MERGE_LIST ; do
>  	echo "Merging $MERGE_FILE"
> -	CFG_LIST=`cat $MERGE_FILE | \
> -	  sed 's/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/'`
> +	CFG_LIST=`cat $MERGE_FILE | sed -n "$SED_CONFIG_EXP"`

Gah, and this doesn't need the cat either:

        CFG_LIST=`sed -n "$SED_CONFIG_EXP" $MERGE_FILE`

--
Darren

>  	for CFG in $CFG_LIST ; do
>  		grep -q -w $CFG $TMP_FILE
>  		if [ $? == 0 ] ; then
> @@ -53,10 +54,7 @@ done
>  make KCONFIG_ALLCONFIG=$TMP_FILE alldefconfig
>  
>  # Check all specified config values took (might have missed-dependency issues)
> -cat $TMP_FILE | while read line; do
> -	CFG=`echo $line | \
> -		sed 's/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/'`
> -
> +for CFG in `sed -n "$SED_CONFIG_EXP" $TMP_FILE`; do
>  	REQUESTED_VAL=`grep -w -e "$CFG" $TMP_FILE`
>  	ACTUAL_VAL=`grep -w -e "$CFG" .config`
>  	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

      parent reply	other threads:[~2011-09-27  3:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21  5:22 [PATCH] kconfig: Add merge_config.sh script 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
2011-09-27  3:25 ` Darren Hart
2011-09-27  3:25   ` [PATCH 1/2] merge_config.sh: do not print non-matching lines in the sed expressions Darren Hart
2011-09-27  3:25     ` [PATCH 2/2] merge_config.sh: trap signals and clean up Darren Hart
2011-09-27  3:30     ` Darren Hart [this message]

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=4E814345.2070102@linux.intel.com \
    --to=dvhart@linux.intel.com \
    --cc=Dmitry.Fink@palm.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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).