* [PATCH] cache: Handle spaces and colons in directory names for file-checksums
@ 2015-09-16 20:44 Richard Purdie
2015-09-16 21:08 ` Christopher Larson
0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2015-09-16 20:44 UTC (permalink / raw)
To: bitbake-devel
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>
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index ef4d660..ab09b08 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -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(":")
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cache: Handle spaces and colons in directory names for file-checksums
2015-09-16 20:44 [PATCH] cache: Handle spaces and colons in directory names for file-checksums Richard Purdie
@ 2015-09-16 21:08 ` Christopher Larson
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Larson @ 2015-09-16 21:08 UTC (permalink / raw)
To: Richard Purdie; +Cc: bitbake-devel
[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]
On Wed, Sep 16, 2015 at 1:44 PM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:
> - 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()
>
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, ..
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 1851 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-16 21:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 20:44 [PATCH] cache: Handle spaces and colons in directory names for file-checksums Richard Purdie
2015-09-16 21:08 ` Christopher Larson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.