diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-10-01 22:03:43 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-10-02 11:40:54 +0100 |
| commit | c4d857debf35c9aa98b6db5605365a900dea7370 (patch) | |
| tree | c6f32a86589fcdcb50de27050e78f92660ffb344 | |
| parent | 9a283519b2c9c11823a13e69ec133d97ea029e87 (diff) | |
| download | poky-c4d857debf35c9aa98b6db5605365a900dea7370.tar.gz | |
bitbake: utils: Add explode_dep_versions2 to replace explode_dep_versions
The API for explode_dep_versions is flawed since there can only be one version
constraint against any given dependency. This adds a new function with an API
without this limitation. explode_dep_versions() is maintained with a warning
printed when its used in a situation where information is lost.
This should allow a simple transition to the new API to fix the lost dependency
information.
join_deps() is updated to deal with data in either format.
(Bitbake rev: babeeded21827d8d3e7c7b785a62332ee9d45d4f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/utils.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index a537338326..cef0fdd5b8 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
| @@ -138,7 +138,7 @@ def explode_deps(s): | |||
| 138 | #r[-1] += ' ' + ' '.join(j) | 138 | #r[-1] += ' ' + ' '.join(j) |
| 139 | return r | 139 | return r |
| 140 | 140 | ||
| 141 | def explode_dep_versions(s): | 141 | def explode_dep_versions2(s): |
| 142 | """ | 142 | """ |
| 143 | Take an RDEPENDS style string of format: | 143 | Take an RDEPENDS style string of format: |
| 144 | "DEPEND1 (optional version) DEPEND2 (optional version) ..." | 144 | "DEPEND1 (optional version) DEPEND2 (optional version) ..." |
| @@ -188,9 +188,9 @@ def explode_dep_versions(s): | |||
| 188 | lastver += " " | 188 | lastver += " " |
| 189 | if i: | 189 | if i: |
| 190 | lastver += i | 190 | lastver += i |
| 191 | if lastdep in r and r[lastdep] and r[lastdep] != lastver: | 191 | if lastdep not in r: |
| 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)) | 192 | r[lastdep] = [] |
| 193 | r[lastdep] = lastcmp + " " + lastver | 193 | r[lastdep].append(lastcmp + " " + lastver) |
| 194 | continue | 194 | continue |
| 195 | 195 | ||
| 196 | #if not inversion: | 196 | #if not inversion: |
| @@ -198,8 +198,19 @@ def explode_dep_versions(s): | |||
| 198 | lastver = "" | 198 | lastver = "" |
| 199 | lastcmp = "" | 199 | lastcmp = "" |
| 200 | if not (i in r and r[i]): | 200 | if not (i in r and r[i]): |
| 201 | r[lastdep] = None | 201 | r[lastdep] = [] |
| 202 | |||
| 203 | return r | ||
| 202 | 204 | ||
| 205 | def explode_dep_versions(s): | ||
| 206 | r = explode_dep_versions2(s) | ||
| 207 | for d in r: | ||
| 208 | if not r[d]: | ||
| 209 | r[d] = None | ||
| 210 | continue | ||
| 211 | if len(r[d]) > 1: | ||
| 212 | bb.warn("explode_dep_versions(): Item %s appeared in dependency string '%s' multiple times with different values. explode_dep_versions cannot cope with this." % (d, s)) | ||
| 213 | r[d] = r[d][0] | ||
| 203 | return r | 214 | return r |
| 204 | 215 | ||
| 205 | def join_deps(deps, commasep=True): | 216 | def join_deps(deps, commasep=True): |
| @@ -209,7 +220,11 @@ def join_deps(deps, commasep=True): | |||
| 209 | result = [] | 220 | result = [] |
| 210 | for dep in deps: | 221 | for dep in deps: |
| 211 | if deps[dep]: | 222 | if deps[dep]: |
| 212 | result.append(dep + " (" + deps[dep] + ")") | 223 | if isinstance(deps[dep], list): |
| 224 | for v in deps[dep]: | ||
| 225 | result.append(dep + " (" + v + ")") | ||
| 226 | else: | ||
| 227 | result.append(dep + " (" + deps[dep] + ")") | ||
| 213 | else: | 228 | else: |
| 214 | result.append(dep) | 229 | result.append(dep) |
| 215 | if commasep: | 230 | if commasep: |
