summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
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 ec46021b55..211ac8129f 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):
"""