mirror of
https://git.yoctoproject.org/poky
synced 2026-09-24 22:36:21 +02:00
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>
This commit is contained in:
@@ -138,7 +138,7 @@ def explode_deps(s):
|
|||||||
#r[-1] += ' ' + ' '.join(j)
|
#r[-1] += ' ' + ' '.join(j)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def explode_dep_versions(s):
|
def explode_dep_versions2(s):
|
||||||
"""
|
"""
|
||||||
Take an RDEPENDS style string of format:
|
Take an RDEPENDS style string of format:
|
||||||
"DEPEND1 (optional version) DEPEND2 (optional version) ..."
|
"DEPEND1 (optional version) DEPEND2 (optional version) ..."
|
||||||
@@ -188,9 +188,9 @@ def explode_dep_versions(s):
|
|||||||
lastver += " "
|
lastver += " "
|
||||||
if i:
|
if i:
|
||||||
lastver += i
|
lastver += i
|
||||||
if lastdep in r and r[lastdep] and r[lastdep] != lastver:
|
if lastdep not in r:
|
||||||
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] = []
|
||||||
r[lastdep] = lastcmp + " " + lastver
|
r[lastdep].append(lastcmp + " " + lastver)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#if not inversion:
|
#if not inversion:
|
||||||
@@ -198,10 +198,21 @@ def explode_dep_versions(s):
|
|||||||
lastver = ""
|
lastver = ""
|
||||||
lastcmp = ""
|
lastcmp = ""
|
||||||
if not (i in r and r[i]):
|
if not (i in r and r[i]):
|
||||||
r[lastdep] = None
|
r[lastdep] = []
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
def explode_dep_versions(s):
|
||||||
|
r = explode_dep_versions2(s)
|
||||||
|
for d in r:
|
||||||
|
if not r[d]:
|
||||||
|
r[d] = None
|
||||||
|
continue
|
||||||
|
if len(r[d]) > 1:
|
||||||
|
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))
|
||||||
|
r[d] = r[d][0]
|
||||||
|
return r
|
||||||
|
|
||||||
def join_deps(deps, commasep=True):
|
def join_deps(deps, commasep=True):
|
||||||
"""
|
"""
|
||||||
Take the result from explode_dep_versions and generate a dependency string
|
Take the result from explode_dep_versions and generate a dependency string
|
||||||
@@ -209,6 +220,10 @@ def join_deps(deps, commasep=True):
|
|||||||
result = []
|
result = []
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
if deps[dep]:
|
if deps[dep]:
|
||||||
|
if isinstance(deps[dep], list):
|
||||||
|
for v in deps[dep]:
|
||||||
|
result.append(dep + " (" + v + ")")
|
||||||
|
else:
|
||||||
result.append(dep + " (" + deps[dep] + ")")
|
result.append(dep + " (" + deps[dep] + ")")
|
||||||
else:
|
else:
|
||||||
result.append(dep)
|
result.append(dep)
|
||||||
|
|||||||
Reference in New Issue
Block a user