mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 01:40:07 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
4cf6cf65a4
commit
45f2a2f155
+12
-6
@@ -435,7 +435,7 @@ def list_pkgs(args):
|
|||||||
|
|
||||||
def list_pkg_files(args):
|
def list_pkg_files(args):
|
||||||
import json
|
import json
|
||||||
def parse_pkgdatafile(pkgdatafile):
|
def parse_pkgdatafile(pkgdatafile, long=False):
|
||||||
with open(pkgdatafile, 'r') as f:
|
with open(pkgdatafile, 'r') as f:
|
||||||
found = False
|
found = False
|
||||||
for line in f:
|
for line in f:
|
||||||
@@ -443,8 +443,13 @@ def list_pkg_files(args):
|
|||||||
found = True
|
found = True
|
||||||
val = line.split(':', 1)[1].strip()
|
val = line.split(':', 1)[1].strip()
|
||||||
dictval = json.loads(val)
|
dictval = json.loads(val)
|
||||||
for fullpth in sorted(dictval):
|
if long:
|
||||||
print("\t%s" % fullpth)
|
width = max(map(len, dictval), default=0)
|
||||||
|
for fullpth in sorted(dictval):
|
||||||
|
print("\t{:{width}}\t{}".format(fullpth, dictval[fullpth], width=width))
|
||||||
|
else:
|
||||||
|
for fullpth in sorted(dictval):
|
||||||
|
print("\t%s" % fullpth)
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile)
|
logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile)
|
||||||
@@ -479,7 +484,7 @@ def list_pkg_files(args):
|
|||||||
continue
|
continue
|
||||||
logger.error("Unable to find any built runtime package named %s" % pkg)
|
logger.error("Unable to find any built runtime package named %s" % pkg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
parse_pkgdatafile(pkgdatafile)
|
parse_pkgdatafile(pkgdatafile, args.long)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
|
providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
|
||||||
@@ -488,13 +493,13 @@ def list_pkg_files(args):
|
|||||||
if f != pkg:
|
if f != pkg:
|
||||||
print("%s is in the RPROVIDES of %s:" % (pkg, f))
|
print("%s is in the RPROVIDES of %s:" % (pkg, f))
|
||||||
pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
|
pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
|
||||||
parse_pkgdatafile(pkgdatafile)
|
parse_pkgdatafile(pkgdatafile, args.long)
|
||||||
continue
|
continue
|
||||||
pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg)
|
pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg)
|
||||||
if not os.path.exists(pkgdatafile):
|
if not os.path.exists(pkgdatafile):
|
||||||
logger.error("Unable to find any built recipe-space package named %s" % pkg)
|
logger.error("Unable to find any built recipe-space package named %s" % pkg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
parse_pkgdatafile(pkgdatafile)
|
parse_pkgdatafile(pkgdatafile, args.long)
|
||||||
|
|
||||||
def find_path(args):
|
def find_path(args):
|
||||||
import json
|
import json
|
||||||
@@ -548,6 +553,7 @@ def main():
|
|||||||
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')
|
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')
|
||||||
parser_list_pkg_files.add_argument('-p', '--recipe', help='Report on all packages produced by the specified recipe')
|
parser_list_pkg_files.add_argument('-p', '--recipe', help='Report on all packages produced by the specified recipe')
|
||||||
parser_list_pkg_files.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages (only useful with -p/--recipe)', action='store_true')
|
parser_list_pkg_files.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages (only useful with -p/--recipe)', action='store_true')
|
||||||
|
parser_list_pkg_files.add_argument('-l', '--long', help='Show more information per file', action='store_true')
|
||||||
parser_list_pkg_files.set_defaults(func=list_pkg_files)
|
parser_list_pkg_files.set_defaults(func=list_pkg_files)
|
||||||
|
|
||||||
parser_lookup_recipe = subparsers.add_parser('lookup-recipe',
|
parser_lookup_recipe = subparsers.add_parser('lookup-recipe',
|
||||||
|
|||||||
Reference in New Issue
Block a user