Patchwork [04/14] create_config: separate section for qemu_*dir variables (v2)

login
register
mail settings
Submitter Eduardo Habkost
Date April 18, 2012, 7:55 p.m.
Message ID <1334778950-18660-5-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/153584/
State New
Headers show

Comments

Eduardo Habkost - April 18, 2012, 7:55 p.m.
The generic *dir section will eventually go away and be replaced with
qemu_* section. By now, both sections will be kept, while the variables
get renamed on config-host.mak.

With this patch, a XXXdir variable will become a CONFIG_QEMU_XXXDIR
define, and a qemu_XXXdir variable will become CONFIG_QEMU_XXXDIR as
well (instead of becoming a CONFIG_QEMU_QEMU_XXXDIR define).

Changes v1 -> v2:
 - Rebase on top of newer qemu.git changes, that changed
   "tr '[:lower:]' '[:upper:]'" to "LC_ALL=C tr '[a-z]' '[A-Z]'".

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 scripts/create_config |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Eric Blake - Oct. 9, 2012, 3:02 p.m.
On 04/18/2012 01:55 PM, Eduardo Habkost wrote:
> The generic *dir section will eventually go away and be replaced with
> qemu_* section. By now, both sections will be kept, while the variables
> get renamed on config-host.mak.
> 
> With this patch, a XXXdir variable will become a CONFIG_QEMU_XXXDIR
> define, and a qemu_XXXdir variable will become CONFIG_QEMU_XXXDIR as
> well (instead of becoming a CONFIG_QEMU_QEMU_XXXDIR define).
> 
> Changes v1 -> v2:
>  - Rebase on top of newer qemu.git changes, that changed
>    "tr '[:lower:]' '[:upper:]'" to "LC_ALL=C tr '[a-z]' '[A-Z]'".
> 

> + qemu_*dir=*) # qemu-specific directory configuration
> +    name=${line%=*}

Bug.  You want ${line%%=*}, in case the value portion of this assignment
contains a second '=' character.
Eduardo Habkost - Oct. 9, 2012, 3:48 p.m.
On Tue, Oct 09, 2012 at 09:02:56AM -0600, Eric Blake wrote:
> On 04/18/2012 01:55 PM, Eduardo Habkost wrote:
> > The generic *dir section will eventually go away and be replaced with
> > qemu_* section. By now, both sections will be kept, while the variables
> > get renamed on config-host.mak.
> > 
> > With this patch, a XXXdir variable will become a CONFIG_QEMU_XXXDIR
> > define, and a qemu_XXXdir variable will become CONFIG_QEMU_XXXDIR as
> > well (instead of becoming a CONFIG_QEMU_QEMU_XXXDIR define).
> > 
> > Changes v1 -> v2:
> >  - Rebase on top of newer qemu.git changes, that changed
> >    "tr '[:lower:]' '[:upper:]'" to "LC_ALL=C tr '[a-z]' '[A-Z]'".
> > 
> 
> > + qemu_*dir=*) # qemu-specific directory configuration
> > +    name=${line%=*}
> 
> Bug.  You want ${line%%=*}, in case the value portion of this assignment
> contains a second '=' character.

The new code was simply copying the behavior of the existing "*dir=*)"
case (so no behavior would change while renaming the qemu_*dir
variables).

But I really didn't notice the bug when copying the code. Thanks for
spotting it!

Patch

diff --git a/scripts/create_config b/scripts/create_config
index 470e05e..f9ba2f5 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -13,6 +13,15 @@  case $line in
     pkgversion=${line#*=}
     echo "#define QEMU_PKGVERSION \"$pkgversion\""
     ;;
+ qemu_*dir=*) # qemu-specific directory configuration
+    name=${line%=*}
+    value=${line#*=}
+    define_name=`echo $name | LC_ALL=C tr '[a-z]' '[A-Z]'`
+    eval "define_value=\"$value\""
+    echo "#define CONFIG_$define_name \"$define_value\""
+    # save for the next definitions
+    eval "$name=\$define_value"
+    ;;
  prefix=* | [a-z]*dir=*) # directory configuration
     name=${line%=*}
     value=${line#*=}