summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
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
parent62094355a5b71f3273c0e0704f31f05eb01c43db (diff)
downloadopenembedded-core-5d24ea892f7c91771b0b703b14338baf8f3957fb.tar.gz
openembedded-core-5d24ea892f7c91771b0b703b14338baf8f3957fb.tar.bz2
openembedded-core-5d24ea892f7c91771b0b703b14338baf8f3957fb.tar.xz
openembedded-core-5d24ea892f7c91771b0b703b14338baf8f3957fb.zip
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')
-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 ec46021b5..211ac8129 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):
"""