diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-04-04 17:02:19 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-05 14:33:57 +0100 |
commit | 4d364f27e76cba86155c29719710215249a231f0 (patch) | |
tree | 6d135af5d00095a5688f879411e0c8fc6e8af2c4 /scripts | |
parent | af5f423887d1c41cf7279f6e537077726ae13082 (diff) | |
download | poky-4d364f27e76cba86155c29719710215249a231f0.tar.gz |
classes/buildhistory: optimise getting package size list
Invoking oe-pkgdata-util in turn for every package in the list was slow
with a large image. Modify oe-pkgdata-util's read-value command to take
an option to read the list of packages from a file, as well as prefix
the value with the package name; we can then use this to get all of the
package sizes at once. This reduces the time to gather this information
from minutes to just a second or two.
Fixes [YOCTO #7339].
(From OE-Core rev: 51c24904cc1bc823bccc3f179b8d7a192dace168)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/oe-pkgdata-util | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index 8e22e020e7..a04e44d35a 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util | |||
@@ -161,8 +161,18 @@ def glob(args): | |||
161 | def read_value(args): | 161 | def read_value(args): |
162 | # Handle both multiple arguments and multiple values within an arg (old syntax) | 162 | # Handle both multiple arguments and multiple values within an arg (old syntax) |
163 | packages = [] | 163 | packages = [] |
164 | for pkgitem in args.pkg: | 164 | if args.file: |
165 | packages.extend(pkgitem.split()) | 165 | with open(args.file, 'r') as f: |
166 | for line in f: | ||
167 | splitline = line.split() | ||
168 | if splitline: | ||
169 | packages.append(splitline[0]) | ||
170 | else: | ||
171 | for pkgitem in args.pkg: | ||
172 | packages.extend(pkgitem.split()) | ||
173 | if not packages: | ||
174 | logger.error("No packages specified") | ||
175 | sys.exit(1) | ||
166 | 176 | ||
167 | def readvar(pkgdata_file, valuename): | 177 | def readvar(pkgdata_file, valuename): |
168 | val = "" | 178 | val = "" |
@@ -187,9 +197,13 @@ def read_value(args): | |||
187 | qvar = "%s_%s" % (args.valuename, mappedpkg) | 197 | qvar = "%s_%s" % (args.valuename, mappedpkg) |
188 | # PKGSIZE is now in bytes, but we we want it in KB | 198 | # PKGSIZE is now in bytes, but we we want it in KB |
189 | pkgsize = (int(readvar(revlink, qvar)) + 1024 // 2) // 1024 | 199 | pkgsize = (int(readvar(revlink, qvar)) + 1024 // 2) // 1024 |
190 | print("%d" % pkgsize) | 200 | value = "%d" % pkgsize |
201 | else: | ||
202 | value = readvar(revlink, qvar) | ||
203 | if args.prefix_name: | ||
204 | print('%s %s' % (pkg_name, value)) | ||
191 | else: | 205 | else: |
192 | print(readvar(revlink, qvar)) | 206 | print(value) |
193 | 207 | ||
194 | def lookup_pkglist(pkgs, pkgdata_dir, reverse): | 208 | def lookup_pkglist(pkgs, pkgdata_dir, reverse): |
195 | if reverse: | 209 | if reverse: |
@@ -465,7 +479,9 @@ def main(): | |||
465 | help='Read any pkgdata value for one or more packages', | 479 | help='Read any pkgdata value for one or more packages', |
466 | description='Reads the named value from the pkgdata files for the specified packages') | 480 | description='Reads the named value from the pkgdata files for the specified packages') |
467 | parser_read_value.add_argument('valuename', help='Name of the value to look up') | 481 | parser_read_value.add_argument('valuename', help='Name of the value to look up') |
468 | parser_read_value.add_argument('pkg', nargs='+', help='Runtime package name to look up') | 482 | parser_read_value.add_argument('pkg', nargs='*', help='Runtime package name to look up') |
483 | parser_read_value.add_argument('-f', '--file', help='Read package names from the specified file (one per line, first field only)') | ||
484 | parser_read_value.add_argument('-n', '--prefix-name', help='Prefix output with package name', action='store_true') | ||
469 | parser_read_value.set_defaults(func=read_value) | 485 | parser_read_value.set_defaults(func=read_value) |
470 | 486 | ||
471 | parser_glob = subparsers.add_parser('glob', | 487 | parser_glob = subparsers.add_parser('glob', |