diff mbox

[v2,4/5] ./configure: accept stems to match a range of targets

Message ID 1458753657-21664-5-git-send-email-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée March 23, 2016, 5:20 p.m. UTC
This is useful if you want to build all targets of a given architecture
or type. A simple submatch to an real target will add it to the list.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

Comments

Sergey Fedorov March 24, 2016, 9:23 a.m. UTC | #1
On 23/03/16 20:20, Alex Bennée wrote:
> diff --git a/configure b/configure
> index b88d0db..ebf8a42 100755
> --- a/configure
> +++ b/configure
> @@ -1246,7 +1246,8 @@ Standard options:
>    --target-list=LIST       set target list (default: build everything)
>  $(echo Available targets: $default_target_list | \
>    fold -s -w 53 | sed -e 's/^/                           /')
> -
> +                           LIST can contain stems to match sets of targets
> +                           (e.g. softmmu will match all softmmu targets)
>  Advanced options (experts only):
>    --source-path=PATH       path of source code [$source_path]
>    --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]

Maybe we'd better require user to specify the exact glob patterns in
'--target-list' to avoid possible misuse?

Kind regards,
Sergey
Alex Bennée March 24, 2016, 12:05 p.m. UTC | #2
Sergey Fedorov <serge.fdrv@gmail.com> writes:

> On 23/03/16 20:20, Alex Bennée wrote:
>> diff --git a/configure b/configure
>> index b88d0db..ebf8a42 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1246,7 +1246,8 @@ Standard options:
>>    --target-list=LIST       set target list (default: build everything)
>>  $(echo Available targets: $default_target_list | \
>>    fold -s -w 53 | sed -e 's/^/                           /')
>> -
>> +                           LIST can contain stems to match sets of targets
>> +                           (e.g. softmmu will match all softmmu targets)
>>  Advanced options (experts only):
>>    --source-path=PATH       path of source code [$source_path]
>>    --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
>
> Maybe we'd better require user to specify the exact glob patterns in
> '--target-list' to avoid possible misuse?

Don't you run into problems of escaping glob patterns from the shell and
the like? For example if I do:

12:04 alex@zen/x86_64  [qemu.git/mttcg/base-patches-v2] >./configure
--target-list=arm*

ERROR: Unknown target name 'arm-softmmu-config-devices.mak.d'

As the shell picks up file names from the src dir.

>
> Kind regards,
> Sergey


--
Alex Bennée
Sergey Fedorov March 24, 2016, 12:16 p.m. UTC | #3
On 24/03/16 15:05, Alex Bennée wrote:
> Sergey Fedorov <serge.fdrv@gmail.com> writes:
>
>> On 23/03/16 20:20, Alex Bennée wrote:
>>> diff --git a/configure b/configure
>>> index b88d0db..ebf8a42 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1246,7 +1246,8 @@ Standard options:
>>>    --target-list=LIST       set target list (default: build everything)
>>>  $(echo Available targets: $default_target_list | \
>>>    fold -s -w 53 | sed -e 's/^/                           /')
>>> -
>>> +                           LIST can contain stems to match sets of targets
>>> +                           (e.g. softmmu will match all softmmu targets)
>>>  Advanced options (experts only):
>>>    --source-path=PATH       path of source code [$source_path]
>>>    --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
>> Maybe we'd better require user to specify the exact glob patterns in
>> '--target-list' to avoid possible misuse?
> Don't you run into problems of escaping glob patterns from the shell and
> the like? For example if I do:
>
> 12:04 alex@zen/x86_64  [qemu.git/mttcg/base-patches-v2] >./configure
> --target-list=arm*
>
> ERROR: Unknown target name 'arm-softmmu-config-devices.mak.d'
>
> As the shell picks up file names from the src dir.
>

Of course, it would be necessary to quote it like this:

    ./configure --target-list='arm*'

Kind regards,
Sergey
Alex Bennée March 24, 2016, 4:05 p.m. UTC | #4
Sergey Fedorov <serge.fdrv@gmail.com> writes:

> On 24/03/16 15:05, Alex Bennée wrote:
>> Sergey Fedorov <serge.fdrv@gmail.com> writes:
>>
>>> On 23/03/16 20:20, Alex Bennée wrote:
>>>> diff --git a/configure b/configure
>>>> index b88d0db..ebf8a42 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -1246,7 +1246,8 @@ Standard options:
>>>>    --target-list=LIST       set target list (default: build everything)
>>>>  $(echo Available targets: $default_target_list | \
>>>>    fold -s -w 53 | sed -e 's/^/                           /')
>>>> -
>>>> +                           LIST can contain stems to match sets of targets
>>>> +                           (e.g. softmmu will match all softmmu targets)
>>>>  Advanced options (experts only):
>>>>    --source-path=PATH       path of source code [$source_path]
>>>>    --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
>>> Maybe we'd better require user to specify the exact glob patterns in
>>> '--target-list' to avoid possible misuse?
>> Don't you run into problems of escaping glob patterns from the shell and
>> the like? For example if I do:
>>
>> 12:04 alex@zen/x86_64  [qemu.git/mttcg/base-patches-v2] >./configure
>> --target-list=arm*
>>
>> ERROR: Unknown target name 'arm-softmmu-config-devices.mak.d'
>>
>> As the shell picks up file names from the src dir.
>>
>
> Of course, it would be necessary to quote it like this:
>
>     ./configure --target-list='arm*'

