Add a "list-packages" command to list all produced packages by a particular recipe.
[YOCTO #5264] Signed-off-by: Hongxu Jia <hongxu....@windriver.com> --- scripts/oe-pkgdata-util | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index e43f773..984f66e 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util @@ -28,6 +28,7 @@ import re import optparse from collections import defaultdict import codecs +import errno def glob(args, usage, debug=False): if len(args) < 3: @@ -308,6 +309,46 @@ def collect_rprovides(pkgdata_dir): return rprovides_dict +def list_packages(args, usage, debug=False): + if len(args) < 2: + usage() + sys.exit(1) + + pkgdata_dir = args[0] + if not os.path.exists(pkgdata_dir): + print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) + sys.exit(1) + + if len(args[1].split()) != 1: + print('ERROR: Only one recipe name is acceptable') + sys.exit(1) + + recipe = args[1] + packages = "" + try: + with open(os.path.join(pkgdata_dir, recipe)) as f: + for line in f.readlines(): + if line.startswith('PACKAGES: '): + packages = line.split(': ', 1)[1].split() + break + except IOError as e: + if e.errno == errno.ENOENT: + print('ERROR: The recipe %s does not exist' % recipe) + sys.exit(1) + else: + raise + + # Filter out packages that not generated + for pkg in packages[:]: + flag_packaged = "%s/runtime/%s.packaged" % (pkgdata_dir, pkg) + if not os.access(flag_packaged, os.R_OK): + if debug: + print("%s not produced by %s" % (pkg, recipe)) + packages.remove(pkg) + + print '\n'.join(packages) + + def find_path(args, usage, debug=False): if len(args) < 2: usage() @@ -354,7 +395,9 @@ Available commands: find the package providing the specified path (wildcards * ? allowed) read-value <pkgdatadir> <value-name> "<pkgs>" read the named value from the pkgdata files for the specified - packages''') + packages + list-packages <pkgdatadir> "<recipe>" + list all packages produced by the particular recipe''') parser.add_option("-d", "--debug", help = "Enable debug output", @@ -377,6 +420,8 @@ Available commands: find_path(args[1:], parser.print_help, options.debug) elif args[0] == "read-value": read_value(args[1:], parser.print_help, options.debug) + elif args[0] == "list-packages": + list_packages(args[1:], parser.print_help, options.debug) else: parser.print_help() sys.exit(1) -- 1.9.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core