]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: upgrade: handle recipes where source is not first entry in SRC_URI
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 14 Apr 2016 08:24:19 +0000 (20:24 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 15 Apr 2016 05:57:47 +0000 (06:57 +0100)
It is unusual but not impossible to find recipes whose first entry is
not the main source URL but instead some patch or other local file, for
example python-cryptography in meta-python (which sets SRC_URI before
inheriting pypi). There's nothing inherently wrong with this, and we
shouldn't assume that the first entry is the main source URL, so just
take the first non-local entry instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/upgrade.py

index 680cbf132d0c62900a321b8660a1de0622d501bf..a085f78c439022f147cd9b433439bd0dbdd2a80b 100644 (file)
@@ -145,7 +145,15 @@ def _get_uri(rd):
     srcuris = rd.getVar('SRC_URI', True).split()
     if not len(srcuris):
         raise DevtoolError('SRC_URI not found on recipe')
-    srcuri = srcuris[0] # it is assumed, URI is at first position
+    # Get first non-local entry in SRC_URI - usually by convention it's
+    # the first entry, but not always!
+    srcuri = None
+    for entry in srcuris:
+        if not entry.startswith('file://'):
+            srcuri = entry
+            break
+    if not srcuri:
+        raise DevtoolError('Unable to find non-local entry in SRC_URI')
     srcrev = '${AUTOREV}'
     if '://' in srcuri:
         # Fetch a URL