Hmm shell quoting is a black art it seems:

16:04 alex@zen/x86_64  [qemu.git/travis/add-trusty-gce] >./configure --target-list='ar*'

ERROR: Unknown target name 'arch_init.c'



>
> Kind regards,
> Sergey


--
Alex Bennée
Sergey Fedorov March 24, 2016, 4:07 p.m. UTC | #5
On 24/03/16 19:05, Alex Bennée wrote:
> Sergey Fedorov <serge.fdrv@gmail.com> writes:
>
>> On 24/03/16 15:05, Alex Bennée wrote:
>>> Sergey Fedorov <serge.fdrv@gmail.com> writes:
>>>
>>>> On 23/03/16 20:20, Alex Bennée wrote:
>>>>> diff --git a/configure b/configure
>>>>> index b88d0db..ebf8a42 100755
>>>>> --- a/configure
>>>>> +++ b/configure
>>>>> @@ -1246,7 +1246,8 @@ Standard options:
>>>>>    --target-list=LIST       set target list (default: build everything)
>>>>>  $(echo Available targets: $default_target_list | \
>>>>>    fold -s -w 53 | sed -e 's/^/                           /')
>>>>> -
>>>>> +                           LIST can contain stems to match sets of targets
>>>>> +                           (e.g. softmmu will match all softmmu targets)
>>>>>  Advanced options (experts only):
>>>>>    --source-path=PATH       path of source code [$source_path]
>>>>>    --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
>>>> Maybe we'd better require user to specify the exact glob patterns in
>>>> '--target-list' to avoid possible misuse?
>>> Don't you run into problems of escaping glob patterns from the shell and
>>> the like? For example if I do:
>>>
>>> 12:04 alex@zen/x86_64  [qemu.git/mttcg/base-patches-v2] >./configure
>>> --target-list=arm*
>>>
>>> ERROR: Unknown target name 'arm-softmmu-config-devices.mak.d'
>>>
>>> As the shell picks up file names from the src dir.
>>>
>> Of course, it would be necessary to quote it like this:
>>
>>     ./configure --target-list='arm*'
> Hmm shell quoting is a black art it seems:
>
> 16:04 alex@zen/x86_64  [qemu.git/travis/add-trusty-gce] >./configure --target-list='ar*'
>
> ERROR: Unknown target name 'arch_init.c'

Right, it's inherent problem, I think :)
Alex Bennée March 24, 2016, 4:20 p.m. UTC | #6
Sergey Fedorov <serge.fdrv@gmail.com> writes:

> On 24/03/16 19:05, Alex Bennée wrote:
>> Sergey Fedorov <serge.fdrv@gmail.com> writes:
>>
>>> On 24/03/16 15:05, Alex Bennée wrote:
>>>> Sergey Fedorov <serge.fdrv@gmail.com> writes:
>>>>
>>>>> On 23/03/16 20:20, Alex Bennée wrote:
>>>>>> diff --git a/configure b/configure
>>>>>> index b88d0db..ebf8a42 100755
>>>>>> --- a/configure
>>>>>> +++ b/configure
>>>>>> @@ -1246,7 +1246,8 @@ Standard options:
>>>>>>    --target-list=LIST       set target list (default: build everything)
>>>>>>  $(echo Available targets: $default_target_list | \
>>>>>>    fold -s -w 53 | sed -e 's/^/                           /')
>>>>>> -
>>>>>> +                           LIST can contain stems to match sets of targets
>>>>>> +                           (e.g. softmmu will match all softmmu targets)
>>>>>>  Advanced options (experts only):
>>>>>>    --source-path=PATH       path of source code [$source_path]
>>>>>>    --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
>>>>> Maybe we'd better require user to specify the exact glob patterns in
>>>>> '--target-list' to avoid possible misuse?
>>>> Don't you run into problems of escaping glob patterns from the shell and
>>>> the like? For example if I do:
>>>>
>>>> 12:04 alex@zen/x86_64  [qemu.git/mttcg/base-patches-v2] >./configure
>>>> --target-list=arm*
>>>>
>>>> ERROR: Unknown target name 'arm-softmmu-config-devices.mak.d'
>>>>
>>>> As the shell picks up file names from the src dir.
>>>>
>>> Of course, it would be necessary to quote it like this:
>>>
>>>     ./configure --target-list='arm*'
>> Hmm shell quoting is a black art it seems:
>>
>> 16:04 alex@zen/x86_64  [qemu.git/travis/add-trusty-gce] >./configure --target-list='ar*'
>>
>> ERROR: Unknown target name 'arch_init.c'
>
> Right, it's inherent problem, I think :)

