]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa.utils.commands: use get_bb_vars() in get_bb_var()
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 2 May 2016 11:16:30 +0000 (14:16 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 1 Jul 2016 15:08:48 +0000 (16:08 +0100)
Get rid of duplicate code.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/utils/commands.py

index 0297e53dccf3a735fcdc5b30fe3c9e17bbdebf10..2e513be6af5312a342ff0ebac09c928707a15bbc 100644 (file)
@@ -172,24 +172,14 @@ def get_bb_vars(variables=None, target=None, postconfig=None):
                 if not variables:
                     break
         lastline = line
+    if variables:
+        # Fill in missing values
+        for var in variables:
+            values[var] = None
     return values
 
 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 re.search("^(export )?%s=" % var, line):
-            val = line.split('=', 1)[1]
-            val = val.strip('\"')
-            break
-        elif re.match("unset %s$" % var, line):
-            # Handle [unexport] variables
-            if lastline.startswith('#   "'):
-                val = lastline.split('\"')[1]
-                break
-        lastline = line
-    return val
+    return get_bb_vars([var], target, postconfig)[var]
 
 def get_test_layer():
     layers = get_bb_var("BBLAYERS").split()