[gnome-continuous-yocto/gnomeostree-3.28-rocko: 3771/8267] scripts/runqemu: Allow to use qemu from host.



commit 3f6e6f4e69f644bd466774607f43b8f306376b42
Author: Mariano Lopez <mariano lopez linux intel com>
Date:   Tue Nov 22 11:31:53 2016 -0600

    scripts/runqemu: Allow to use qemu from host.
    
    This will add support to use qemu from the running host,
    with this is possible to put qemu-native in ASSUME_PROVIDED
    variable.
    
    By default it will try to get qemu from the build sysroot,
    and only if it fails will try to use the host's qemu.
    
    (From OE-Core rev: fe7fd2cd3a9c4fb5b31bd3cab81c96a3b81cb540)
    
    Signed-off-by: Mariano Lopez <mariano lopez linux intel com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/runqemu |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/scripts/runqemu b/scripts/runqemu
index af25423..0a9cb94 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -906,6 +906,21 @@ class BaseConfig(object):
             raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!")
 
         qemu_bin = '%s/%s' % (self.get('STAGING_BINDIR_NATIVE'), qemu_system)
+
+        # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't
+        # find QEMU in sysroot, it needs to use host's qemu.
+        if not os.path.exists(qemu_bin):
+            logger.info("QEMU binary not found in %s, trying host's QEMU" % qemu_bin)
+            for path in (os.environ['PATH'] or '').split(':'):
+                qemu_bin_tmp = os.path.join(path, qemu_system)
+                logger.info("Trying: %s" % qemu_bin_tmp)
+                if os.path.exists(qemu_bin_tmp):
+                    qemu_bin = qemu_bin_tmp
+                    if not os.path.isabs(qemu_bin):
+                        qemu_bin = os.path.abspath(qemu_bin)
+                    logger.info("Using host's QEMU: %s" % qemu_bin)
+                    break
+
         if not os.access(qemu_bin, os.X_OK):
             raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin)
 


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