[U-Boot] [PATCH] MAKEALL: allow regex matches for -s option
Stephen Warren
swarren at wwwdotorg.org
Tue Mar 5 22:43:02 CET 2013
On 03/05/2013 02:37 PM, Wolfgang Denk wrote:
> Dear Stephen Warren,
>
> In message <1362518101-5742-1-git-send-email-swarren at wwwdotorg.org> you wrote:
>> From: Stephen Warren <swarren at nvidia.com>
>>
>> This allows:
>>
>> MAKEALL -s tegra*
>>
>> to replace:
>>
>> MAKEALL -s tegra20 -s tegra30 -s tegra114
>>
>> Signed-off-by: Stephen Warren <swarren at nvidia.com>
>> ---
>> MAKEALL | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/MAKEALL b/MAKEALL
>> index 5b06c54..0ed6986 100755
>> --- a/MAKEALL
>> +++ b/MAKEALL
>> @@ -101,9 +101,9 @@ while true ; do
>> -s|--soc)
>> # echo "Option SoC: argument \`$2'"
>> if [ "$opt_s" ] ; then
>> - opt_s="${opt_s%)} || \$6 == \"$2\")"
>> + opt_s="${opt_s%)} || \$6 == \"$2\" || \$6 ~ /$2/)"
>
> Is this actually correct? I see 2 x closing parens here, with no
> matching open parens?
Yes, it's confusing, but I believe correct (although I didn't actually
test multiple -s options).
What happens is that the else branch sets up an expression with 1
opening and 1 closing parenthesis. The if branch extends this by
stripping the closing parenthesis during expansion of the existing value
"%)", and then adds more to the expression, including a new closing
parenthesis.
It probably breaks if there's a ) specified in the command-line option,
but none of the names in boards.cfg would require that, and fixing it
easily probably requires re-writing the script in some other language.
More information about the U-Boot
mailing list