Hence my decision to stick with stems ;-)

--
Alex Bennée
Sergey Fedorov March 24, 2016, 4:46 p.m. UTC | #7
24 марта 2016 г. 19:20 "Alex Bennée" <alex.bennee@linaro.org>:
> Sergey Fedorov <serge.fdrv@gmail.com> writes:
> > On 24/03/16 19:05, Alex Bennée wrote:
> >> Sergey Fedorov <serge.fdrv@gmail.com> writes:
> >>
> >>> On 24/03/16 15:05, Alex Bennée wrote:
> >>>> Sergey Fedorov <serge.fdrv@gmail.com> writes:
> >>>>
> >>>>> On 23/03/16 20:20, Alex Bennée wrote:
> >>>>>> diff --git a/configure b/configure
> >>>>>> index b88d0db..ebf8a42 100755
> >>>>>> --- a/configure
> >>>>>> +++ b/configure
> >>>>>> @@ -1246,7 +1246,8 @@ Standard options:
> >>>>>>    --target-list=LIST       set target list (default: build
everything)
> >>>>>>  $(echo Available targets: $default_target_list | \
> >>>>>>    fold -s -w 53 | sed -e 's/^/                           /')
> >>>>>> -
> >>>>>> +                           LIST can contain stems to match sets
of targets
> >>>>>> +                           (e.g. softmmu will match all softmmu
targets)
> >>>>>>  Advanced options (experts only):
> >>>>>>    --source-path=PATH       path of source code [$source_path]
> >>>>>>    --cross-prefix=PREFIX    use PREFIX for compile tools
[$cross_prefix]
> >>>>> Maybe we'd better require user to specify the exact glob patterns in
> >>>>> '--target-list' to avoid possible misuse?
> >>>> Don't you run into problems of escaping glob patterns from the shell
and
> >>>> the like? For example if I do:
> >>>>
> >>>> 12:04 alex@zen/x86_64  [qemu.git/mttcg/base-patches-v2] >./configure
> >>>> --target-list=arm*
> >>>>
> >>>> ERROR: Unknown target name 'arm-softmmu-config-devices.mak.d'
> >>>>
> >>>> As the shell picks up file names from the src dir.
> >>>>
> >>> Of course, it would be necessary to quote it like this:
> >>>
> >>>     ./configure --target-list='arm*'
> >> Hmm shell quoting is a black art it seems:
> >>
> >> 16:04 alex@zen/x86_64  [qemu.git/travis/add-trusty-gce] >./configure
--target-list='ar*'
> >>
> >> ERROR: Unknown target name 'arch_init.c'
> >
> > Right, it's inherent problem, I think :)
>
> Hence my decision to stick with stems ;-)

That is exactly the same problem as if you would like to do:

    find -name '*.[ch]'

It will do the wrong thing if you miss quotes.

Regards,
Sergey
diff mbox

Patch

diff --git a/configure b/configure
index b88d0db..ebf8a42 100755
--- a/configure
+++ b/configure
@@ -1246,7 +1246,8 @@  Standard options:
   --target-list=LIST       set target list (default: build everything)
 $(echo Available targets: $default_target_list | \
   fold -s -w 53 | sed -e 's/^/                           /')
-
+                           LIST can contain stems to match sets of targets
+                           (e.g. softmmu will match all softmmu targets)
 Advanced options (experts only):
   --source-path=PATH       path of source code [$source_path]
   --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
@@ -1639,15 +1640,29 @@  fi
 
 # Check that we recognised the target name; this allows a more
 # friendly error message than if we let it fall through.
+final_target_list=""
 for target in $target_list; do
     case " $default_target_list " in
         *" $target "*)
+            final_target_list="$target $final_target_list"
             ;;
         *)
-            error_exit "Unknown target name '$target'"
+            # Maybe we can match to range of targets?
+            exp="no"
+            for match in $default_target_list; do
+                if test "${match#*$target}" != "$match" ; then
+                    final_target_list="$match $final_target_list"
+                    exp="yes"
+                fi
+            done
+            if test "$exp" = "no"; then
+                error_exit "Unknown target name '$target'"
+            fi
             ;;
     esac
 done
+target_list=$final_target_list
+
 
 # see if system emulation was really requested
 case " $target_list " in