[oe-commits] [openembedded-core] 02/07: runqemu: fix run from testimage with non-standard DEPLOY_DIR_IMAGE

git at git.openembedded.org git at git.openembedded.org
Thu Sep 8 22:10:46 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit f08a8ca49ed75e3a71f786dc2964f88b322e886e
Author: Joshua Lock <joshua.g.lock at intel.com>
AuthorDate: Thu Sep 8 21:49:13 2016 +0100

    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]
    
    Signed-off-by: Joshua Lock <joshua.g.lock at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/runqemu | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/runqemu b/scripts/runqemu
index 7919564..9af13f3 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -278,6 +278,19 @@ class BaseConfig(object):
         elif self.get('MACHINE') == arg:
             return
         logger.info('Assuming MACHINE = %s' % arg)
+
+        # if we're running under testimage, or similarly as a child
+        # of an existing bitbake invocation, we can't invoke bitbake
+        # to validate the MACHINE setting and must assume it's correct...
+        # FIXME: testimage.bbclass exports these two variables into env,
+        # are there other scenarios in which we need to support being
+        # invoked by bitbake?
+        deploy = os.environ.get('DEPLOY_DIR_IMAGE', None)
+        bbchild = deploy and os.environ.get('OE_TMPDIR', None)
+        if bbchild:
+            self.set_machine_deploy_dir(arg, deploy)
+            return
+
         cmd = 'MACHINE=%s bitbake -e' % arg
         logger.info('Running %s...' % cmd)
         self.bitbake_e = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list