diff options
Diffstat (limited to 'bitbake/lib/bb/tinfoil.py')
| -rw-r--r-- | bitbake/lib/bb/tinfoil.py | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 459f6c1286..c551a9f1f7 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
| @@ -26,6 +26,7 @@ from collections import OrderedDict, defaultdict | |||
| 26 | import bb.cache | 26 | import bb.cache |
| 27 | import bb.cooker | 27 | import bb.cooker |
| 28 | import bb.providers | 28 | import bb.providers |
| 29 | import bb.taskdata | ||
| 29 | import bb.utils | 30 | import bb.utils |
| 30 | import bb.command | 31 | import bb.command |
| 31 | from bb.cookerdata import CookerConfiguration, ConfigParameters | 32 | from bb.cookerdata import CookerConfiguration, ConfigParameters |
| @@ -90,7 +91,7 @@ class TinfoilCookerAdapter: | |||
| 90 | def __init__(self, tinfoil): | 91 | def __init__(self, tinfoil): |
| 91 | self.tinfoil = tinfoil | 92 | self.tinfoil = tinfoil |
| 92 | def get_file_appends(self, fn): | 93 | def get_file_appends(self, fn): |
| 93 | return self.tinfoil.run_command('getFileAppends', fn) | 94 | return self.tinfoil.get_file_appends(fn) |
| 94 | def __getattr__(self, name): | 95 | def __getattr__(self, name): |
| 95 | if name == 'overlayed': | 96 | if name == 'overlayed': |
| 96 | return self.tinfoil.get_overlayed_recipes() | 97 | return self.tinfoil.get_overlayed_recipes() |
| @@ -305,6 +306,34 @@ class Tinfoil: | |||
| 305 | def get_runtime_providers(self, rdep): | 306 | def get_runtime_providers(self, rdep): |
| 306 | return self.run_command('getRuntimeProviders', rdep) | 307 | return self.run_command('getRuntimeProviders', rdep) |
| 307 | 308 | ||
| 309 | def get_recipe_file(self, pn): | ||
| 310 | """ | ||
| 311 | Get the file name for the specified recipe/target. Raises | ||
| 312 | bb.providers.NoProvider if there is no match or the recipe was | ||
| 313 | skipped. | ||
| 314 | """ | ||
| 315 | best = self.find_best_provider(pn) | ||
| 316 | if not best: | ||
| 317 | skiplist = self.get_skipped_recipes() | ||
| 318 | taskdata = bb.taskdata.TaskData(None, skiplist=skiplist) | ||
| 319 | skipreasons = taskdata.get_reasons(pn) | ||
| 320 | if skipreasons: | ||
| 321 | raise bb.providers.NoProvider(skipreasons) | ||
| 322 | else: | ||
| 323 | raise bb.providers.NoProvider('Unable to find any recipe file matching %s' % pn) | ||
| 324 | return best[3] | ||
| 325 | |||
| 326 | def get_file_appends(self, fn): | ||
| 327 | return self.run_command('getFileAppends', fn) | ||
| 328 | |||
| 329 | def parse_recipe(self, pn): | ||
| 330 | """ | ||
| 331 | Parse the specified recipe and return a datastore object | ||
| 332 | representing the environment for the recipe. | ||
| 333 | """ | ||
| 334 | fn = self.get_recipe_file(pn) | ||
| 335 | return self.parse_recipe_file(fn) | ||
| 336 | |||
| 308 | def parse_recipe_file(self, fn, appends=True, appendlist=None, config_data=None): | 337 | def parse_recipe_file(self, fn, appends=True, appendlist=None, config_data=None): |
| 309 | """ | 338 | """ |
| 310 | Parse the specified recipe file (with or without bbappends) | 339 | Parse the specified recipe file (with or without bbappends) |
| @@ -322,24 +351,15 @@ class Tinfoil: | |||
| 322 | """ | 351 | """ |
| 323 | if appends and appendlist == []: | 352 | if appends and appendlist == []: |
| 324 | appends = False | 353 | appends = False |
| 325 | if appends: | ||
| 326 | if appendlist: | ||
| 327 | appendfiles = appendlist | ||
| 328 | else: | ||
| 329 | if not hasattr(self.cooker, 'collection'): | ||
| 330 | raise Exception('You must call tinfoil.prepare() with config_only=False in order to get bbappends') | ||
| 331 | appendfiles = self.cooker.collection.get_file_appends(fn) | ||
| 332 | else: | ||
| 333 | appendfiles = None | ||
| 334 | if config_data: | 354 | if config_data: |
| 335 | # We have to use a different function here if we're passing in a datastore | 355 | dctr = bb.remotedata.RemoteDatastores.transmit_datastore(config_data) |
| 336 | localdata = bb.data.createCopy(config_data) | 356 | dscon = self.run_command('parseRecipeFile', fn, appends, appendlist, dctr) |
| 337 | envdata = bb.cache.parse_recipe(localdata, fn, appendfiles)[''] | 357 | else: |
| 358 | dscon = self.run_command('parseRecipeFile', fn, appends, appendlist) | ||
| 359 | if dscon: | ||
| 360 | return self._reconvert_type(dscon, 'DataStoreConnectionHandle') | ||
| 338 | else: | 361 | else: |
| 339 | # Use the standard path | 362 | return None |
| 340 | parser = bb.cache.NoCache(self.cooker.databuilder) | ||
| 341 | envdata = parser.loadDataFull(fn, appendfiles) | ||
| 342 | return envdata | ||
| 343 | 363 | ||
| 344 | def build_file(self, buildfile, task): | 364 | def build_file(self, buildfile, task): |
| 345 | """ | 365 | """ |
