[bitbake-devel] [PATCH] cache: Handle spaces and colons in directory names for file-checksums

Christopher Larson clarson at kergoth.com
Wed Sep 16 21:08:41 UTC 2015


On Wed, Sep 16, 2015 at 1:44 PM, Richard Purdie <
richard.purdie at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20150916/b78d0991/attachment-0002.html>


More information about the bitbake-devel mailing list