cache: Handle spaces and colons in directory names for file-checksums
PATCH 1/1 cache: Handle spaces and colons in directory names for file-checksums
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 <[email protected]>
bitbake/lib/bb/cache.py +14 -1
@@ -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(":")
Quoted 7 lines · Richard Purdie
bitbake/lib/bb/cache.py +3
-1- for f in fl.split(): + fl = fl.strip() + while fl: + # A .split() would be simpler but means spaces orcolons in filenames would break
bitbake/lib/bb/cache.py +1
-0+ a = fl.find(":True")
bitbake/lib/bb/cache.py class Cache(object): · line 544
Quoted 10 lines
bitbake/lib/bb/cache.py +10
-0+ 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()
Hmm, another option would be to re.split('(:(True|False))', fl). When the pattern you're splitting on is grouped, it's kept in the results, so you'd get a list of file, :True/False, next file, :True/False, ..
Signature · 5 lines
Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics