diff options
author | Richard Purdie <richard@openedhand.com> | 2008-09-03 14:47:31 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-09-03 14:47:31 +0000 |
commit | 5d24ea892f7c91771b0b703b14338baf8f3957fb (patch) | |
tree | fc11e630e7b6a004af2da2758192c25fd9a79675 | |
parent | 62094355a5b71f3273c0e0704f31f05eb01c43db (diff) | |
download | 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
-rw-r--r-- | bitbake/lib/bb/utils.py | 27 |
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): | |||
96 | #r[-1] += ' ' + ' '.join(j) | 96 | #r[-1] += ' ' + ' '.join(j) |
97 | return r | 97 | return r |
98 | 98 | ||
99 | def explode_dep_versions(s): | ||
100 | """ | ||
101 | Take an RDEPENDS style string of format: | ||
102 | "DEPEND1 (optional version) DEPEND2 (optional version) ..." | ||
103 | and return a dictonary of dependencies and versions. | ||
104 | """ | ||
105 | r = {} | ||
106 | l = s.split() | ||
107 | lastdep = None | ||
108 | lastver = "" | ||
109 | inversion = False | ||
110 | for i in l: | ||
111 | if i[0] == '(': | ||
112 | inversion = True | ||
113 | lastver = i[1:] or "" | ||
114 | #j = [] | ||
115 | elif inversion and i.endswith(')'): | ||
116 | inversion = False | ||
117 | lastver = lastver + " " + (i[:-1] or "") | ||
118 | r[lastdep] = lastver | ||
119 | elif not inversion: | ||
120 | r[i] = None | ||
121 | lastdep = i | ||
122 | lastver = "" | ||
123 | elif inversion: | ||
124 | lastver = lastver + " " + i | ||
99 | 125 | ||
126 | return r | ||
100 | 127 | ||
101 | def _print_trace(body, line): | 128 | def _print_trace(body, line): |
102 | """ | 129 | """ |