[oe-commits] Paul Eggleton : oe-selftest: support getting unexported variable values

git at git.openembedded.org git at git.openembedded.org
Fri Mar 20 11:28:35 UTC 2015


Module: openembedded-core.git
Branch: master
Commit: 48b58466bba084fd3439706d47e0cfbb7e951ee4
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=48b58466bba084fd3439706d47e0cfbb7e951ee4

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Fri Mar 13 18:25:33 2015 +0000

oe-selftest: support getting unexported variable values

Allow get_bb_var() to work with unexported variable values such as
MACHINE - the workaround is a little crude but should suffice for now.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 meta/lib/oeqa/utils/commands.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 5b601d9..e8a467f 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -137,11 +137,18 @@ def get_bb_env(target=None, postconfig=None):
 def get_bb_var(var, target=None, postconfig=None):
     val = None
     bbenv = get_bb_env(target, postconfig=postconfig)
+    lastline = None
     for line in bbenv.splitlines():
         if line.startswith(var + "=") or line.startswith("export " + var + "="):
             val = line.split('=')[1]
             val = val.strip('\"')
             break
+        elif line.startswith("unset " + var):
+            # Handle [unexport] variables
+            if lastline.startswith('#   "'):
+                val = lastline.split('\"')[1]
+                break
+        lastline = line
     return val
 
 def get_test_layer():



More information about the Openembedded-commits mailing list