summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndres Beltran <abeltran@linux.microsoft.com>2021-08-12 16:58:56 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-27 11:53:23 +0100
commit1e18b514bf1f960d324a21db608c8e8e5af007ef (patch)
treec835276b6bd8d7019334cd536da89ed1ebce1d12 /scripts
parent143fc5504539c69752ca87717507c197a8920ce5 (diff)
downloadopenembedded-core-contrib-1e18b514bf1f960d324a21db608c8e8e5af007ef.tar.gz
buildhistory: Add output file listing package information
Currently, buildhistory does not produce a single file combining relevant information of installed packages. Produce an output file "installed-package-info.txt" listing a package's runtime name, buildtime name, its recipe, version, and size to avoid having to look up each package externally. Leave the existing package list files as-is for backwards compatibility. In order to support this efficiently, extend oe-pkgdata-util to accept multiple keys for its read-value argument. Signed-off-by: Andres Beltran <abeltran@linux.microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-pkgdata-util37
1 files changed, 23 insertions, 14 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index ffa3850b8b..71656dadce 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -171,7 +171,7 @@ def read_value(args):
val = line.split(': ', 1)[1].rstrip()
return val
- logger.debug("read-value('%s', '%s' '%s')" % (args.pkgdata_dir, args.valuename, packages))
+ logger.debug("read-value('%s', '%s' '%s')" % (args.pkgdata_dir, args.valuenames, packages))
for package in packages:
pkg_split = package.split('_')
pkg_name = pkg_split[0]
@@ -180,20 +180,29 @@ def read_value(args):
logger.debug(revlink)
if os.path.exists(revlink):
mappedpkg = os.path.basename(os.readlink(revlink))
- qvar = args.valuename
- value = readvar(revlink, qvar, mappedpkg)
- if qvar == "PKGSIZE":
- # PKGSIZE is now in bytes, but we we want it in KB
- pkgsize = (int(value) + 1024 // 2) // 1024
- value = "%d" % pkgsize
- if args.unescape:
- import codecs
- # escape_decode() unescapes backslash encodings in byte streams
- value = codecs.escape_decode(bytes(value, "utf-8"))[0].decode("utf-8")
+ qvars = args.valuenames
+ val_names = qvars.split(',')
+ values = []
+ for qvar in val_names:
+ if qvar == "PACKAGE":
+ value = mappedpkg
+ else:
+ value = readvar(revlink, qvar, mappedpkg)
+ if qvar == "PKGSIZE":
+ # PKGSIZE is now in bytes, but we we want it in KB
+ pkgsize = (int(value) + 1024 // 2) // 1024
+ value = "%d" % pkgsize
+ if args.unescape:
+ import codecs
+ # escape_decode() unescapes backslash encodings in byte streams
+ value = codecs.escape_decode(bytes(value, "utf-8"))[0].decode("utf-8")
+ values.append(value)
+
+ values_str = ' '.join(values)
if args.prefix_name:
- print('%s %s' % (pkg_name, value))
+ print('%s %s' % (pkg_name, values_str))
else:
- print(value)
+ print(values_str)
else:
logger.debug("revlink %s does not exist", revlink)
@@ -570,7 +579,7 @@ def main():
parser_read_value = subparsers.add_parser('read-value',
help='Read any pkgdata value for one or more packages',
description='Reads the named value from the pkgdata files for the specified packages')
- parser_read_value.add_argument('valuename', help='Name of the value to look up')
+ parser_read_value.add_argument('valuenames', help='Name of the value/s to look up (separated by commas, no spaces)')
parser_read_value.add_argument('pkg', nargs='*', help='Runtime package name to look up')
parser_read_value.add_argument('-f', '--file', help='Read package names from the specified file (one per line, first field only)')
parser_read_value.add_argument('-n', '--prefix-name', help='Prefix output with package name', action='store_true')