From 86a5fcd2c62585152fabc271b8e7893fe31399a9 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 30 Jan 2012 16:25:53 +0000 Subject: bitbake-layers: add show-recipes subcommand Add a show-recipes subcommand which lists all available recipes, with the layer they are provided by. You can optionally filter the output by recipe name (PN). (This is a generalised version of the show-overlayed subcommand.) (Bitbake rev: 05e86ba966f5a26721891c82b21afa48768a67cc) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- bitbake/bin/bitbake-layers | 57 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'bitbake/bin/bitbake-layers') diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers index 151f87fd52..bf5bf9b53d 100755 --- a/bitbake/bin/bitbake-layers +++ b/bitbake/bin/bitbake-layers @@ -160,6 +160,50 @@ Options: self.do_help('') return + items_listed = self.list_recipes('Overlayed recipes', None, True, show_same_ver_only, show_filenames, True) + + if not items_listed: + logger.note('No overlayed files found') + + + def do_show_recipes(self, args): + """list available recipes, showing the layer they are provided by + +usage: show-recipes [-f] [-m] [pnspec] + +Lists the names of overlayed recipes and the available versions in each +layer, with the preferred version first. Optionally you may specify +pnspec to match a specified recipe name (supports wildcards). Note that +skipped recipes will also be listed, with a " (skipped)" suffix. + +Options: + -f instead of the default formatting, list filenames of higher priority + recipes with other available recipes indented underneath + -m only list where multiple recipes (in the same layer or different + layers) exist for the same recipe name +""" + self.check_prepare_cooker() + + show_filenames = False + show_multi_provider_only = False + pnspec = None + title = 'Available recipes:' + for arg in args.split(): + if arg == '-f': + show_filenames = True + elif arg == '-m': + show_multi_provider_only = True + elif not arg.startswith('-'): + pnspec = arg + title = 'Available recipes matching %s:' % pnspec + else: + sys.stderr.write("show-recipes: invalid option %s\n" % arg) + self.do_help('') + return + self.list_recipes(title, pnspec, False, False, show_filenames, show_multi_provider_only) + + + def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_multi_provider_only): pkg_pn = self.cooker.status.pkg_pn (latest_versions, preferred_versions) = bb.providers.findProviders(self.cooker.configuration.data, self.cooker.status, pkg_pn) allproviders = bb.providers.allProviders(self.cooker.status) @@ -200,7 +244,11 @@ Options: preffiles = [] items_listed = False for p in sorted(pkg_pn): - if len(allproviders[p]) > 1: + if pnspec: + if not fnmatch.fnmatch(p, pnspec): + continue + + if len(allproviders[p]) > 1 or not show_multi_provider_only: pref = preferred_versions[p] preffile = bb.cache.Cache.virtualfn2realfn(pref[1])[0] if preffile not in preffiles: @@ -217,9 +265,9 @@ Options: if prov[0] != pref[0]: same_ver = False - if multilayer and (same_ver or not show_same_ver_only): + if (multilayer or not show_overlayed_only) and (same_ver or not show_same_ver_only): if not items_listed: - logger.plain('=== Overlayed recipes ===') + logger.plain('=== %s ===' % title) items_listed = True print_item(preffile, p, self.version_str(pref[0][0], pref[0][1]), preflayer, True) for (provfile, provlayer, provver) in provs: @@ -228,8 +276,7 @@ Options: # Ensure we don't show two entries for BBCLASSEXTENDed recipes preffiles.append(preffile) - if not items_listed: - logger.note('No overlayed files found') + return items_listed def do_flatten(self, args): -- cgit v1.2.3-54-g00ecf