]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
devtool: update-recipe: check output before treating it as a string
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 10 Nov 2016 01:45:14 +0000 (14:45 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 23 Nov 2016 11:02:26 +0000 (11:02 +0000)
As of the move to Python 3 and the fixes we applied at that time,
bb.process.run() will return a byte array of length 0 rather than an
empty string if the output is empty. That may be a bug that we should
fix, but for now it's easiest to just check the result here before
treating it as a string. This fixes running "devtool update-recipe" or
"devtool finish" on a recipe which has no source tree, for example
initramfs-framework.

Fixes [YOCTO #10563].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/devtool/standard.py

index 4523048b3856040cd78e7ed30b2f84369d4fa1e3..1511641099dce351fd1a7c2fdca45bc1be18e24a 100644 (file)
@@ -332,10 +332,11 @@ def _git_ls_tree(repodir, treeish='HEAD', recursive=False):
         cmd.append('-r')
     out, _ = bb.process.run(cmd, cwd=repodir)
     ret = {}
-    for line in out.split('\0'):
-        if line:
-            split = line.split(None, 4)
-            ret[split[3]] = split[0:3]
+    if out:
+        for line in out.split('\0'):
+            if line:
+                split = line.split(None, 4)
+                ret[split[3]] = split[0:3]
     return ret
 
 def _git_exclude_path(srctree, path):