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 <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
526264e7d7
commit
86a5fcd2c6
|
@ -160,6 +160,50 @@ Options:
|
||||||
self.do_help('')
|
self.do_help('')
|
||||||
return
|
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
|
pkg_pn = self.cooker.status.pkg_pn
|
||||||
(latest_versions, preferred_versions) = bb.providers.findProviders(self.cooker.configuration.data, 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)
|
allproviders = bb.providers.allProviders(self.cooker.status)
|
||||||
|
@ -200,7 +244,11 @@ Options:
|
||||||
preffiles = []
|
preffiles = []
|
||||||
items_listed = False
|
items_listed = False
|
||||||
for p in sorted(pkg_pn):
|
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]
|
pref = preferred_versions[p]
|
||||||
preffile = bb.cache.Cache.virtualfn2realfn(pref[1])[0]
|
preffile = bb.cache.Cache.virtualfn2realfn(pref[1])[0]
|
||||||
if preffile not in preffiles:
|
if preffile not in preffiles:
|
||||||
|
@ -217,9 +265,9 @@ Options:
|
||||||
if prov[0] != pref[0]:
|
if prov[0] != pref[0]:
|
||||||
same_ver = False
|
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:
|
if not items_listed:
|
||||||
logger.plain('=== Overlayed recipes ===')
|
logger.plain('=== %s ===' % title)
|
||||||
items_listed = True
|
items_listed = True
|
||||||
print_item(preffile, p, self.version_str(pref[0][0], pref[0][1]), preflayer, True)
|
print_item(preffile, p, self.version_str(pref[0][0], pref[0][1]), preflayer, True)
|
||||||
for (provfile, provlayer, provver) in provs:
|
for (provfile, provlayer, provver) in provs:
|
||||||
|
@ -228,8 +276,7 @@ Options:
|
||||||
# Ensure we don't show two entries for BBCLASSEXTENDed recipes
|
# Ensure we don't show two entries for BBCLASSEXTENDed recipes
|
||||||
preffiles.append(preffile)
|
preffiles.append(preffile)
|
||||||
|
|
||||||
if not items_listed:
|
return items_listed
|
||||||
logger.note('No overlayed files found')
|
|
||||||
|
|
||||||
|
|
||||||
def do_flatten(self, args):
|
def do_flatten(self, args):
|
||||||
|
|
Loading…
Reference in New Issue