Skip to contentSkip to conversation

oeqa/utils: Allow ~ in bblayers

PATCH In review Ed Bartosh 3 participants 5 messages Apr 30, 2015

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 oeqa/utils: Allow ~ in bblayers

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

---
 meta/lib/oeqa/utils/commands.py | 2 ++
 1 file changed, 2 insertions(+)
meta/lib/oeqa/utils/commands.py +2 -0
index e8a467f..bc1dbb1 100644
@@ -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
Signature · 1 line
2.1.4
#1 lore raw

Hi Ed,

Quoted 13 lines · On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <[email protected]>…

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

---
 meta/lib/oeqa/utils/commands.py | 2 ++
 1 file changed, 2 insertions(+)
meta/lib/oeqa/utils/commands.py +0 -0
index e8a467f..bc1dbb1 100644

meta/lib/oeqa/utils/commands.py def get_test_layer(): · line 159

Quoted 5 lines
meta/lib/oeqa/utils/commands.py +2 -0
@@ -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.

Quoted 5 lines
meta/lib/oeqa/utils/commands.py +0 -0
         if "/meta-selftest" in l and os.path.isdir(l):
             testlayer = l
             break
Signature · 1 line
2.1.4

Best wishes.
Mario

Signature · 1 line
http://www.ossystems.com.br
#2 lore raw
Quoted 25 lines · Mario Domenech Goulart

Hi Ed,

Quoted 13 lines · On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <[email protected]>…

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

---
  meta/lib/oeqa/utils/commands.py | 2 ++
  1 file changed, 2 insertions(+)
meta/lib/oeqa/utils/commands.py +0 -0
index e8a467f..bc1dbb1 100644

meta/lib/oeqa/utils/commands.py def get_test_layer(): · line 159

Quoted 5 lines
meta/lib/oeqa/utils/commands.py +2 -0
@@ -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?

Quoted 2 lines

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?

Quoted 4 lines
Quoted 4 lines
meta/lib/oeqa/utils/commands.py +0 -0
          if "/meta-selftest" in l and os.path.isdir(l):
              testlayer = l
              break
Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#3 lore raw
Quoted 25 lines · On Thu, 30 Apr 2015 07:16:28 -0600 Gary Thomas <[email protected]> wrote:
Quoted 24 lines · Mario Domenech Goulart
Quoted 13 lines · On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <[email protected]>…

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

---
  meta/lib/oeqa/utils/commands.py | 2 ++
  1 file changed, 2 insertions(+)
meta/lib/oeqa/utils/commands.py +0 -0
index e8a467f..bc1dbb1 100644

meta/lib/oeqa/utils/commands.py def get_test_layer(): · line 159

Quoted 5 lines
meta/lib/oeqa/utils/commands.py +2 -0
@@ -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?

Quoted 5 lines
Quoted 2 lines

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

Signature · 1 line
http://www.ossystems.com.br
author
#4 lore raw
In reply to Mario Domenech Goulart
Quoted 12 lines · Mario Domenech Goulart

Hi Ed,

Quoted 8 lines · On Thu, 30 Apr 2015 14:04:50 +0300 Ed Bartosh <[email protected]>…

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

---
 meta/lib/oeqa/utils/commands.py | 2 ++
 1 file changed, 2 insertions(+)
Quoted 13 lines

meta/lib/oeqa/utils/commands.py def get_test_layer(): · line 159

Quoted 10 lines
meta/lib/oeqa/utils/commands.py +2 -0
index e8a467f..bc1dbb1 100644
@@ -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