Patchwork [19/20] gcc-cross-testing: Fix evaluation of user and target name

login
register
mail settings
Submitter Khem Raj
Date Feb. 6, 2012, 6:40 a.m.
Message ID <2f04aa9f17c455c3d42ecb81975e425746973bef.1328510189.git.raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/20755/
State Accepted
Commit 9c575b5f37ee53eaf26bfdc468d4cbb661db703f
Headers show

Comments

Saul Wold - Feb. 7, 2012, 5:21 p.m.
On 02/05/2012 10:40 PM, Khem Raj wrote:
> Dont use -q to grep we pipe to /dev/null anyway all we
> care is the return status of grep
>
> Signed-off-by: Khem Raj<raj.khem@gmail.com>
>
> xxx
>
> Signed-off-by: Khem Raj<raj.khem@gmail.com>

The patch seem valid, but the commit message needs to be cleaned up.


Sau!

> ---
>   meta/recipes-devtools/gcc/gcc-cross.inc |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
> index 6acf8c5..b16c57d 100644
> --- a/meta/recipes-devtools/gcc/gcc-cross.inc
> +++ b/meta/recipes-devtools/gcc/gcc-cross.inc
> @@ -65,11 +65,11 @@ then
>   	exit 1;
>   fi
>
> -echo "\$target" | grep ?q "@">&  /dev/null
> +echo "\$target" | grep "@">&  /dev/null
>   if [ "x\$?" = "x0" ]
>   then
> -   user=echo \$target | cut -d '@' -f 1
> -   target=echo \$target | cut -d '@' -f 2
> +   user=\$(echo \$target | cut -d '@' -f 1)
> +   target=\$(echo \$target | cut -d '@' -f 2)
>   else
>      user=\$USER
>   fi
Otavio Salvador - Feb. 7, 2012, 5:49 p.m.
On Mon, Feb 6, 2012 at 04:40, Khem Raj <raj.khem@gmail.com> wrote:

> Dont use -q to grep we pipe to /dev/null anyway all we
> care is the return status of grep
>

There're any reason to not use grep -q and drop the pipe?
Khem Raj - Feb. 7, 2012, 6:07 p.m.
On Tue, Feb 7, 2012 at 9:21 AM, Saul Wold <sgw@linux.intel.com> wrote:
> On 02/05/2012 10:40 PM, Khem Raj wrote:
>>
>> Dont use -q to grep we pipe to /dev/null anyway all we
>> care is the return status of grep
>>
>> Signed-off-by: Khem Raj<raj.khem@gmail.com>
>>
>> xxx
>>
>> Signed-off-by: Khem Raj<raj.khem@gmail.com>
>
>
> The patch seem valid, but the commit message needs to be cleaned up.

also updated


>
>
> Sau!
>
>
>> ---
>>  meta/recipes-devtools/gcc/gcc-cross.inc |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc
>> b/meta/recipes-devtools/gcc/gcc-cross.inc
>> index 6acf8c5..b16c57d 100644
>> --- a/meta/recipes-devtools/gcc/gcc-cross.inc
>> +++ b/meta/recipes-devtools/gcc/gcc-cross.inc
>> @@ -65,11 +65,11 @@ then
>>        exit 1;
>>  fi
>>
>> -echo "\$target" | grep ?q "@">&  /dev/null
>> +echo "\$target" | grep "@">&  /dev/null
>>  if [ "x\$?" = "x0" ]
>>  then
>> -   user=echo \$target | cut -d '@' -f 1
>> -   target=echo \$target | cut -d '@' -f 2
>> +   user=\$(echo \$target | cut -d '@' -f 1)
>> +   target=\$(echo \$target | cut -d '@' -f 2)
>>  else
>>     user=\$USER
>>  fi
Khem Raj - Feb. 7, 2012, 6:18 p.m.
On Tue, Feb 7, 2012 at 9:49 AM, Otavio Salvador <otavio@ossystems.com.br> wrote:
>
> There're any reason to not use grep -q and drop the pipe?

yes. I dont need to know stderr along with stdio just return value is enough

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
index 6acf8c5..b16c57d 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -65,11 +65,11 @@  then
 	exit 1;
 fi
 
-echo "\$target" | grep ?q "@" >& /dev/null
+echo "\$target" | grep "@" >& /dev/null
 if [ "x\$?" = "x0" ]
 then
-   user=echo \$target | cut -d '@' -f 1
-   target=echo \$target | cut -d '@' -f 2
+   user=\$(echo \$target | cut -d '@' -f 1)
+   target=\$(echo \$target | cut -d '@' -f 2)
 else
    user=\$USER
 fi