Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] oeqa/utils: Allow ~ in bblayers
@ 2015-04-30 11:04 Ed Bartosh
  2015-04-30 13:08 ` Mario Domenech Goulart
  0 siblings, 1 reply; 5+ messages in thread
From: Ed Bartosh @ 2015-04-30 11:04 UTC (permalink / raw)
  To: openembedded-core

Bitbake can parse ~ in bblayer's paths.
Added this functionality to oeqa code.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 meta/lib/oeqa/utils/commands.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index e8a467f..bc1dbb1 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -155,6 +155,8 @@ def get_test_layer():
     layers = get_bb_var("BBLAYERS").split()
     testlayer = None
     for l in layers:
+        if '~' in l:
+            l = os.path.expanduser(l)
         if "/meta-selftest" in l and os.path.isdir(l):
             testlayer = l
             break
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] oeqa/utils: Allow ~ in bblayers
  2015-04-30 11:04 [PATCH] oeqa/utils: Allow ~ in bblayers Ed Bartosh
@ 2015-04-30 13:08 ` Mario Domenech Goulart
  2015-04-30 13:16   ` Gary Thomas
  2015-04-30 13:24   ` Ed Bartosh
  0 siblings, 2 replies; 5+ messages in thread
From: Mario Domenech Goulart @ 2015-04-30 13:08 UTC (permalink / raw)
  To: Ed Bartosh; +Cc: openembedded-core

Hi Ed,

On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <ed.bartosh@linux.intel.com> wrote:

> Bitbake can parse ~ in bblayer's paths.
> Added this functionality to oeqa code.
>
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
>  meta/lib/oeqa/utils/commands.py | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
> index e8a467f..bc1dbb1 100644
> --- a/meta/lib/oeqa/utils/commands.py
> +++ b/meta/lib/oeqa/utils/commands.py
> @@ -155,6 +155,8 @@ def get_test_layer():
>      layers = get_bb_var("BBLAYERS").split()
>      testlayer = None
>      for l in layers:
> +        if '~' in l:
> +            l = os.path.expanduser(l)

Is the "if '~' in l" test necessary?

AFAIK, applying expanduser to a string that doesn't contain '~' will
just return the string itself.

>          if "/meta-selftest" in l and os.path.isdir(l):
>              testlayer = l
>              break
> -- 
> 2.1.4

Best wishes.
Mario
-- 
http://www.ossystems.com.br


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] oeqa/utils: Allow ~ in bblayers
  2015-04-30 13:08 ` Mario Domenech Goulart
@ 2015-04-30 13:16   ` Gary Thomas
  2015-04-30 13:30     ` Mario Domenech Goulart
  2015-04-30 13:24   ` Ed Bartosh
  1 sibling, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2015-04-30 13:16 UTC (permalink / raw)
  To: openembedded-core

On 2015-04-30 07:08, Mario Domenech Goulart wrote:
> Hi Ed,
>
> On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
>
>> Bitbake can parse ~ in bblayer's paths.
>> Added this functionality to oeqa code.
>>
>> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
>> ---
>>   meta/lib/oeqa/utils/commands.py | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
>> index e8a467f..bc1dbb1 100644
>> --- a/meta/lib/oeqa/utils/commands.py
>> +++ b/meta/lib/oeqa/utils/commands.py
>> @@ -155,6 +155,8 @@ def get_test_layer():
>>       layers = get_bb_var("BBLAYERS").split()
>>       testlayer = None
>>       for l in layers:
>> +        if '~' in l:
>> +            l = os.path.expanduser(l)
>
> Is the "if '~' in l" test necessary?
>
> AFAIK, applying expanduser to a string that doesn't contain '~' will
> just return the string itself.

True, but why expand (create a new string, have to garbage-collect
the old one, etc) when it's not necessary?

>
>>           if "/meta-selftest" in l and os.path.isdir(l):
>>               testlayer = l
>>               break

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] oeqa/utils: Allow ~ in bblayers
  2015-04-30 13:08 ` Mario Domenech Goulart
  2015-04-30 13:16   ` Gary Thomas
@ 2015-04-30 13:24   ` Ed Bartosh
  1 sibling, 0 replies; 5+ messages in thread
From: Ed Bartosh @ 2015-04-30 13:24 UTC (permalink / raw)
  To: Mario Domenech Goulart; +Cc: openembedded-core

On Thu, Apr 30, 2015 at 01:08:09PM +0000, Mario Domenech Goulart wrote:
> Hi Ed,
> 
> On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
> 
> > Bitbake can parse ~ in bblayer's paths.
> > Added this functionality to oeqa code.
> >
> > Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> > ---
> >  meta/lib/oeqa/utils/commands.py | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
> > index e8a467f..bc1dbb1 100644
> > --- a/meta/lib/oeqa/utils/commands.py
> > +++ b/meta/lib/oeqa/utils/commands.py
> > @@ -155,6 +155,8 @@ def get_test_layer():
> >      layers = get_bb_var("BBLAYERS").split()
> >      testlayer = None
> >      for l in layers:
> > +        if '~' in l:
> > +            l = os.path.expanduser(l)
> 
> Is the "if '~' in l" test necessary?
> 

I did this to show why expanduser is called at all. This makes code self-explanatory and easier to understand.
I was suggested to do it here: http://lists.openembedded.org/pipermail/bitbake-devel/2015-April/005661.html

--
Regards,
Ed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] oeqa/utils: Allow ~ in bblayers
  2015-04-30 13:16   ` Gary Thomas
@ 2015-04-30 13:30     ` Mario Domenech Goulart
  0 siblings, 0 replies; 5+ messages in thread
From: Mario Domenech Goulart @ 2015-04-30 13:30 UTC (permalink / raw)
  To: Gary Thomas; +Cc: openembedded-core

On Thu, 30 Apr 2015 07:16:28 -0600 Gary Thomas <gary@mlbassoc.com> wrote:

> On 2015-04-30 07:08, Mario Domenech Goulart wrote:
>>
>> On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
>>
>>> Bitbake can parse ~ in bblayer's paths.
>>> Added this functionality to oeqa code.
>>>
>>> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
>>> ---
>>>   meta/lib/oeqa/utils/commands.py | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
>>> index e8a467f..bc1dbb1 100644
>>> --- a/meta/lib/oeqa/utils/commands.py
>>> +++ b/meta/lib/oeqa/utils/commands.py
>>> @@ -155,6 +155,8 @@ def get_test_layer():
>>>       layers = get_bb_var("BBLAYERS").split()
>>>       testlayer = None
>>>       for l in layers:
>>> +        if '~' in l:
>>> +            l = os.path.expanduser(l)
>>
>> Is the "if '~' in l" test necessary?
>>
>> AFAIK, applying expanduser to a string that doesn't contain '~' will
>> just return the string itself.
>
> True, but why expand (create a new string, have to garbage-collect
> the old one, etc) when it's not necessary?

Good point, Gary.  Maybe we should only care about '~' as the first
character in paths?  In this case, "if l.startswith('~')" would do the
trick.

Best wishes.
Mario
-- 
http://www.ossystems.com.br


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-30 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30 11:04 [PATCH] oeqa/utils: Allow ~ in bblayers Ed Bartosh
2015-04-30 13:08 ` Mario Domenech Goulart
2015-04-30 13:16   ` Gary Thomas
2015-04-30 13:30     ` Mario Domenech Goulart
2015-04-30 13:24   ` Ed Bartosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox