summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-30 10:49:10 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-31 11:37:10 +0100
commit71fdc64b8a975ca527cb7b2af6bc144f5c04ca7e (patch)
treef1baa21c0f0976d95880791a60341ea20089f5f4 /scripts/lib/devtool
parent906f885efe9f5fb1e69f71dd49ea65facd17deb3 (diff)
downloadpoky-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')
-rw-r--r--scripts/lib/devtool/__init__.py27
-rw-r--r--scripts/lib/devtool/standard.py36
2 files changed, 31 insertions, 32 deletions
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):
116 md5 = bb.utils.md5_file(filename) 116 md5 = bb.utils.md5_file(filename)
117 with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: 117 with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f:
118 f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5)) 118 f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5))
119
120def get_recipe_file(cooker, pn):
121 """Find recipe file corresponding a package name"""
122 import oe.recipeutils
123 recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
124 if not recipefile:
125 skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn)
126 if skipreasons:
127 logger.error('\n'.join(skipreasons))
128 else:
129 logger.error("Unable to find any recipe file matching %s" % pn)
130 return recipefile
131
132def parse_recipe(config, tinfoil, pn, appends):
133 """Parse recipe of a package"""
134 import oe.recipeutils
135 recipefile = get_recipe_file(tinfoil.cooker, pn)
136 if not recipefile:
137 # Error already logged
138 return None
139 if appends:
140 append_files = tinfoil.cooker.collection.get_file_appends(recipefile)
141 # Filter out appends from the workspace
142 append_files = [path for path in append_files if
143 not path.startswith(config.workspace_path)]
144 return oe.recipeutils.parse_recipe(recipefile, append_files,
145 tinfoil.config_data)
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
26import scriptutils 26import scriptutils
27import errno 27import errno
28from devtool import exec_build_env_command, setup_tinfoil, DevtoolError 28from devtool import exec_build_env_command, setup_tinfoil, DevtoolError
29from devtool import add_md5 29from devtool import add_md5, parse_recipe
30 30
31logger = logging.getLogger('devtool') 31logger = 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
160def _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
172def _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
188def _ls_tree(directory): 160def _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