]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cache: Handle spaces and colons in directory names for file-checksums
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 16 Sep 2015 20:44:20 +0000 (21:44 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 16 Sep 2015 21:02:09 +0000 (22:02 +0100)
If there is a space in a directory name containing a file in file-checksums
(e.g. from a file:// url), you currently get tracebacks from bitbake. This
improves the code to handle colons and spaces in the file-checksums names
since it possible to figure out the correct names.

[YOCTO #8267]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/cache.py

index ef4d660e85134815f78229da95096e48dfabfd5a..ab09b08b58ed565ea3d7568b1b77e639a0e38c89 100644 (file)
@@ -528,7 +528,20 @@ class Cache(object):
 
         if hasattr(info_array[0], 'file_checksums'):
             for _, fl in info_array[0].file_checksums.items():
-                for f in fl.split():
+                fl = fl.strip()
+                while fl:
+                    # A .split() would be simpler but means spaces or colons in filenames would break
+                    a = fl.find(":True")
+                    b = fl.find(":False")
+                    if ((a < 0) and b) or ((b > 0) and (b < a)):
+                       f = fl[:b+6]
+                       fl = fl[b+7:]
+                    elif ((b < 0) and a) or ((a > 0) and (a < b)):
+                       f = fl[:a+5]
+                       fl = fl[a+6:]
+                    else:
+                       break
+                    fl = fl.strip()
                     if "*" in f:
                         continue
                     f, exist = f.split(":")