bitbake: bitbake-layers: show-recipes: Select recipes from selected layer

Currently, show-recipes will show recipes from all configured layers.
Assume, meta-intel layer was added to conf/bblayers.conf.

Example of default $ bitbake-layers show-recipes:
core-image-rt:
  meta-intel           unknown (skipped)
  meta                 unknown (skipped)

Add -l/--layer to enable showing recipes from user selected layer.

Example: $ bitbake-layers show-recipes -l meta-intel
core-image-rt:
  meta-intel           unknown (skipped)

(Bitbake rev: 8c38d95c4474ea171cb55b0e336d9090451e89ce)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Yeoh Ee Peng
2019-09-19 18:11:09 +08:00
committed by Richard Purdie
parent 5808f455f0
commit 7f2803d1aa

View File

@@ -46,7 +46,7 @@ layer, with the preferred version first. Note that skipped recipes that
are overlayed will also be listed, with a " (skipped)" suffix.
"""
items_listed = self.list_recipes('Overlayed recipes', None, True, args.same_version, args.filenames, False, True, None)
items_listed = self.list_recipes('Overlayed recipes', None, True, args.same_version, args.filenames, False, True, None, None)
# Check for overlayed .bbclass files
classes = collections.defaultdict(list)
@@ -112,9 +112,9 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
title = 'Matching recipes:'
else:
title = 'Available recipes:'
self.list_recipes(title, args.pnspec, False, False, args.filenames, args.recipes_only, args.multiple, inheritlist)
self.list_recipes(title, args.pnspec, False, False, args.filenames, args.recipes_only, args.multiple, args.layer, inheritlist)
def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_recipes_only, show_multi_provider_only, inherits):
def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_recipes_only, show_multi_provider_only, selected_layer, inherits):
if inherits:
bbpath = str(self.tinfoil.config_data.getVar('BBPATH'))
for classname in inherits:
@@ -144,23 +144,24 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
preferred_versions[p] = (ver, fn)
def print_item(f, pn, ver, layer, ispref):
if f in skiplist:
skipped = ' (skipped)'
else:
skipped = ''
if show_filenames:
if ispref:
logger.plain("%s%s", f, skipped)
if not selected_layer or layer == selected_layer:
if f in skiplist:
skipped = ' (skipped)'
else:
logger.plain(" %s%s", f, skipped)
elif show_recipes_only:
if pn not in show_unique_pn:
show_unique_pn.append(pn)
logger.plain("%s%s", pn, skipped)
else:
if ispref:
logger.plain("%s:", pn)
logger.plain(" %s %s%s", layer.ljust(20), ver, skipped)
skipped = ''
if show_filenames:
if ispref:
logger.plain("%s%s", f, skipped)
else:
logger.plain(" %s%s", f, skipped)
elif show_recipes_only:
if pn not in show_unique_pn:
show_unique_pn.append(pn)
logger.plain("%s%s", pn, skipped)
else:
if ispref:
logger.plain("%s:", pn)
logger.plain(" %s %s%s", layer.ljust(20), ver, skipped)
global_inherit = (self.tinfoil.config_data.getVar('INHERIT') or "").split()
cls_re = re.compile('classes/')
@@ -501,6 +502,7 @@ NOTE: .bbappend files can impact the dependencies.
parser_show_recipes.add_argument('-r', '--recipes-only', help='instead of the default formatting, list recipes only', action='store_true')
parser_show_recipes.add_argument('-m', '--multiple', help='only list where multiple recipes (in the same layer or different layers) exist for the same recipe name', action='store_true')
parser_show_recipes.add_argument('-i', '--inherits', help='only list recipes that inherit the named class(es) - separate multiple classes using , (without spaces)', metavar='CLASS', default='')
parser_show_recipes.add_argument('-l', '--layer', help='only list recipes from the selected layer', default='')
parser_show_recipes.add_argument('pnspec', nargs='*', help='optional recipe name specification (wildcards allowed, enclose in quotes to avoid shell expansion)')
parser_show_appends = self.add_command(sp, 'show-appends', self.do_show_appends)