diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-08-30 10:49:10 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-31 11:37:10 +0100 |
| commit | 71fdc64b8a975ca527cb7b2af6bc144f5c04ca7e (patch) | |
| tree | f1baa21c0f0976d95880791a60341ea20089f5f4 /scripts/lib/devtool/standard.py | |
| parent | 906f885efe9f5fb1e69f71dd49ea65facd17deb3 (diff) | |
| download | poky-71fdc64b8a975ca527cb7b2af6bc144f5c04ca7e.tar.gz | |
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 <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
| -rw-r--r-- | scripts/lib/devtool/standard.py | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 4aa6ebd072..97c45d93b0 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
| @@ -26,7 +26,7 @@ import argparse | |||
| 26 | import scriptutils | 26 | import scriptutils |
| 27 | import errno | 27 | import errno |
| 28 | from devtool import exec_build_env_command, setup_tinfoil, DevtoolError | 28 | from devtool import exec_build_env_command, setup_tinfoil, DevtoolError |
| 29 | from devtool import add_md5 | 29 | from devtool import add_md5, parse_recipe |
| 30 | 30 | ||
| 31 | logger = logging.getLogger('devtool') | 31 | logger = logging.getLogger('devtool') |
| 32 | 32 | ||
| @@ -157,34 +157,6 @@ def _check_compatible_recipe(pn, d): | |||
| 157 | "from working. You will need to disable this " | 157 | "from working. You will need to disable this " |
| 158 | "first." % pn) | 158 | "first." % pn) |
| 159 | 159 | ||
| 160 | def _get_recipe_file(cooker, pn): | ||
| 161 | """Find recipe file corresponding a package name""" | ||
| 162 | import oe.recipeutils | ||
| 163 | recipefile = oe.recipeutils.pn_to_recipe(cooker, pn) | ||
| 164 | if not recipefile: | ||
| 165 | skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn) | ||
| 166 | if skipreasons: | ||
| 167 | logger.error('\n'.join(skipreasons)) | ||
| 168 | else: | ||
| 169 | logger.error("Unable to find any recipe file matching %s" % pn) | ||
| 170 | return recipefile | ||
| 171 | |||
| 172 | def _parse_recipe(config, tinfoil, pn, appends): | ||
| 173 | """Parse recipe of a package""" | ||
| 174 | import oe.recipeutils | ||
| 175 | recipefile = _get_recipe_file(tinfoil.cooker, pn) | ||
| 176 | if not recipefile: | ||
| 177 | # Error already logged | ||
| 178 | return None | ||
| 179 | if appends: | ||
| 180 | append_files = tinfoil.cooker.collection.get_file_appends(recipefile) | ||
| 181 | # Filter out appends from the workspace | ||
| 182 | append_files = [path for path in append_files if | ||
| 183 | not path.startswith(config.workspace_path)] | ||
| 184 | return oe.recipeutils.parse_recipe(recipefile, append_files, | ||
| 185 | tinfoil.config_data) | ||
| 186 | |||
| 187 | |||
| 188 | def _ls_tree(directory): | 160 | def _ls_tree(directory): |
| 189 | """Recursive listing of files in a directory""" | 161 | """Recursive listing of files in a directory""" |
| 190 | ret = [] | 162 | ret = [] |
| @@ -200,7 +172,7 @@ def extract(args, config, basepath, workspace): | |||
| 200 | 172 | ||
| 201 | tinfoil = setup_tinfoil() | 173 | tinfoil = setup_tinfoil() |
| 202 | 174 | ||
| 203 | rd = _parse_recipe(config, tinfoil, args.recipename, True) | 175 | rd = parse_recipe(config, tinfoil, args.recipename, True) |
| 204 | if not rd: | 176 | if not rd: |
| 205 | return 1 | 177 | return 1 |
| 206 | 178 | ||
| @@ -420,7 +392,7 @@ def modify(args, config, basepath, workspace): | |||
| 420 | 392 | ||
| 421 | tinfoil = setup_tinfoil() | 393 | tinfoil = setup_tinfoil() |
| 422 | 394 | ||
| 423 | rd = _parse_recipe(config, tinfoil, args.recipename, True) | 395 | rd = parse_recipe(config, tinfoil, args.recipename, True) |
| 424 | if not rd: | 396 | if not rd: |
| 425 | return 1 | 397 | return 1 |
| 426 | recipefile = rd.getVar('FILE', True) | 398 | recipefile = rd.getVar('FILE', True) |
| @@ -762,7 +734,7 @@ def update_recipe(args, config, basepath, workspace): | |||
| 762 | 734 | ||
| 763 | tinfoil = setup_tinfoil() | 735 | tinfoil = setup_tinfoil() |
| 764 | 736 | ||
| 765 | rd = _parse_recipe(config, tinfoil, args.recipename, True) | 737 | rd = parse_recipe(config, tinfoil, args.recipename, True) |
| 766 | if not rd: | 738 | if not rd: |
| 767 | return 1 | 739 | return 1 |
| 768 | 740 | ||
