[OE-core] [PATCH 4/4] runqemu: get NATIVE dirs from env when in source OE build dir
Joshua Lock
joshuagloe at gmail.com
Mon Sep 5 13:59:12 UTC 2016
When we're running from a sourced OE build directory parse the
STAGING_* directories from the bitbake environment, rather than
using those hard-coded in the conf file.
Signed-off-by: Joshua Lock <joshua.g.lock at intel.com>
---
scripts/runqemu | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/scripts/runqemu b/scripts/runqemu
index cfe7bff..5a97802 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -555,6 +555,16 @@ class BaseConfig(object):
logger.info('Setting DEPLOY_DIR_IMAGE to folder containing %s (%s)' % (self.qemuboot, imgdir))
self.set('DEPLOY_DIR_IMAGE', imgdir)
+ # When we're running from a sourced OE environment use the STAGING_*
+ # directories from the environment.
+ 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))
+
def print_config(self):
logger.info('Continuing with the following parameters:\n')
if not self.fstype in self.vmtypes:
@@ -815,6 +825,17 @@ class BaseConfig(object):
shutil.rmtree(self.nfs_dir)
shutil.rmtree('%s.pseudo_state' % self.nfs_dir)
+ def check_sourced_env(self):
+ bitbake = shutil.which('bitbake')
+ if bitbake and not self.bitbake_e:
+ mach = self.get('MACHINE')
+ if mach:
+ cmd = 'MACHINE=%s bitbake -e' % mach
+ else:
+ cmd = 'bitbake -e'
+ logger.info('Running %s...' % cmd)
+ self.bitbake_e = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
+
def main():
if len(sys.argv) == 1 or "help" in sys.argv:
print_usage()
@@ -826,6 +847,7 @@ def main():
logger.error(esc)
logger.error("Try 'runqemu help' on how to use it")
return 1
+ config.check_sourced_env()
config.read_qemuboot()
config.check_and_set()
config.print_config()
--
2.7.4
More information about the Openembedded-core
mailing list