]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/utils: Fixed a problem with get_bb_var not returning right variable.
authorLucian Musat <george.l.musat@intel.com>
Tue, 12 May 2015 15:00:06 +0000 (18:00 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 May 2015 10:41:14 +0000 (11:41 +0100)
It searches using regex now and should be more accurate.

Signed-off-by: Lucian Musat <george.l.musat@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/utils/commands.py

index bc1dbb1a5f0d625958d685edd30a3b2e0d16658d..663e4e7f4110f4ff1d6cc22edeb70f9abb9f159f 100644 (file)
@@ -16,6 +16,7 @@ import threading
 import logging
 from oeqa.utils import CommandError
 from oeqa.utils import ftools
+import re
 
 class Command(object):
     def __init__(self, command, bg=False, timeout=None, data=None, **options):
@@ -139,11 +140,11 @@ def get_bb_var(var, target=None, postconfig=None):
     bbenv = get_bb_env(target, postconfig=postconfig)
     lastline = None
     for line in bbenv.splitlines():
-        if line.startswith(var + "=") or line.startswith("export " + var + "="):
+        if re.search("^(export )?%s=" % var, line):
             val = line.split('=')[1]
             val = val.strip('\"')
             break
-        elif line.startswith("unset " + var):
+        elif re.match("unset %s$" % var, line):
             # Handle [unexport] variables
             if lastline.startswith('#   "'):
                 val = lastline.split('\"')[1]