summaryrefslogtreecommitdiffstats
path: root/scripts/oe-pkgdata-util
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/oe-pkgdata-util')
-rwxr-xr-xscripts/oe-pkgdata-util60
1 files changed, 60 insertions, 0 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 2830f48c73..5a9f89b31b 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -338,6 +338,57 @@ def list_pkgs(args):
338 logger.error("No packages found") 338 logger.error("No packages found")
339 sys.exit(1) 339 sys.exit(1)
340 340
341def list_pkg_files(args):
342 import json
343
344 if args.recipe:
345 if args.pkg:
346 logger.error("list-pkg-files: If -p/--recipe is specified then a package name cannot be specified")
347 sys.exit(1)
348 recipepkglist = get_recipe_pkgs(args.pkgdata_dir, args.recipe, args.unpackaged)
349 if args.runtime:
350 pkglist = []
351 runtime_pkgs = lookup_pkglist(recipepkglist, args.pkgdata_dir, False)
352 for rtpkgs in runtime_pkgs.values():
353 pkglist.extend(rtpkgs)
354 else:
355 pkglist = recipepkglist
356 else:
357 if not args.pkg:
358 logger.error("list-pkg-files: If -p/--recipe is not specified then at least one package name must be specified")
359 sys.exit(1)
360 pkglist = args.pkg
361
362 for pkg in pkglist:
363 print("%s:" % pkg)
364 if args.runtime:
365 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg)
366 if not os.path.exists(pkgdatafile):
367 if args.recipe:
368 # This package was empty and thus never packaged, ignore
369 continue
370 logger.error("Unable to find any built runtime package named %s" % pkg)
371 sys.exit(1)
372 else:
373 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg)
374 if not os.path.exists(pkgdatafile):
375 logger.error("Unable to find any built recipe-space package named %s" % pkg)
376 sys.exit(1)
377
378 with open(pkgdatafile, 'r') as f:
379 found = False
380 for line in f:
381 if line.startswith('FILES_INFO:'):
382 found = True
383 val = line.split(':', 1)[1].strip()
384 dictval = json.loads(val)
385 for fullpth in sorted(dictval):
386 print("\t%s" % fullpth)
387 break
388 if not found:
389 logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile)
390 sys.exit(1)
391
341def find_path(args): 392def find_path(args):
342 import json 393 import json
343 394
@@ -382,6 +433,15 @@ def main():
382 parser_list_pkgs.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages', action='store_true') 433 parser_list_pkgs.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages', action='store_true')
383 parser_list_pkgs.set_defaults(func=list_pkgs) 434 parser_list_pkgs.set_defaults(func=list_pkgs)
384 435
436 parser_list_pkg_files = subparsers.add_parser('list-pkg-files',
437 help='List files within a package',
438 description='Lists files included in one or more packages')
439 parser_list_pkg_files.add_argument('pkg', nargs='*', help='Package name to report on (if -p/--recipe is not specified)')
440 parser_list_pkg_files.add_argument('-r', '--runtime', help='Specified package(s) are runtime package names instead of recipe-space package names', action='store_true')
441 parser_list_pkg_files.add_argument('-p', '--recipe', help='Report on all packages produced by the specified recipe')
442 parser_list_pkg_files.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages (only useful with -p/--recipe)', action='store_true')
443 parser_list_pkg_files.set_defaults(func=list_pkg_files)
444
385 parser_lookup_recipe = subparsers.add_parser('lookup-recipe', 445 parser_lookup_recipe = subparsers.add_parser('lookup-recipe',
386 help='Find recipe producing one or more packages', 446 help='Find recipe producing one or more packages',
387 description='Looks up the specified runtime package(s) to see which recipe they were produced by') 447 description='Looks up the specified runtime package(s) to see which recipe they were produced by')