aboutsummaryrefslogtreecommitdiffstats
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:11:59 +0100
commitbd93a75ec0537fc82ac84ccc5701473d76877bcb (patch)
tree2e09013cfabf3336d283327e82635c1627867ae6 /scripts
parent551638c44215a35238f22aba575d571572046cd0 (diff)
downloadopenembedded-core-contrib-bd93a75ec0537fc82ac84ccc5701473d76877bcb.tar.gz
devtool: refactor bb task execution into a separate class
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
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):
else:
return -1
+class BbTaskExecutor(object):
+ """Class for executing bitbake tasks for a recipe
+
+ FIXME: This is very awkward. Unfortunately it's not currently easy to
+ properly execute tasks outside of bitbake itself, until then this has to
+ suffice if we are to handle e.g. linux-yocto's extra tasks
+ """
+
+ def __init__(self, rdata):
+ self.rdata = rdata
+ self.executed = []
+
+ def exec_func(self, func, report):
+ """Run bitbake task function"""
+ if not func in self.executed:
+ deps = self.rdata.getVarFlag(func, 'deps')
+ if deps:
+ for taskdepfunc in deps:
+ self.exec_func(taskdepfunc, True)
+ if report:
+ logger.info('Executing %s...' % func)
+ fn = self.rdata.getVar('FILE', True)
+ localdata = bb.build._task_data(fn, func, self.rdata)
+ bb.build.exec_func(func, localdata)
+ self.executed.append(func)
+
def _extract_source(srctree, keep_temp, devbranch, d):
"""Extract sources of a recipe"""
@@ -270,28 +296,12 @@ def _extract_source(srctree, keep_temp, devbranch, d):
# We don't want to move the source to STAGING_KERNEL_DIR here
crd.setVar('STAGING_KERNEL_DIR', '${S}')
- # FIXME: This is very awkward. Unfortunately it's not currently easy to properly
- # execute tasks outside of bitbake itself, until then this has to suffice if we
- # are to handle e.g. linux-yocto's extra tasks
- executed = []
- def exec_task_func(func, report):
- """Run specific bitbake task for a recipe"""
- if not func in executed:
- deps = crd.getVarFlag(func, 'deps')
- if deps:
- for taskdepfunc in deps:
- exec_task_func(taskdepfunc, True)
- if report:
- logger.info('Executing %s...' % func)
- fn = d.getVar('FILE', True)
- localdata = bb.build._task_data(fn, func, crd)
- bb.build.exec_func(func, localdata)
- executed.append(func)
+ task_executor = BbTaskExecutor(crd)
logger.info('Fetching %s...' % pn)
- exec_task_func('do_fetch', False)
+ task_executor.exec_func('do_fetch', False)
logger.info('Unpacking...')
- exec_task_func('do_unpack', False)
+ task_executor.exec_func('do_unpack', False)
srcsubdir = crd.getVar('S', True)
if srcsubdir == workdir:
# Find non-patch sources that were "unpacked" to srctree directory
@@ -343,7 +353,7 @@ def _extract_source(srctree, keep_temp, devbranch, d):
crd.setVar('PATCHTOOL', 'git')
logger.info('Patching...')
- exec_task_func('do_patch', False)
+ task_executor.exec_func('do_patch', False)
bb.process.run('git tag -f devtool-patched', cwd=srcsubdir)