summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2020-03-04 14:02:25 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-03-07 16:07:00 +0000
commitecb1d9f31729ca85cfbf54bbbc0c5f16fbe99c4d (patch)
tree68fbd2758a66ed63aab26d71d66998df3b9c9633 /bitbake
parente57d1d3906ab265e88d18fa42c644ce6ca81378c (diff)
downloadpoky-ecb1d9f31729ca85cfbf54bbbc0c5f16fbe99c4d.tar.gz
bitbake: tinfoil: Add multiconfig support
Adds 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 rev: d515481681dca4a0bc733c6ad8a8498a82e3d9b9) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tinfoil.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index 0bd7836323..9560eb5b49 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -127,12 +127,13 @@ class TinfoilCookerAdapter:
127 127
128 class TinfoilRecipeCacheAdapter: 128 class TinfoilRecipeCacheAdapter:
129 """ cooker.recipecache adapter """ 129 """ cooker.recipecache adapter """
130 def __init__(self, tinfoil): 130 def __init__(self, tinfoil, mc=''):
131 self.tinfoil = tinfoil 131 self.tinfoil = tinfoil
132 self.mc = mc
132 self._cache = {} 133 self._cache = {}
133 134
134 def get_pkg_pn_fn(self): 135 def get_pkg_pn_fn(self):
135 pkg_pn = defaultdict(list, self.tinfoil.run_command('getRecipes') or []) 136 pkg_pn = defaultdict(list, self.tinfoil.run_command('getRecipes', self.mc) or [])
136 pkg_fn = {} 137 pkg_fn = {}
137 for pn, fnlist in pkg_pn.items(): 138 for pn, fnlist in pkg_pn.items():
138 for fn in fnlist: 139 for fn in fnlist:
@@ -151,27 +152,27 @@ class TinfoilCookerAdapter:
151 self.get_pkg_pn_fn() 152 self.get_pkg_pn_fn()
152 return self._cache[name] 153 return self._cache[name]
153 elif name == 'deps': 154 elif name == 'deps':
154 attrvalue = defaultdict(list, self.tinfoil.run_command('getRecipeDepends') or []) 155 attrvalue = defaultdict(list, self.tinfoil.run_command('getRecipeDepends', self.mc) or [])
155 elif name == 'rundeps': 156 elif name == 'rundeps':
156 attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeDepends') or []) 157 attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeDepends', self.mc) or [])
157 elif name == 'runrecs': 158 elif name == 'runrecs':
158 attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeRecommends') or []) 159 attrvalue = defaultdict(lambda: defaultdict(list), self.tinfoil.run_command('getRuntimeRecommends', self.mc) or [])
159 elif name == 'pkg_pepvpr': 160 elif name == 'pkg_pepvpr':
160 attrvalue = self.tinfoil.run_command('getRecipeVersions') or {} 161 attrvalue = self.tinfoil.run_command('getRecipeVersions', self.mc) or {}
161 elif name == 'inherits': 162 elif name == 'inherits':
162 attrvalue = self.tinfoil.run_command('getRecipeInherits') or {} 163 attrvalue = self.tinfoil.run_command('getRecipeInherits', self.mc) or {}
163 elif name == 'bbfile_priority': 164 elif name == 'bbfile_priority':
164 attrvalue = self.tinfoil.run_command('getBbFilePriority') or {} 165 attrvalue = self.tinfoil.run_command('getBbFilePriority', self.mc) or {}
165 elif name == 'pkg_dp': 166 elif name == 'pkg_dp':
166 attrvalue = self.tinfoil.run_command('getDefaultPreference') or {} 167 attrvalue = self.tinfoil.run_command('getDefaultPreference', self.mc) or {}
167 elif name == 'fn_provides': 168 elif name == 'fn_provides':
168 attrvalue = self.tinfoil.run_command('getRecipeProvides') or {} 169 attrvalue = self.tinfoil.run_command('getRecipeProvides', self.mc) or {}
169 elif name == 'packages': 170 elif name == 'packages':
170 attrvalue = self.tinfoil.run_command('getRecipePackages') or {} 171 attrvalue = self.tinfoil.run_command('getRecipePackages', self.mc) or {}
171 elif name == 'packages_dynamic': 172 elif name == 'packages_dynamic':
172 attrvalue = self.tinfoil.run_command('getRecipePackagesDynamic') or {} 173 attrvalue = self.tinfoil.run_command('getRecipePackagesDynamic', self.mc) or {}
173 elif name == 'rproviders': 174 elif name == 'rproviders':
174 attrvalue = self.tinfoil.run_command('getRProviders') or {} 175 attrvalue = self.tinfoil.run_command('getRProviders', self.mc) or {}
175 else: 176 else:
176 raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name)) 177 raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name))
177 178
@@ -182,8 +183,9 @@ class TinfoilCookerAdapter:
182 self.tinfoil = tinfoil 183 self.tinfoil = tinfoil
183 self.collection = self.TinfoilCookerCollectionAdapter(tinfoil) 184 self.collection = self.TinfoilCookerCollectionAdapter(tinfoil)
184 self.recipecaches = {} 185 self.recipecaches = {}
185 # FIXME all machines
186 self.recipecaches[''] = self.TinfoilRecipeCacheAdapter(tinfoil) 186 self.recipecaches[''] = self.TinfoilRecipeCacheAdapter(tinfoil)
187 for mc in (tinfoil.config_data.getVar('BBMULTICONFIG') or '').split():
188 self.recipecaches[mc] = self.TinfoilRecipeCacheAdapter(tinfoil, mc)
187 self._cache = {} 189 self._cache = {}
188 def __getattr__(self, name): 190 def __getattr__(self, name):
189 # Grab these only when they are requested since they aren't always used 191 # Grab these only when they are requested since they aren't always used
@@ -501,11 +503,11 @@ class Tinfoil:
501 """ 503 """
502 return OrderedDict(self.run_command('getSkippedRecipes')) 504 return OrderedDict(self.run_command('getSkippedRecipes'))
503 505
504 def get_all_providers(self): 506 def get_all_providers(self, mc=''):
505 return defaultdict(list, self.run_command('allProviders')) 507 return defaultdict(list, self.run_command('allProviders', mc))
506 508
507 def find_providers(self): 509 def find_providers(self, mc=''):
508 return self.run_command('findProviders') 510 return self.run_command('findProviders', mc)
509 511
510 def find_best_provider(self, pn): 512 def find_best_provider(self, pn):
511 return self.run_command('findBestProvider', pn) 513 return self.run_command('findBestProvider', pn)