From 71fdc64b8a975ca527cb7b2af6bc144f5c04ca7e Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Sun, 30 Aug 2015 10:49:10 +0300 Subject: devtool: make 2 functions public Moved standard.py:_parse_recipe -> __init__.py:parse_recipe and standard.py:_get_recipe_file -> __init__.py:get_recipe_file to be able to call them from other modules. (From OE-Core rev: f0e61a0d5597017c5f5d2dafb41118b79f505d9b) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- scripts/lib/devtool/__init__.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'scripts/lib/devtool/__init__.py') diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index 1747fff486..97ac6aeb80 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py @@ -116,3 +116,30 @@ def add_md5(config, recipename, filename): md5 = bb.utils.md5_file(filename) with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5)) + +def get_recipe_file(cooker, pn): + """Find recipe file corresponding a package name""" + import oe.recipeutils + recipefile = oe.recipeutils.pn_to_recipe(cooker, pn) + if not recipefile: + skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn) + if skipreasons: + logger.error('\n'.join(skipreasons)) + else: + logger.error("Unable to find any recipe file matching %s" % pn) + return recipefile + +def parse_recipe(config, tinfoil, pn, appends): + """Parse recipe of a package""" + import oe.recipeutils + recipefile = get_recipe_file(tinfoil.cooker, pn) + if not recipefile: + # Error already logged + return None + if appends: + append_files = tinfoil.cooker.collection.get_file_appends(recipefile) + # Filter out appends from the workspace + append_files = [path for path in append_files if + not path.startswith(config.workspace_path)] + return oe.recipeutils.parse_recipe(recipefile, append_files, + tinfoil.config_data) -- cgit v1.2.3-54-g00ecf