All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Lacombe <lacombar@gmail.com>
To: John Stultz <johnstul@us.ibm.com>
Cc: Arnaud Lacombe <lacombar@gmail.com>,
	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: Sat, 19 Nov 2011 01:51:30 -0500	[thread overview]
Message-ID: <1321685490-11706-1-git-send-email-lacombar@gmail.com> (raw)
In-Reply-To: <1321567131.25715.32.camel@work-vm>

Hi,

On Thu, Nov 17, 2011 at 4:58 PM, john stultz <johnstul@us.ibm.com> wrote:
> [...]
>
> v2:
>  * Reworked to use alldefconfig instead of the proposed
> olddefconfig as suggested by Sam Ravnborg.
>
> v3:
>  * Script improvements from Dmitri.
>  * allnoconfig option from Darren
>  * pre-make exit option from Darren
>  * lots of other fixes/cleanups from Darren.
>  * Fix final check to not compain about config values in comments
>
If Dmitri and Darren have direct contribution to the script, shouldn't their
Signed-off-by tag be present ?

> Please let me know if you have any comments or thoughts!
>
> CC: Sam Ravnborg <sam@ravnborg.org>
> CC: gthelen@google.com
> CC: tartler@cs.fau.de
> CC: Dmitry Fink <Dmitry.Fink@palm.com>
> CC: Darren Hart <dvhart@linux.intel.com>
> CC: Eric B Munson <ebmunson@us.ibm.com>
> CC: Bruce Ashfield <Bruce.Ashfield@windriver.com>
> CC: Michal Marek <mmarek@suse.cz>
> CC: linux-kbuild@vger.kernel.org
> Signed-off-by: John Stultz <john.stultz@linaro.org>

You'll find below some more nits

1) bail out early on error.

This fixes handling of non-existant file:

Before:
    % sh scripts/kconfig/merge_config.sh non existant files
    Merging non
    sed: can't read non: No such file or directory
    cat: non: No such file or directory
    Merging existant
    sed: can't read existant: No such file or directory
    cat: existant: No such file or directory
    Merging files
    sed: can't read files: No such file or directory
    cat: files: No such file or directory
    scripts/kconfig/conf --alldefconfig Kconfig
    #
    # configuration written to .config
    #

After:

    % sh scripts/kconfig/merge_config.sh non existant files
    Merging non
    sed: can't read non: No such file or directory

2) re-implement argument parsing using sh(1) getopts builtin

3) verify that the script was given enough argument to proceed. There isn't
much point running the script with less than 2 arguments.

CC: Sam Ravnborg <sam@ravnborg.org>
CC: gthelen@google.com
CC: tartler@cs.fau.de
CC: Dmitry Fink <Dmitry.Fink@palm.com>
CC: Darren Hart <dvhart@linux.intel.com>
CC: Eric B Munson <ebmunson@us.ibm.com>
CC: Bruce Ashfield <Bruce.Ashfield@windriver.com>
CC: Michal Marek <mmarek@suse.cz>
CC: linux-kbuild@vger.kernel.org
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
---
 scripts/kconfig/merge_config.sh |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 890276b..abfd8b2 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -20,6 +20,8 @@
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #  See the GNU General Public License for more details.
 
+set -e
+
 clean_up() {
        rm -f $TMP_FILE
        exit
@@ -36,29 +38,27 @@ usage() {
 MAKE=true
 ALLTARGET=alldefconfig
 
-while true; do
-	case $1 in
-	"-n")
+while getopts "nmh" opt; do
+	case ${opt} in
+	n)
 		ALLTARGET=allnoconfig
-		shift
-		continue
 		;;
-	"-m")
+	m)
 		MAKE=false
-		shift
-		continue
 		;;
-	"-h")
+	h)
 		usage
 		exit
 		;;
-	*)
-		break
-		;;
 	esac
 done
 
+shift $(expr $OPTIND - 1)
 
+if [ $# -lt 2 ]; then
+	usage
+	exit 1
+fi
 
 MERGE_LIST=$*
 SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
-- 
1.7.6.153.g78432


  parent reply	other threads:[~2011-11-19  6:51 UTC|newest]

Thread overview: 34+ 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
2011-11-21 23:41       ` john stultz
2011-11-19  6:51 ` Arnaud Lacombe [this message]
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-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=1321685490-11706-1-git-send-email-lacombar@gmail.com \
    --to=lacombar@gmail.com \
    --cc=Bruce.Ashfield@windriver.com \
    --cc=Dmitry.Fink@palm.com \
    --cc=dvhart@linux.intel.com \
    --cc=ebmunson@us.ibm.com \
    --cc=gthelen@google.com \
    --cc=johnstul@us.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.