Skip to contentSkip to conversation

base: decode SRC_URI before adding implicit fetch dependencies

PATCH New Ross Burton 1 participant 4 messages Nov 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 base: decode SRC_URI before adding implicit fetch dependencies

To avoid false positives such as a SRC_URI for http://foo.xz/foo.zip gaining a dependnecy on xz-native decode the URI so that precise tests can be done.

---
 meta/classes/base.bbclass | 67 ++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 33 deletions(-)
meta/classes/base.bbclass +34 -33
index eb5edef..64820a7 100644
@@ -527,39 +527,40 @@ python () {
                     bb.note("INCLUDING " + pn + " as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted for HOSTTOOLS")
 
     srcuri = d.getVar('SRC_URI', True)
-    # Svn packages should DEPEND on subversion-native
-    if "svn://" in srcuri:
-        d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot')
-
-    # Git packages should DEPEND on git-native
-    if "git://" in srcuri:
-        d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot')
-
-    # Mercurial packages should DEPEND on mercurial-native
-    elif "hg://" in srcuri:
-        d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot')
-
-    # OSC packages should DEPEND on osc-native
-    elif "osc://" in srcuri:
-        d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot')
-
-    # *.lz4 should depends on lz4-native for unpacking
-    # Not endswith because of "*.patch.lz4;patch=1". Need bb.fetch.decodeurl in future
-    if '.lz4' in srcuri:
-        d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot')
-
-    # *.xz should depends on xz-native for unpacking
-    # Not endswith because of "*.patch.xz;patch=1". Need bb.fetch.decodeurl in future
-    if '.xz' in srcuri:
-        d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
-
-    # unzip-native should already be staged before unpacking ZIP recipes
-    if ".zip" in srcuri:
-        d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot')
-
-    # file is needed by rpm2cpio.sh
-    if ".src.rpm" in srcuri:
-        d.appendVarFlag('do_unpack', 'depends', ' file-native:do_populate_sysroot')
+    for uri in srcuri.split():
+        (scheme, _ , path) = bb.fetch.decodeurl(uri)[:3]
+
+        # Svn packages should DEPEND on subversion-native
+        if scheme == "svn":
+            d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot')
+
+        # Git packages should DEPEND on git-native
+        elif scheme == "git":
+            d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot')
+
+        # Mercurial packages should DEPEND on mercurial-native
+        elif scheme == "hg":
+            d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot')
+
+        # OSC packages should DEPEND on osc-native
+        elif scheme == "osc":
+            d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot')
+
+        # *.lz4 should DEPEND on lz4-native for unpacking
+        if path.endswith('.lz4'):
+            d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot')
+
+        # *.xz should DEPEND on xz-native for unpacking
+        elif path.endswith('.xz'):
+            d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
+
+        # .zip should DEPEND on unzip-native for unpacking
+        elif path.endswith('.zip'):
+            d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot')
+
+        # file is needed by rpm2cpio.sh
+        elif path.endswith('.src.rpm'):
+            d.appendVarFlag('do_unpack', 'depends', ' file-native:do_populate_sysroot')
 
     set_packagetriplet(d)
 
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/4 base: add automatic dependency on lzip-native for .lz SRC_URI

Now that the SRC_URI is parsed this can be done without false-positives.

---
 meta/classes/base.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes/base.bbclass +4 -0
index 64820a7..e6d1599 100644
@@ -550,6 +550,10 @@ python () {
         if path.endswith('.lz4'):
             d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot')
 
+        # *.lz should DEPEND on lzip-native for unpacking
+        elif path.endswith('.lz'):
+            d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot')
+
         # *.xz should DEPEND on xz-native for unpacking
         elif path.endswith('.xz'):
             d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
Signature · 1 line
2.1.4
#2 lore raw

PATCH 3/4 oeqa/qemurunner: pass nographic to runqemu if DISPLAY isn't set

In reply to Ross Burton

Not everyone wants to run the tests with a qemu that has a graphical output, so allow display to be None and pass nographic to runqemu in that case.

---
 meta/lib/oeqa/utils/qemurunner.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/lib/oeqa/utils/qemurunner.py +6 -6
index e1c8ea1..def8ace 100644
@@ -94,9 +94,9 @@ class QemuRunner:
     def start(self, qemuparams = None):
         if self.display:
             os.environ["DISPLAY"] = self.display
-        else:
-            logger.error("To start qemu I need a X desktop, please set DISPLAY correctly (e.g. DISPLAY=:1)")
-            return False
+            # Set this flag so that Qemu doesn't do any grabs as SDL grabs
+            # interact badly with screensavers.
+            os.environ["QEMU_DONT_GRAB"] = "1"
         if not os.path.exists(self.rootfs):
             logger.error("Invalid rootfs %s" % self.rootfs)
             return False
@@ -118,10 +118,10 @@ class QemuRunner:
             logger.error("Failed to create listening socket: %s" % msg[1])
             return False
 
-        # Set this flag so that Qemu doesn't do any grabs as SDL grabs interact
-        # badly with screensavers.
-        os.environ["QEMU_DONT_GRAB"] = "1"
+
         self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8 printk.time=1" qemuparams="-serial tcp:127.0.0.1:{}"'.format(threadport)
+        if not self.display:
+            self.qemuparams = 'nographic ' + self.qemuparams
         if qemuparams:
             self.qemuparams = self.qemuparams[:-1] + " " + qemuparams + " " + '\"'
 
Signature · 1 line
2.1.4
#3 lore raw

PATCH 4/4 sanity: don't enforce DISPLAY for testimage

In reply to Ross Burton

Now that qemurunner doesn't need DISPLAY set, let whether DISPLAY is set be up to the user.

---
 meta/classes/sanity.bbclass | 8 --------
 1 file changed, 8 deletions(-)
meta/classes/sanity.bbclass +0 -8
index ae86d26..ad9dda8 100644
@@ -749,14 +749,6 @@ def check_sanity_everybuild(status, d):
 
     check_supported_distro(d)
 
-    # Check if DISPLAY is set if TEST_IMAGE is set
-    if d.getVar('TEST_IMAGE', True) == '1' or d.getVar('DEFAULT_TEST_SUITES', True):
-        testtarget = d.getVar('TEST_TARGET', True)
-        if testtarget == 'qemu' or testtarget == 'QemuTarget':
-            display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True)
-            if not display:
-                status.addresult('testimage needs an X desktop to start qemu, please set DISPLAY correctly (e.g. DISPLAY=:1.0)\n')
-
     omask = os.umask(022)
     if omask & 0755:
         status.addresult("Please use a umask which allows a+rx and u+rwx\n")
Signature · 1 line
2.1.4