summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-09-03 14:47:31 +0000
committerRichard Purdie <richard@openedhand.com>2008-09-03 14:47:31 +0000
commit5d24ea892f7c91771b0b703b14338baf8f3957fb (patch)
treefc11e630e7b6a004af2da2758192c25fd9a79675 /bitbake/lib/bb/utils.py
parent62094355a5b71f3273c0e0704f31f05eb01c43db (diff)
downloadast2050-yocto-poky-5d24ea892f7c91771b0b703b14338baf8f3957fb.zip
ast2050-yocto-poky-5d24ea892f7c91771b0b703b14338baf8f3957fb.tar.gz
bitbake utils.py: Add explode_dep_versions, an improved version of explode_deps
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5128 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index ec46021..211ac81 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -96,7 +96,34 @@ def explode_deps(s):
#r[-1] += ' ' + ' '.join(j)
return r
+def explode_dep_versions(s):
+ """
+ Take an RDEPENDS style string of format:
+ "DEPEND1 (optional version) DEPEND2 (optional version) ..."
+ and return a dictonary of dependencies and versions.
+ """
+ r = {}
+ l = s.split()
+ lastdep = None
+ lastver = ""
+ inversion = False
+ for i in l:
+ if i[0] == '(':
+ inversion = True
+ lastver = i[1:] or ""
+ #j = []
+ elif inversion and i.endswith(')'):
+ inversion = False
+ lastver = lastver + " " + (i[:-1] or "")
+ r[lastdep] = lastver
+ elif not inversion:
+ r[i] = None
+ lastdep = i
+ lastver = ""
+ elif inversion:
+ lastver = lastver + " " + i
+ return r
def _print_trace(body, line):
"""
OpenPOWER on IntegriCloud