[gnome-continuous-yocto/gnomeostree-3.28-rocko: 2364/8267] runqemu: fixes for when invoked during a bitbake run



commit 8a8948e0e1c3851aca7ad514ffc13d8416fca174
Author: Joshua Lock <joshua g lock intel com>
Date:   Wed Sep 7 23:04:25 2016 +0100

    runqemu: fixes for when invoked during a bitbake run
    
    When runqemu is invoked from a running bitbake instance it will be
    unable to call `bitbake -e` due to the lock held by the calling
    bitbake instance.
    
    Our test code sets an OE_TMPDIR environment variable from which we
    can infer/guess paths. Add code to do so when self.bitbake_e can't
    be set, much as the sh version of runqemu did.
    
    [YOCTO #10240]
    
    (From OE-Core rev: 1e8165ea2f19aecdc03ccd102ee44ef0544f0f39)
    
    Signed-off-by: Joshua Lock <joshua g lock intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/runqemu |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/scripts/runqemu b/scripts/runqemu
index 2830c15..e8d14f5 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -567,12 +567,28 @@ class BaseConfig(object):
         if not havenative:
             if not self.bitbake_e:
                 self.load_bitbake_env()
-            native_vars = ['STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE']
-            for nv in native_vars:
-                s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M)
-                if s and s.group(1) != self.get(nv):
-                    logger.info('Overriding conf file setting of %s to %s from Bitbake environment' % (nv, 
s.group(1)))
-                    self.set(nv, s.group(1))
+
+            if self.bitbake_e:
+                native_vars = ['STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE']
+                for nv in native_vars:
+                    s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M)
+                    if s and s.group(1) != self.get(nv):
+                        logger.info('Overriding conf file setting of %s to %s from Bitbake environment' % 
(nv, s.group(1)))
+                        self.set(nv, s.group(1))
+            else:
+                # when we're invoked from a running bitbake instance we won't
+                # be able to call `bitbake -e` but should have OE_TMPDIR set in
+                # the environment and can guess paths based on it
+                tmpdir = os.environ.get('OE_TMPDIR', None)
+                if tmpdir:
+                    logger.info('Setting STAGING_DIR_NATIVE and STAGING_BINDIR_NATIVE relative to OE_TMPDIR 
(%s)' % tmpdir)
+                    hostos, _, _, _, machine = os.uname()
+                    buildsys = '%s-%s' % (machine, hostos.lower())
+                    staging_dir_native = '%s/sysroots/%s' % (tmpdir, buildsys)
+                    self.set('STAGING_DIR_NATIVE', staging_dir_native)
+                    # we have to assume that STAGING_BINDIR_NATIVE is at usr/bin
+                    staging_bindir_native = '%s/usr/bin' % staging_dir_native
+                    self.set('STAGING_BINDIR_NATIVE', staging_bindir_native)
 
     def print_config(self):
         logger.info('Continuing with the following parameters:\n')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]