bitbake: Add multiconfig to 'bitbake-layers show-recipes'
cover bitbake: Add multiconfig to 'bitbake-layers show-recipes'
Implements support for specifying a specific multiconfig to use when running 'bitbake-layers show-recipes'. This required fixing up some of the multiconfig support in tinfoil and the cooker.
Joshua Watt (4):
bitbake: command: Add mc parameter to findProviders command
bitbake: cooker: Respect multiconfig parameter
bitbake: tinfoil: Add multiconfig support
bitbake: bblayers: query: Add multiconfig option
bitbake/lib/bb/command.py | 6 +++++- bitbake/lib/bb/cooker.py | 6 +++--- bitbake/lib/bb/tinfoil.py | 38 ++++++++++++++++++----------------- bitbake/lib/bblayers/query.py | 20 +++++++++++------- 4 files changed, 41 insertions(+), 29 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/4 bitbake: command: Add mc parameter to findProviders command
Adds a multiconfig selection parameter to the findProviders command. This allows a client to find the providers for a specific multiconfig instead of the base configuration.
--- bitbake/lib/bb/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
bitbake/lib/bb/command.py +5 -1
@@ -414,7 +414,11 @@ class CommandsSync: getAllAppends.readonly = True def findProviders(self, command, params): - return command.cooker.findProviders() + try: + mc = params[0] + except IndexError: + mc = '' + return command.cooker.findProviders(mc) findProviders.readonly = True def findBestProvider(self, command, params):
Signature · 1 line
2.17.1
PATCH 2/4 bitbake: cooker: Respect multiconfig parameter
In reply to Joshua WattThe cooker had a multiconfig parameter for the findProviders() and findBestProviders() API, but it was being ignored.
--- bitbake/lib/bb/cooker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
bitbake/lib/bb/cooker.py +3 -3
@@ -1023,16 +1023,16 @@ class BBCooker: bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.data) def findProviders(self, mc=''): - return bb.providers.findProviders(self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn) + return bb.providers.findProviders(self.databuilder.mcdata[mc], self.recipecaches[mc], self.recipecaches[mc].pkg_pn) def findBestProvider(self, pn, mc=''): if pn in self.recipecaches[mc].providers: filenames = self.recipecaches[mc].providers[pn] - eligible, foundUnique = bb.providers.filterProviders(filenames, pn, self.data, self.recipecaches[mc]) + eligible, foundUnique = bb.providers.filterProviders(filenames, pn, self.databuilder.mcdata[mc], self.recipecaches[mc]) filename = eligible[0] return None, None, None, filename elif pn in self.recipecaches[mc].pkg_pn: - return bb.providers.findBestProvider(pn, self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn) + return bb.providers.findBestProvider(pn, self.databuilder.mcdata[mc], self.recipecaches[mc], self.recipecaches[mc].pkg_pn) else: return None, None, None, None
Signature · 1 line
2.17.1
PATCH 3/4 bitbake: tinfoil: Add multiconfig support
In reply to Joshua WattAdds support for the Tinfoil cache adaptor to be bound to a specific multiconfig and invoke the appropriate commands for that multiconfig instead of the default. The cooker adapter now creates a cache adapter for each multiconfig specified in BBMULTICONFIG so that each multiconfig is present.
--- bitbake/lib/bb/tinfoil.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
bitbake/lib/bb/tinfoil.py +20 -18
@@ -127,12 +127,13 @@ class TinfoilCookerAdapter: class TinfoilRecipeCacheAdapter: """ cooker.recipecache adapter """ - def __init__(self, tinfoil): + def __init__(self, tinfoil, mc=''): self.tinfoil = tinfoil + self.mc = mc self._cache = {} def get_pkg_pn_fn(self): - pkg_pn = defaultdict(list, self.tinfoil.run_command('getRecipes') or []) + pkg_pn = defaultdict(list, self.tinfoil.run_command('getRecipes', self.mc) or []) pkg_fn = {} for pn, fnlist in pkg_pn.items(): for fn in fnlist:
@@ -151,27 +152,27 @@ class TinfoilCookerAdapter: self.get_pkg_pn_fn() return self._cache[name] elif name == 'deps': - attrvalue = defaultdict(list, self.tinfoil.run_command('getRecipeDepends') or []) + attrvalue = defaultdict(list, self.tinfoil.run_command('getRecipeDepends', self.mc) or []) elif name == 'rundeps': - attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeDepends') or []) + attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeDepends', self.mc) or []) elif name == 'runrecs': - attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeRecommends') or []) + attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeRecommends', self.mc) or []) elif name == 'pkg_pepvpr': - attrvalue = self.tinfoil.run_command('getRecipeVersions') or {} + attrvalue = self.tinfoil.run_command('getRecipeVersions', self.mc) or {} elif name == 'inherits': - attrvalue = self.tinfoil.run_command('getRecipeInherits') or {} + attrvalue = self.tinfoil.run_command('getRecipeInherits', self.mc) or {} elif name == 'bbfile_priority': - attrvalue = self.tinfoil.run_command('getBbFilePriority') or {} + attrvalue = self.tinfoil.run_command('getBbFilePriority', self.mc) or {} elif name == 'pkg_dp': - attrvalue = self.tinfoil.run_command('getDefaultPreference') or {} + attrvalue = self.tinfoil.run_command('getDefaultPreference', self.mc) or {} elif name == 'fn_provides': - attrvalue = self.tinfoil.run_command('getRecipeProvides') or {} + attrvalue = self.tinfoil.run_command('getRecipeProvides', self.mc) or {} elif name == 'packages': - attrvalue = self.tinfoil.run_command('getRecipePackages') or {} + attrvalue = self.tinfoil.run_command('getRecipePackages', self.mc) or {} elif name == 'packages_dynamic': - attrvalue = self.tinfoil.run_command('getRecipePackagesDynamic') or {} + attrvalue = self.tinfoil.run_command('getRecipePackagesDynamic', self.mc) or {} elif name == 'rproviders': - attrvalue = self.tinfoil.run_command('getRProviders') or {} + attrvalue = self.tinfoil.run_command('getRProviders', self.mc) or {} else: raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name))
@@ -182,8 +183,9 @@ class TinfoilCookerAdapter: self.tinfoil = tinfoil self.collection = self.TinfoilCookerCollectionAdapter(tinfoil) self.recipecaches = {} - # FIXME all machines self.recipecaches[''] = self.TinfoilRecipeCacheAdapter(tinfoil) + for mc in (tinfoil.config_data.getVar('BBMULTICONFIG') or '').split(): + self.recipecaches[mc] = self.TinfoilRecipeCacheAdapter(tinfoil, mc) self._cache = {} def __getattr__(self, name): # Grab these only when they are requested since they aren't always used
@@ -501,11 +503,11 @@ class Tinfoil: """ return OrderedDict(self.run_command('getSkippedRecipes')) - def get_all_providers(self): - return defaultdict(list, self.run_command('allProviders')) + def get_all_providers(self, mc=''): + return defaultdict(list, self.run_command('allProviders', mc)) - def find_providers(self): - return self.run_command('findProviders') + def find_providers(self, mc=''): + return self.run_command('findProviders', mc) def find_best_provider(self, pn): return self.run_command('findBestProvider', pn)
Signature · 1 line
2.17.1
PATCH 4/4 bitbake: bblayers: query: Add multiconfig option
In reply to Joshua WattAdds an option to the show-recipes subcommand that allows the user to specify which multiconfig should be shown.
--- bitbake/lib/bblayers/query.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
bitbake/lib/bblayers/query.py +13 -7
@@ -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, False, None) + items_listed = self.list_recipes('Overlayed recipes', None, True, args.same_version, args.filenames, False, True, None, False, None, args.mc) # 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, args.layer, args.bare, inheritlist) + self.list_recipes(title, args.pnspec, False, False, args.filenames, args.recipes_only, args.multiple, args.layer, args.bare, inheritlist, args.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): + 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): if inherits: bbpath = str(self.tinfoil.config_data.getVar('BBPATH')) for classname in inherits:
@@ -123,14 +123,18 @@ skipped recipes will also be listed, with a " (skipped)" suffix. logger.error('No class named %s found in BBPATH', classfile) sys.exit(1) - pkg_pn = self.tinfoil.cooker.recipecaches[''].pkg_pn - (latest_versions, preferred_versions) = self.tinfoil.find_providers() - allproviders = self.tinfoil.get_all_providers() + pkg_pn = self.tinfoil.cooker.recipecaches[mc].pkg_pn + (latest_versions, preferred_versions) = self.tinfoil.find_providers(mc) + allproviders = self.tinfoil.get_all_providers(mc) # Ensure we list skipped recipes # We are largely guessing about PN, PV and the preferred version here, # but we have no choice since skipped recipes are not fully parsed skiplist = list(self.tinfoil.cooker.skiplist.keys()) + mcspec = 'mc:%s:' % mc + if mc: + skiplist = [s[len(mcspec):] for s in skiplist if s.startswith(mcspec)] + for fn in skiplist: recipe_parts = os.path.splitext(os.path.basename(fn))[0].split('_') p = recipe_parts[0]
@@ -187,7 +191,7 @@ 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). - if realfn[1] and realfn[0] in self.tinfoil.cooker.recipecaches[''].pkg_fn: + if realfn[1] and realfn[0] in self.tinfoil.cooker.recipecaches[mc].pkg_fn: continue if inherits:
@@ -496,6 +500,7 @@ NOTE: .bbappend files can impact the dependencies. parser_show_overlayed = self.add_command(sp, 'show-overlayed', self.do_show_overlayed) parser_show_overlayed.add_argument('-f', '--filenames', help='instead of the default formatting, list filenames of higher priority recipes with the ones they overlay indented underneath', action='store_true') parser_show_overlayed.add_argument('-s', '--same-version', help='only list overlayed recipes where the version is the same', action='store_true') + parser_show_overlayed.add_argument('--mc', help='use specified multiconfig', default='') parser_show_recipes = self.add_command(sp, 'show-recipes', self.do_show_recipes) parser_show_recipes.add_argument('-f', '--filenames', help='instead of the default formatting, list filenames of higher priority recipes with the ones they overlay indented underneath', action='store_true')
@@ -504,6 +509,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('--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)') parser_show_appends = self.add_command(sp, 'show-appends', self.do_show_appends)
Signature · 1 line
2.17.1