* [PATCH 0/3] kbuild: some scripts/config improvements (try 2) @ 2009-05-25 14:43 Michal Marek 2009-06-03 19:25 ` Sam Ravnborg 0 siblings, 1 reply; 5+ messages in thread From: Michal Marek @ 2009-05-25 14:43 UTC (permalink / raw) To: Andi Kleen; +Cc: Sam Ravnborg, linux-kernel Hi, I simplified the awk script a bit, made it awk ... && mv and removed the --set option. Michal Marek (3): kbuild: handle non-existing options in scripts/config kbuild: simplify argument loop in scripts/config kbuild: add generic --set-str option to scripts/config scripts/config | 97 +++++++++++++++++++++++++++++-------------------------- 1 files changed, 51 insertions(+), 46 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] kbuild: some scripts/config improvements (try 2) 2009-05-25 14:43 [PATCH 0/3] kbuild: some scripts/config improvements (try 2) Michal Marek @ 2009-06-03 19:25 ` Sam Ravnborg 2009-06-03 20:16 ` Andi Kleen 0 siblings, 1 reply; 5+ messages in thread From: Sam Ravnborg @ 2009-06-03 19:25 UTC (permalink / raw) To: Michal Marek, Andi Kleen; +Cc: Andi Kleen, linux-kernel On Mon, May 25, 2009 at 04:43:20PM +0200, Michal Marek wrote: > Hi, > > I simplified the awk script a bit, made it awk ... && mv and removed the > --set option. > > Michal Marek (3): > kbuild: handle non-existing options in scripts/config > kbuild: simplify argument loop in scripts/config > kbuild: add generic --set-str option to scripts/config Andi - do I have your ack on this serie? Sam ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] kbuild: some scripts/config improvements (try 2) 2009-06-03 19:25 ` Sam Ravnborg @ 2009-06-03 20:16 ` Andi Kleen 2009-06-04 5:47 ` Michal Marek 0 siblings, 1 reply; 5+ messages in thread From: Andi Kleen @ 2009-06-03 20:16 UTC (permalink / raw) To: Sam Ravnborg; +Cc: Michal Marek, Andi Kleen, linux-kernel On Wed, Jun 03, 2009 at 09:25:20PM +0200, Sam Ravnborg wrote: > On Mon, May 25, 2009 at 04:43:20PM +0200, Michal Marek wrote: > > Hi, > > > > I simplified the awk script a bit, made it awk ... && mv and removed the > > --set option. > > > > Michal Marek (3): > > kbuild: handle non-existing options in scripts/config > > kbuild: simplify argument loop in scripts/config > > kbuild: add generic --set-str option to scripts/config > > Andi - do I have your ack on this serie? Reluctantly -- most bits are ok, but the awk change seems quite overcomplicated and I don't like it particularly. -Andi -- ak@linux.intel.com -- Speaking for myself only. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] kbuild: some scripts/config improvements (try 2) 2009-06-03 20:16 ` Andi Kleen @ 2009-06-04 5:47 ` Michal Marek 2009-06-14 20:48 ` Sam Ravnborg 0 siblings, 1 reply; 5+ messages in thread From: Michal Marek @ 2009-06-04 5:47 UTC (permalink / raw) To: Andi Kleen; +Cc: Sam Ravnborg, linux-kernel On Wed, Jun 03, 2009 at 10:16:46PM +0200, Andi Kleen wrote: > On Wed, Jun 03, 2009 at 09:25:20PM +0200, Sam Ravnborg wrote: > > On Mon, May 25, 2009 at 04:43:20PM +0200, Michal Marek wrote: > > > Hi, > > > > > > I simplified the awk script a bit, made it awk ... && mv and removed the > > > --set option. > > > > > > Michal Marek (3): > > > kbuild: handle non-existing options in scripts/config > > > kbuild: simplify argument loop in scripts/config > > > kbuild: add generic --set-str option to scripts/config > > > > Andi - do I have your ack on this serie? > > Reluctantly -- most bits are ok, but the awk change seems quite overcomplicated > and I don't like it particularly. What about this one? The other two patches apply apply at slightly different offsets. Subject: [PATCH 1/3] kbuild: handle non-existing options in scripts/config If an option does not exist in .config, set it at the end of the file. Signed-off-by: Michal Marek <mmarek@suse.cz> --- scripts/config | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/config b/scripts/config index db6084b..30825a5 100755 --- a/scripts/config +++ b/scripts/config @@ -26,8 +26,6 @@ options: config doesn't check the validity of the .config file. This is done at next make time. -The options need to be already in the file before they can be changed, -but sometimes you can cheat with the --*-after options. EOL exit 1 } @@ -45,8 +43,18 @@ checkarg() { ARG="`echo $ARG | tr a-z A-Z`" } -replace() { - sed -i -e "$@" $FN +set_var() { + local name=$1 new=$2 before=$3 + + name_re="^($name=|# $name is not set)" + before_re="^($before=|# $before is not set)" + if test -n "$before" && grep -Eq "$before_re" "$FN"; then + sed -ri "/$before_re/a $new" "$FN" + elif grep -Eq "$name_re" "$FN"; then + sed -ri "s:$name_re.*:$new:" "$FN" + else + echo "$new" >>"$FN" + fi } if [ "$1" = "--file" ]; then @@ -70,20 +78,19 @@ while [ "$1" != "" ] ; do case "$CMD" in --enable|-e) checkarg "$1" - replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/" + set_var "CONFIG_$ARG" "CONFIG_$ARG=y" shift ;; --disable|-d) checkarg "$1" - replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/" + set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set" shift ;; --module|-m) checkarg "$1" - replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/" + set_var "CONFIG_$ARG" "CONFIG_$ARG=m" shift ;; @@ -109,9 +116,7 @@ while [ "$1" != "" ] ; do A=$ARG checkarg "$2" B=$ARG - replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \ - -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/" + set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A" shift shift ;; @@ -121,9 +126,7 @@ while [ "$1" != "" ] ; do A=$ARG checkarg "$2" B=$ARG - replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \ - -e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \ - -e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/" + set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A" shift shift ;; @@ -133,10 +136,7 @@ while [ "$1" != "" ] ; do A=$ARG checkarg "$2" B=$ARG - replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \ - -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \ - -e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/" + set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A" shift shift ;; -- 1.6.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] kbuild: some scripts/config improvements (try 2) 2009-06-04 5:47 ` Michal Marek @ 2009-06-14 20:48 ` Sam Ravnborg 0 siblings, 0 replies; 5+ messages in thread From: Sam Ravnborg @ 2009-06-14 20:48 UTC (permalink / raw) To: Michal Marek; +Cc: Andi Kleen, linux-kernel On Thu, Jun 04, 2009 at 07:47:08AM +0200, Michal Marek wrote: > On Wed, Jun 03, 2009 at 10:16:46PM +0200, Andi Kleen wrote: > > On Wed, Jun 03, 2009 at 09:25:20PM +0200, Sam Ravnborg wrote: > > > On Mon, May 25, 2009 at 04:43:20PM +0200, Michal Marek wrote: > > > > Hi, > > > > > > > > I simplified the awk script a bit, made it awk ... && mv and removed the > > > > --set option. > > > > > > > > Michal Marek (3): > > > > kbuild: handle non-existing options in scripts/config > > > > kbuild: simplify argument loop in scripts/config > > > > kbuild: add generic --set-str option to scripts/config > > > > > > Andi - do I have your ack on this serie? > > > > Reluctantly -- most bits are ok, but the awk change seems quite overcomplicated > > and I don't like it particularly. > > What about this one? The other two patches apply apply at slightly > different offsets. > > Subject: [PATCH 1/3] kbuild: handle non-existing options in scripts/config > > If an option does not exist in .config, set it at the end of the file. > > Signed-off-by: Michal Marek <mmarek@suse.cz> Looked readable - compared to the awk stuff. I have applied all three patches. Sam ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-14 20:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-05-25 14:43 [PATCH 0/3] kbuild: some scripts/config improvements (try 2) Michal Marek 2009-06-03 19:25 ` Sam Ravnborg 2009-06-03 20:16 ` Andi Kleen 2009-06-04 5:47 ` Michal Marek 2009-06-14 20:48 ` Sam Ravnborg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox