diff options
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/tinfoil.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 441be2c615..8899e861c3 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
| @@ -90,6 +90,42 @@ class Tinfoil: | |||
| 90 | else: | 90 | else: |
| 91 | self.parseRecipes() | 91 | self.parseRecipes() |
| 92 | 92 | ||
| 93 | def parse_recipe_file(self, fn, appends=True, appendlist=None, config_data=None): | ||
| 94 | """ | ||
| 95 | Parse the specified recipe file (with or without bbappends) | ||
| 96 | and return a datastore object representing the environment | ||
| 97 | for the recipe. | ||
| 98 | Parameters: | ||
| 99 | fn: recipe file to parse - can be a file path or virtual | ||
| 100 | specification | ||
| 101 | appends: True to apply bbappends, False otherwise | ||
| 102 | appendlist: optional list of bbappend files to apply, if you | ||
| 103 | want to filter them | ||
| 104 | config_data: custom config datastore to use. NOTE: if you | ||
| 105 | specify config_data then you cannot use a virtual | ||
| 106 | specification for fn. | ||
| 107 | """ | ||
| 108 | if appends and appendlist == []: | ||
| 109 | appends = False | ||
| 110 | if appends: | ||
| 111 | if appendlist: | ||
| 112 | appendfiles = appendlist | ||
| 113 | else: | ||
| 114 | if not hasattr(self.cooker, 'collection'): | ||
| 115 | raise Exception('You must call tinfoil.prepare() with config_only=False in order to get bbappends') | ||
| 116 | appendfiles = self.cooker.collection.get_file_appends(fn) | ||
| 117 | else: | ||
| 118 | appendfiles = None | ||
| 119 | if config_data: | ||
| 120 | # We have to use a different function here if we're passing in a datastore | ||
| 121 | localdata = bb.data.createCopy(config_data) | ||
| 122 | envdata = bb.cache.parse_recipe(localdata, fn, appendfiles)[''] | ||
| 123 | else: | ||
| 124 | # Use the standard path | ||
| 125 | parser = bb.cache.NoCache(self.cooker.databuilder) | ||
| 126 | envdata = parser.loadDataFull(fn, appendfiles) | ||
| 127 | return envdata | ||
| 128 | |||
| 93 | def shutdown(self): | 129 | def shutdown(self): |
| 94 | self.cooker.shutdown(force=True) | 130 | self.cooker.shutdown(force=True) |
| 95 | self.cooker.post_serve() | 131 | self.cooker.post_serve() |
