]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-selftest: support getting unexported variable values
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Fri, 13 Mar 2015 18:25:33 +0000 (18:25 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 20 Mar 2015 11:03:13 +0000 (11:03 +0000)
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@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/utils/commands.py

index 5b601d980644fad2a34cbe1d7640f5ad6ea64669..e8a467f4cd900b953f5d346da287ec98baa31116 100644 (file)
@@ -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():