diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-08-30 14:16:22 +1200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-02 18:09:49 +0100 |
| commit | 26aad57ecec0c4a75f87c2c13cd060b80bac5212 (patch) | |
| tree | 8716b132dfaab2a58162743cbf4a90d174d0e3d5 /bitbake/lib | |
| parent | 818a36590a74ad6c461e3af538f405be6a9ef6f0 (diff) | |
| download | poky-26aad57ecec0c4a75f87c2c13cd060b80bac5212.tar.gz | |
bitbake: tinfoil: add a parse_recipe_file function
Parsing a recipe is such a common task for tinfoil-using scripts, and is
a little awkward to do properly, so add an API function to do it. This
should also isolate scripts a little from future changes to the internal
code. The first user of this will be the OpenEmbedded layer index update
script.
Part of the fix for [YOCTO #10192].
(Bitbake rev: 39780b1ccbd76579db0fc6fb9369c848a3bafa9d)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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() |
