diff options
author | Ross Burton <ross.burton@intel.com> | 2018-02-05 11:45:28 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-02-16 18:05:38 +0000 |
commit | 45f2a2f1558bfdf80bc4d66be729c043cbdd6002 (patch) | |
tree | c49c87e1280ec505c7e4e148748ed02407a19487 /scripts | |
parent | 4cf6cf65a46aa0030d024e2b8319487d3f880ea1 (diff) | |
download | poky-45f2a2f1558bfdf80bc4d66be729c043cbdd6002.tar.gz |
oe-pkgdata-util: add --long option to list-pkg-files to show sizes
(From OE-Core rev: 1f3a5acb825a9f707c1ab780131e009f9ce21451)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/oe-pkgdata-util | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index 78b3d7bcb8..aea8a57516 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util | |||
@@ -435,7 +435,7 @@ def list_pkgs(args): | |||
435 | 435 | ||
436 | def list_pkg_files(args): | 436 | def list_pkg_files(args): |
437 | import json | 437 | import json |
438 | def parse_pkgdatafile(pkgdatafile): | 438 | def parse_pkgdatafile(pkgdatafile, long=False): |
439 | with open(pkgdatafile, 'r') as f: | 439 | with open(pkgdatafile, 'r') as f: |
440 | found = False | 440 | found = False |
441 | for line in f: | 441 | for line in f: |
@@ -443,8 +443,13 @@ def list_pkg_files(args): | |||
443 | found = True | 443 | found = True |
444 | val = line.split(':', 1)[1].strip() | 444 | val = line.split(':', 1)[1].strip() |
445 | dictval = json.loads(val) | 445 | dictval = json.loads(val) |
446 | for fullpth in sorted(dictval): | 446 | if long: |
447 | print("\t%s" % fullpth) | 447 | width = max(map(len, dictval), default=0) |
448 | for fullpth in sorted(dictval): | ||
449 | print("\t{:{width}}\t{}".format(fullpth, dictval[fullpth], width=width)) | ||
450 | else: | ||
451 | for fullpth in sorted(dictval): | ||
452 | print("\t%s" % fullpth) | ||
448 | break | 453 | break |
449 | if not found: | 454 | if not found: |
450 | logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile) | 455 | logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile) |
@@ -479,7 +484,7 @@ def list_pkg_files(args): | |||
479 | continue | 484 | continue |
480 | logger.error("Unable to find any built runtime package named %s" % pkg) | 485 | logger.error("Unable to find any built runtime package named %s" % pkg) |
481 | sys.exit(1) | 486 | sys.exit(1) |
482 | parse_pkgdatafile(pkgdatafile) | 487 | parse_pkgdatafile(pkgdatafile, args.long) |
483 | 488 | ||
484 | else: | 489 | else: |
485 | providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg) | 490 | providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg) |
@@ -488,13 +493,13 @@ def list_pkg_files(args): | |||
488 | if f != pkg: | 493 | if f != pkg: |
489 | print("%s is in the RPROVIDES of %s:" % (pkg, f)) | 494 | print("%s is in the RPROVIDES of %s:" % (pkg, f)) |
490 | pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f) | 495 | pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f) |
491 | parse_pkgdatafile(pkgdatafile) | 496 | parse_pkgdatafile(pkgdatafile, args.long) |
492 | continue | 497 | continue |
493 | pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg) | 498 | pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg) |
494 | if not os.path.exists(pkgdatafile): | 499 | if not os.path.exists(pkgdatafile): |
495 | logger.error("Unable to find any built recipe-space package named %s" % pkg) | 500 | logger.error("Unable to find any built recipe-space package named %s" % pkg) |
496 | sys.exit(1) | 501 | sys.exit(1) |
497 | parse_pkgdatafile(pkgdatafile) | 502 | parse_pkgdatafile(pkgdatafile, args.long) |
498 | 503 | ||
499 | def find_path(args): | 504 | def find_path(args): |
500 | import json | 505 | import json |
@@ -548,6 +553,7 @@ def main(): | |||
548 | 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') | 553 | 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') |
549 | parser_list_pkg_files.add_argument('-p', '--recipe', help='Report on all packages produced by the specified recipe') | 554 | parser_list_pkg_files.add_argument('-p', '--recipe', help='Report on all packages produced by the specified recipe') |
550 | parser_list_pkg_files.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages (only useful with -p/--recipe)', action='store_true') | 555 | parser_list_pkg_files.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages (only useful with -p/--recipe)', action='store_true') |
556 | parser_list_pkg_files.add_argument('-l', '--long', help='Show more information per file', action='store_true') | ||
551 | parser_list_pkg_files.set_defaults(func=list_pkg_files) | 557 | parser_list_pkg_files.set_defaults(func=list_pkg_files) |
552 | 558 | ||
553 | parser_lookup_recipe = subparsers.add_parser('lookup-recipe', | 559 | parser_lookup_recipe = subparsers.add_parser('lookup-recipe', |