diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-05-14 11:44:59 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-15 22:21:54 +0100 |
commit | a8f221f6c6c0562a5ed06438231c2906e542fb7b (patch) | |
tree | 8d14744cb473ee2f2a1c41eb1c1d7134575a2f57 /meta/lib/oe/recipeutils.py | |
parent | 98a716d79bfc5434a5b42d3ca683eab3eea30a41 (diff) | |
download | openembedded-core-contrib-a8f221f6c6c0562a5ed06438231c2906e542fb7b.tar.gz |
lib/oe/recipeutils: add a parse_recipe_simple() function
Add a function that simply parses a recipe by name and optionally the
bbappends that apply to it. (Note that if you're using tinfoil you need
to have initialised it with config_only=False so that it can map the
recipe name to a recipe file.)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'meta/lib/oe/recipeutils.py')
-rw-r--r-- | meta/lib/oe/recipeutils.py | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index 19d97b62d24..0689fb0c714 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py @@ -44,13 +44,36 @@ def get_unavailable_reasons(cooker, pn): return taskdata.get_reasons(pn) -def parse_recipe(fn, appends, d): - """Parse an individual recipe""" +def parse_recipe(fn, appendfiles, d): + """ + Parse an individual recipe file, optionally with a list of + bbappend files. + """ import bb.cache - envdata = bb.cache.Cache.loadDataFull(fn, appends, d) + envdata = bb.cache.Cache.loadDataFull(fn, appendfiles, d) return envdata +def parse_recipe_simple(cooker, pn, d, appends=True): + """ + Parse a recipe and optionally all bbappends that apply to it + in the current configuration. + """ + import bb.providers + + recipefile = pn_to_recipe(cooker, pn) + if not recipefile: + skipreasons = get_unavailable_reasons(cooker, pn) + # We may as well re-use bb.providers.NoProvider here + if skipreasons: + raise bb.providers.NoProvider(skipreasons) + else: + raise bb.providers.NoProvider('Unable to find any recipe file matching %s' % pn) + if appends: + appendfiles = cooker.collection.get_file_appends(recipefile) + return parse_recipe(recipefile, appendfiles, d) + + def get_var_files(fn, varlist, d): """Find the file in which each of a list of variables is set. Note: requires variable history to be enabled when parsing. |