summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
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