summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2012-09-30 00:01:45 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-10-02 11:40:53 +0100
commit9a283519b2c9c11823a13e69ec133d97ea029e87 (patch)
tree18b17e9183fcb4b1f1a27d7c46d8650b9b0926c3 /bitbake
parente7ba10c1de29277113ad47e9c3686823aa43e845 (diff)
downloadpoky-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.py62
1 files changed, 47 insertions, 15 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index d032ab299e..a537338326 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -147,26 +147,58 @@ def explode_dep_versions(s):
147 r = {} 147 r = {}
148 l = s.replace(",", "").split() 148 l = s.replace(",", "").split()
149 lastdep = None 149 lastdep = None
150 lastcmp = ""
150 lastver = "" 151 lastver = ""
152 incmp = False
151 inversion = False 153 inversion = False
152 for i in l: 154 for i in l:
153 if i[0] == '(': 155 if i[0] == '(':
156 incmp = True
157 i = i[1:].strip()
158 if not i:
159 continue
160
161 if incmp:
162 incmp = False
154 inversion = True 163 inversion = True
155 lastver = i[1:] or "" 164 # This list is based on behavior and supported comparisons from deb, opkg and rpm.
156 #j = [] 165 #
157 elif inversion and i.endswith(')'): 166 # Even though =<, <<, ==, !=, =>, and >> may not be supported,
158 inversion = False 167 # we list each possibly valid item.
159 lastver = lastver + " " + (i[:-1] or "") 168 # The build system is responsible for validation of what it supports.
160 if lastdep in r and r[lastdep] and r[lastdep] != lastver: 169 if i.startswith(('<=', '=<', '<<', '==', '!=', '>=', '=>', '>>')):
161 raise ValueError("Error, item %s appeared in dependency string '%s' multiple times with different values. explode_dep_versions cannot cope with this." % (lastdep, s)) 170 lastcmp = i[0:2]
162 r[lastdep] = lastver 171 i = i[2:]
163 elif not inversion: 172 elif i.startswith(('<', '>', '=')):
164 if not (i in r and r[i]): 173 lastcmp = i[0:1]
165 r[i] = None 174 i = i[1:]
166 lastdep = i 175 else:
167 lastver = "" 176 # This is an unsupported case!
168 elif inversion: 177 lastcmp = (i or "")
169 lastver = lastver + " " + i 178 i = ""
179 i.strip()
180 if not i:
181 continue
182
183 if inversion:
184 if i.endswith(')'):
185 i = i[:-1] or ""
186 inversion = False
187 if lastver and i:
188 lastver += " "
189 if i:
190 lastver += i
191 if lastdep in r and r[lastdep] and r[lastdep] != lastver:
192 raise ValueError("Error, item %s appeared in dependency string '%s' multiple times with different values. explode_dep_versions cannot cope with this." % (lastdep, s))
193 r[lastdep] = lastcmp + " " + lastver
194 continue
195
196 #if not inversion:
197 lastdep = i
198 lastver = ""
199 lastcmp = ""
200 if not (i in r and r[i]):
201 r[lastdep] = None
170 202
171 return r 203 return r
172 204