diff options
-rwxr-xr-x | scripts/oe-pkgdata-util | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index 2d896d03a9..08773e9b05 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util | |||
@@ -26,6 +26,7 @@ import os.path | |||
26 | import fnmatch | 26 | import fnmatch |
27 | import re | 27 | import re |
28 | import optparse | 28 | import optparse |
29 | from collections import defaultdict | ||
29 | 30 | ||
30 | 31 | ||
31 | def glob(args, usage): | 32 | def glob(args, usage): |
@@ -186,6 +187,38 @@ def read_value(args, usage): | |||
186 | qvar = "%s_%s" % (var, mappedpkg) | 187 | qvar = "%s_%s" % (var, mappedpkg) |
187 | print(readvar(revlink, qvar)) | 188 | print(readvar(revlink, qvar)) |
188 | 189 | ||
190 | def lookup_pkg(args, usage): | ||
191 | if len(args) < 2: | ||
192 | usage() | ||
193 | sys.exit(1) | ||
194 | |||
195 | pkgdata_dir = args[0] | ||
196 | pkgs = args[1].split() | ||
197 | |||
198 | if not os.path.exists(pkgdata_dir): | ||
199 | print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) | ||
200 | sys.exit(1) | ||
201 | |||
202 | mappings = defaultdict(list) | ||
203 | for pkg in pkgs: | ||
204 | pkgfile = os.path.join(pkgdata_dir, 'runtime', pkg) | ||
205 | if os.path.exists(pkgfile): | ||
206 | with open(pkgfile, 'r') as f: | ||
207 | for line in f: | ||
208 | fields = line.rstrip().split(': ') | ||
209 | if fields[0] == 'PKG_%s' % pkg: | ||
210 | mappings[pkg].append(fields[1]) | ||
211 | break | ||
212 | if len(mappings) < len(pkgs): | ||
213 | missing = list(set(pkgs) - set(mappings.keys())) | ||
214 | sys.stderr.write("ERROR: the following packages could not be found: %s\n" % ', '.join(missing)) | ||
215 | sys.exit(1) | ||
216 | |||
217 | items = [] | ||
218 | for pkg in pkgs: | ||
219 | items.extend(mappings.get(pkg, [])) | ||
220 | print '\n'.join(items) | ||
221 | |||
189 | def find_path(args, usage): | 222 | def find_path(args, usage): |
190 | if len(args) < 2: | 223 | if len(args) < 2: |
191 | usage() | 224 | usage() |
@@ -227,6 +260,9 @@ Available commands: | |||
227 | glob <pkgdatadir> <pkglistfile> "<globs>" | 260 | glob <pkgdatadir> <pkglistfile> "<globs>" |
228 | expand one or more glob expressions over the packages listed in | 261 | expand one or more glob expressions over the packages listed in |
229 | pkglistfile (one package per line) | 262 | pkglistfile (one package per line) |
263 | lookup-pkg <pkgdatadir> "<recipe-pkgs>" | ||
264 | look up the specified recipe-space package name(s) to see what the | ||
265 | final runtime package name is (e.g. eglibc becomes libc6) | ||
230 | find-path <pkgdatadir> <path> | 266 | find-path <pkgdatadir> <path> |
231 | find the package providing the specified path (wildcards * ? allowed) | 267 | find the package providing the specified path (wildcards * ? allowed) |
232 | read-value <pkgdatadir> <value-name> "<pkgs>" | 268 | read-value <pkgdatadir> <value-name> "<pkgs>" |
@@ -246,6 +282,8 @@ Available commands: | |||
246 | 282 | ||
247 | if args[0] == "glob": | 283 | if args[0] == "glob": |
248 | glob(args[1:], parser.print_help) | 284 | glob(args[1:], parser.print_help) |
285 | elif args[0] == "lookup-pkg": | ||
286 | lookup_pkg(args[1:], parser.print_help) | ||
249 | elif args[0] == "find-path": | 287 | elif args[0] == "find-path": |
250 | find_path(args[1:], parser.print_help) | 288 | find_path(args[1:], parser.print_help) |
251 | elif args[0] == "read-value": | 289 | elif args[0] == "read-value": |