diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2012-09-30 00:01:45 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-10-02 11:40:53 +0100 |
commit | 9a283519b2c9c11823a13e69ec133d97ea029e87 (patch) | |
tree | 18b17e9183fcb4b1f1a27d7c46d8650b9b0926c3 /bitbake | |
parent | e7ba10c1de29277113ad47e9c3686823aa43e845 (diff) | |
download | ast2050-yocto-poky-9a283519b2c9c11823a13e69ec133d97ea029e87.zip ast2050-yocto-poky-9a283519b2c9c11823a13e69ec133d97ea029e87.tar.gz |
bitbake: utils.py: Allow explode_dep_versions comparisons to have arbitrary whitespace
Refactor the explode_dep_versions to be more lenient on whitespace values.
The required format is:
foo (= 1.10)
foo (=1.10)
foo ( = 1.10)
foo ( =1.10)
foo ( = 1.10 )
foo ( =1.10 )
(Bitbake rev: 39c1c12c58fadd854098cf14ebe92f4d307a36dd)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/utils.py | 62 |
1 files changed, 47 insertions, 15 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index d032ab2..a537338 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -147,26 +147,58 @@ def explode_dep_versions(s): r = {} l = s.replace(",", "").split() lastdep = None + lastcmp = "" lastver = "" + incmp = False inversion = False for i in l: if i[0] == '(': + incmp = True + i = i[1:].strip() + if not i: + continue + + if incmp: + incmp = False inversion = True - lastver = i[1:] or "" - #j = [] - elif inversion and i.endswith(')'): - inversion = False - lastver = lastver + " " + (i[:-1] or "") - if lastdep in r and r[lastdep] and r[lastdep] != lastver: - raise ValueError("Error, item %s appeared in dependency string '%s' multiple times with different values. explode_dep_versions cannot cope with this." % (lastdep, s)) - r[lastdep] = lastver - elif not inversion: - if not (i in r and r[i]): - r[i] = None - lastdep = i - lastver = "" - elif inversion: - lastver = lastver + " " + i + # This list is based on behavior and supported comparisons from deb, opkg and rpm. + # + # Even though =<, <<, ==, !=, =>, and >> may not be supported, + # we list each possibly valid item. + # The build system is responsible for validation of what it supports. + if i.startswith(('<=', '=<', '<<', '==', '!=', '>=', '=>', '>>')): + lastcmp = i[0:2] + i = i[2:] + elif i.startswith(('<', '>', '=')): + lastcmp = i[0:1] + i = i[1:] + else: + # This is an unsupported case! + lastcmp = (i or "") + i = "" + i.strip() + if not i: + continue + + if inversion: + if i.endswith(')'): + i = i[:-1] or "" + inversion = False + if lastver and i: + lastver += " " + if i: + lastver += i + if lastdep in r and r[lastdep] and r[lastdep] != lastver: + raise ValueError("Error, item %s appeared in dependency string '%s' multiple times with different values. explode_dep_versions cannot cope with this." % (lastdep, s)) + r[lastdep] = lastcmp + " " + lastver + continue + + #if not inversion: + lastdep = i + lastver = "" + lastcmp = "" + if not (i in r and r[i]): + r[lastdep] = None return r |