summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-05-12 16:39:31 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-18 09:14:04 +0100
commitf0ab93f17721e0f0a213f0260b9c7fbf9fbc6853 (patch)
tree3c5c90d7e9af5a6b91c75f4b3c22d3ab20d184af /scripts
parent6e039bf7c00cd6fef1c57a3c0e838ab528d99587 (diff)
downloadpoky-f0ab93f17721e0f0a213f0260b9c7fbf9fbc6853.tar.gz
devtool: refactor bb task execution into a separate class
(From OE-Core rev: bd93a75ec0537fc82ac84ccc5701473d76877bcb) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/standard.py50
1 files changed, 30 insertions, 20 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 1e99413365..aed76ea621 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -213,6 +213,32 @@ def extract(args, config, basepath, workspace):
213 else: 213 else:
214 return -1 214 return -1
215 215
216class BbTaskExecutor(object):
217 """Class for executing bitbake tasks for a recipe
218
219 FIXME: This is very awkward. Unfortunately it's not currently easy to
220 properly execute tasks outside of bitbake itself, until then this has to
221 suffice if we are to handle e.g. linux-yocto's extra tasks
222 """
223
224 def __init__(self, rdata):
225 self.rdata = rdata
226 self.executed = []
227
228 def exec_func(self, func, report):
229 """Run bitbake task function"""
230 if not func in self.executed:
231 deps = self.rdata.getVarFlag(func, 'deps')
232 if deps:
233 for taskdepfunc in deps:
234 self.exec_func(taskdepfunc, True)
235 if report:
236 logger.info('Executing %s...' % func)
237 fn = self.rdata.getVar('FILE', True)
238 localdata = bb.build._task_data(fn, func, self.rdata)
239 bb.build.exec_func(func, localdata)
240 self.executed.append(func)
241
216 242
217def _extract_source(srctree, keep_temp, devbranch, d): 243def _extract_source(srctree, keep_temp, devbranch, d):
218 """Extract sources of a recipe""" 244 """Extract sources of a recipe"""
@@ -270,28 +296,12 @@ def _extract_source(srctree, keep_temp, devbranch, d):
270 # We don't want to move the source to STAGING_KERNEL_DIR here 296 # We don't want to move the source to STAGING_KERNEL_DIR here
271 crd.setVar('STAGING_KERNEL_DIR', '${S}') 297 crd.setVar('STAGING_KERNEL_DIR', '${S}')
272 298
273 # FIXME: This is very awkward. Unfortunately it's not currently easy to properly 299 task_executor = BbTaskExecutor(crd)
274 # execute tasks outside of bitbake itself, until then this has to suffice if we
275 # are to handle e.g. linux-yocto's extra tasks
276 executed = []
277 def exec_task_func(func, report):
278 """Run specific bitbake task for a recipe"""
279 if not func in executed:
280 deps = crd.getVarFlag(func, 'deps')
281 if deps:
282 for taskdepfunc in deps:
283 exec_task_func(taskdepfunc, True)
284 if report:
285 logger.info('Executing %s...' % func)
286 fn = d.getVar('FILE', True)
287 localdata = bb.build._task_data(fn, func, crd)
288 bb.build.exec_func(func, localdata)
289 executed.append(func)
290 300
291 logger.info('Fetching %s...' % pn) 301 logger.info('Fetching %s...' % pn)
292 exec_task_func('do_fetch', False) 302 task_executor.exec_func('do_fetch', False)
293 logger.info('Unpacking...') 303 logger.info('Unpacking...')
294 exec_task_func('do_unpack', False) 304 task_executor.exec_func('do_unpack', False)
295 srcsubdir = crd.getVar('S', True) 305 srcsubdir = crd.getVar('S', True)
296 if srcsubdir == workdir: 306 if srcsubdir == workdir:
297 # Find non-patch sources that were "unpacked" to srctree directory 307 # Find non-patch sources that were "unpacked" to srctree directory
@@ -343,7 +353,7 @@ def _extract_source(srctree, keep_temp, devbranch, d):
343 crd.setVar('PATCHTOOL', 'git') 353 crd.setVar('PATCHTOOL', 'git')
344 354
345 logger.info('Patching...') 355 logger.info('Patching...')
346 exec_task_func('do_patch', False) 356 task_executor.exec_func('do_patch', False)
347 357
348 bb.process.run('git tag -f devtool-patched', cwd=srcsubdir) 358 bb.process.run('git tag -f devtool-patched', cwd=srcsubdir)
349 359