diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-05-02 14:16:30 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-01 16:22:45 +0100 |
commit | cf4c8980d788dd0cc45084bfbd3d7164346054e9 (patch) | |
tree | 3e1492f93ec472694714617ae0242d9924524e89 /meta | |
parent | c9639e6523ce8b0ce0cfa1ace9bfe8777ab07053 (diff) | |
download | poky-cf4c8980d788dd0cc45084bfbd3d7164346054e9.tar.gz |
oeqa.utils.commands: use get_bb_vars() in get_bb_var()
Get rid of duplicate code.
(From OE-Core rev: cdd6b7386afd460337705d8117a4328d4993ecef)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/utils/commands.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 0297e53dcc..2e513be6af 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py | |||
@@ -172,24 +172,14 @@ def get_bb_vars(variables=None, target=None, postconfig=None): | |||
172 | if not variables: | 172 | if not variables: |
173 | break | 173 | break |
174 | lastline = line | 174 | lastline = line |
175 | if variables: | ||
176 | # Fill in missing values | ||
177 | for var in variables: | ||
178 | values[var] = None | ||
175 | return values | 179 | return values |
176 | 180 | ||
177 | def get_bb_var(var, target=None, postconfig=None): | 181 | def get_bb_var(var, target=None, postconfig=None): |
178 | val = None | 182 | return get_bb_vars([var], target, postconfig)[var] |
179 | bbenv = get_bb_env(target, postconfig=postconfig) | ||
180 | lastline = None | ||
181 | for line in bbenv.splitlines(): | ||
182 | if re.search("^(export )?%s=" % var, line): | ||
183 | val = line.split('=', 1)[1] | ||
184 | val = val.strip('\"') | ||
185 | break | ||
186 | elif re.match("unset %s$" % var, line): | ||
187 | # Handle [unexport] variables | ||
188 | if lastline.startswith('# "'): | ||
189 | val = lastline.split('\"')[1] | ||
190 | break | ||
191 | lastline = line | ||
192 | return val | ||
193 | 183 | ||
194 | def get_test_layer(): | 184 | def get_test_layer(): |
195 | layers = get_bb_var("BBLAYERS").split() | 185 | layers = get_bb_var("BBLAYERS").split() |