diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2016-09-08 21:49:13 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-09 12:07:32 +0100 |
commit | d1303c220e9a64bbfc7b225cf7354b5f7784856d (patch) | |
tree | ba1313a640e5dfd1f5583558afdf23cd55d7812e | |
parent | 8a8948e0e1c3851aca7ad514ffc13d8416fca174 (diff) | |
download | poky-d1303c220e9a64bbfc7b225cf7354b5f7784856d.tar.gz |
runqemu: fix run from testimage with non-standard DEPLOY_DIR_IMAGE
testimage.bbclass uses runqemu to execute runtime tests on a qemu
target, this means that bitbake is already running and `bitbake -e`
can't be called to obtain bitbake variables.
runqemu tries to work around being unable to read values for
bitbake variables by inferring the MACHINE from the
DEPLOY_DIR_IMAGE setting, however if a user sets that variable in
a manner which doesn't follow the systems expectations (i.e. if
running `bitbake -c testimage` against a directory of pre-generated
images in a user-specified path) the inferring of the MACHINE name
from the DEPLOY_DIR_IMAGE location will fail.
It's possible that check_arg_machine() shouldn't cause runqemu to
fail and that runqemu should proceed with the user-supplied value
even if it can't be verified. This patch simply ensures that a
workflow where the user sets DEPLOY_DIR_IMAGE continues to work
without changing too much of the runqemu code.
[YOCTO #10238]
(From OE-Core rev: f94ac02f459e2ea0fc471463966997814a67e0ca)
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/runqemu | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index e8d14f5142..91e72cbc50 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -277,6 +277,19 @@ class BaseConfig(object): | |||
277 | elif self.get('MACHINE') == arg: | 277 | elif self.get('MACHINE') == arg: |
278 | return | 278 | return |
279 | logger.info('Assuming MACHINE = %s' % arg) | 279 | logger.info('Assuming MACHINE = %s' % arg) |
280 | |||
281 | # if we're running under testimage, or similarly as a child | ||
282 | # of an existing bitbake invocation, we can't invoke bitbake | ||
283 | # to validate the MACHINE setting and must assume it's correct... | ||
284 | # FIXME: testimage.bbclass exports these two variables into env, | ||
285 | # are there other scenarios in which we need to support being | ||
286 | # invoked by bitbake? | ||
287 | deploy = os.environ.get('DEPLOY_DIR_IMAGE', None) | ||
288 | bbchild = deploy and os.environ.get('OE_TMPDIR', None) | ||
289 | if bbchild: | ||
290 | self.set_machine_deploy_dir(arg, deploy) | ||
291 | return | ||
292 | |||
280 | cmd = 'MACHINE=%s bitbake -e' % arg | 293 | cmd = 'MACHINE=%s bitbake -e' % arg |
281 | logger.info('Running %s...' % cmd) | 294 | logger.info('Running %s...' % cmd) |
282 | self.bitbake_e = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') | 295 | self.bitbake_e = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') |