bitbake: bblayers/query: Add --show-variants option to display BBCLASSEXTEND variants
PATCH 1/1 bitbake: bblayers/query: Add --show-variants option to display BBCLASSEXTEND variants
The bitbake-layers show-recipes command was hiding BBCLASSEXTEND recipe variants (e.g., devupstream, nativesdk, cross-canadian) by design, to avoid clutter in the output. However, this made it impossible to see recipes like linux-firmware's devupstream variant which uses git snapshots instead of release tarballs.
This patch adds a new --show-variants (-v) option to show-recipes that allows users to view all BBCLASSEXTEND variants when needed, while maintaining the default behavior of hiding them for a cleaner output.
Example usage:
bitbake-layers show-recipes -v linux-firmware
This will now show both:
- Base version: 1:20251011
- Devupstream version: 1:20251011+git
--- bitbake/lib/bblayers/query.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
bitbake/lib/bblayers/query.py +16 -7
@@ -52,7 +52,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, False, None, args.mc) + items_listed = self.list_recipes('Overlayed recipes', None, True, args.same_version, args.filenames, False, True, None, False, None, args.mc, False) # Check for overlayed .bbclass files classes = collections.defaultdict(list)
@@ -119,9 +119,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, args.layer, args.bare, inheritlist, args.mc) + self.list_recipes(title, args.pnspec, False, False, args.filenames, args.recipes_only, args.multiple, args.layer, args.bare, inheritlist, args.mc, args.show_variants) - def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_recipes_only, show_multi_provider_only, selected_layer, bare, inherits, mc): + def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_recipes_only, show_multi_provider_only, selected_layer, bare, inherits, mc, show_variants=False): if inherits: bbpath = str(self.tinfoil.config_data.getVar('BBPATH')) for classname in inherits:
@@ -203,8 +203,10 @@ skipped recipes will also be listed, with a " (skipped)" suffix. # We only display once per recipe, we should prefer non extended versions of the # recipe if present (so e.g. in OpenEmbedded, openssl rather than nativesdk-openssl # which would otherwise sort first). + # However, if show_variants is True, we show all BBCLASSEXTEND variants. if realfn[1] and realfn[0] in self.tinfoil.cooker.recipecaches[mc].pkg_fn: - continue + if not show_variants: + continue if inherits: matchcount = 0
@@ -229,7 +231,11 @@ skipped recipes will also be listed, with a " (skipped)" suffix. for prov in allproviders[p]: provfile = bb.cache.virtualfn2realfn(prov[1])[0] provlayer = self.get_file_layer(provfile) - provs.append((provfile, provlayer, prov[0])) + # When show_variants is True, use the virtual filename to distinguish BBCLASSEXTEND variants + if show_variants: + provs.append((prov[1], provlayer, prov[0])) + else: + provs.append((provfile, provlayer, prov[0])) if provlayer != preflayer: multilayer = True if prov[0] != pref[0]:
@@ -238,10 +244,12 @@ skipped recipes will also be listed, with a " (skipped)" suffix. if not items_listed: logger.plain('=== %s ===' % title) items_listed = True + # When show_variants is True, use the virtual filename for preference check + pref_cmp_file = pref[1] if show_variants else preffile print_item(preffile, p, self.version_str(pref[0][0], pref[0][1]), preflayer, True) for (provfile, provlayer, provver) in provs: - if provfile != preffile: - print_item(provfile, p, self.version_str(provver[0], provver[1]), provlayer, False) + if provfile != pref_cmp_file: + print_item(bb.cache.virtualfn2realfn(provfile)[0] if show_variants else provfile, p, self.version_str(provver[0], provver[1]), provlayer, False) # Ensure we don't show two entries for BBCLASSEXTENDed recipes preffiles.append(preffile)
@@ -530,6 +538,7 @@ NOTE: .bbappend files can impact the dependencies. 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('-b', '--bare', help='output just names without the "(skipped)" marker', action='store_true') + parser_show_recipes.add_argument('-v', '--show-variants', help='show all BBCLASSEXTEND recipe variants (e.g., devupstream, nativesdk)', action='store_true') parser_show_recipes.add_argument('--mc', help='use specified multiconfig', default='') parser_show_recipes.add_argument('pnspec', nargs='*', help='optional recipe name specification (wildcards allowed, enclose in quotes to avoid shell expansion)')
Signature · 1 line
2.43.0