diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-18 10:44:30 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-18 17:08:07 +0000 |
commit | 8a82a3835cb5b38812da720914d5f47a7cd443e8 (patch) | |
tree | 4f3a44bba1744d5f2a1bc33d4955f6e8e77c6fb6 /bitbake/lib/bb/parse | |
parent | 0f2041142e2513ee284e29f1b88e3767c2522f90 (diff) | |
download | ast2050-yocto-poky-8a82a3835cb5b38812da720914d5f47a7cd443e8.zip ast2050-yocto-poky-8a82a3835cb5b38812da720914d5f47a7cd443e8.tar.gz |
bitbake: ast/BBHandler/build: Add support for removing tasks (deltask)
Back in the depths of time we did support task removal. In the pre
AST days it was nearly impossible to continue supporting it, it wasn't
used so it was dropped. With the modern codebase we can easily now support
deltask and it would be very useful within the metadata since it can
massively simplify dependency trees.
As an example, a core-image-sato had 47703 inter task dependencies before
this patch and a patch to native.bbclass, afterwards with the noexec tasks
deleted, we had 29883. Such a significant simplification is worthwhile
and justifies adding a deltask operation to the system.
(Bitbake rev: acecbde6fb70ff3c96deab3cdf819d8442e87ed4)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 25 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 6 |
2 files changed, 30 insertions, 1 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index d4b8b09..2036cd4 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -259,6 +259,21 @@ class AddTaskNode(AstNode): if var not in existing: data.setVarFlag(entry, "deps", [var] + existing) +class DelTaskNode(AstNode): + def __init__(self, filename, lineno, func): + AstNode.__init__(self, filename, lineno) + self.func = func + + def eval(self, data): + var = self.func + if self.func[:3] != "do_": + var = "do_" + self.func + + bbtasks = data.getVar('__BBDELTASKS') or [] + if not var in bbtasks: + bbtasks.append(var) + data.setVar('__BBDELTASKS', bbtasks) + class BBHandlerNode(AstNode): def __init__(self, filename, lineno, fns): AstNode.__init__(self, filename, lineno) @@ -309,6 +324,13 @@ def handleAddTask(statements, filename, lineno, m): statements.append(AddTaskNode(filename, lineno, func, before, after)) +def handleDelTask(statements, filename, lineno, m): + func = m.group("func") + if func is None: + return + + statements.append(DelTaskNode(filename, lineno, func)) + def handleBBHandlers(statements, filename, lineno, m): statements.append(BBHandlerNode(filename, lineno, m.group(1))) @@ -333,7 +355,8 @@ def finalize(fn, d, variant = None): bb.data.update_data(d) tasklist = d.getVar('__BBTASKS') or [] - bb.build.add_tasks(tasklist, d) + deltasklist = d.getVar('__BBDELTASKS') or [] + bb.build.add_tasks(tasklist, deltasklist, d) bb.parse.siggen.finalise(fn, d, variant) diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 7cba649..408890e 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -42,6 +42,7 @@ __func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)* __inherit_regexp__ = re.compile( r"inherit\s+(.+)" ) __export_func_regexp__ = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" ) __addtask_regexp__ = re.compile("addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") +__deltask_regexp__ = re.compile("deltask\s+(?P<func>\w+)") __addhandler_regexp__ = re.compile( r"addhandler\s+(.+)" ) __def_regexp__ = re.compile( r"def\s+(\w+).*:" ) __python_func_regexp__ = re.compile( r"(\s+.*)|(^$)" ) @@ -243,6 +244,11 @@ def feeder(lineno, s, fn, root, statements): ast.handleAddTask(statements, fn, lineno, m) return + m = __deltask_regexp__.match(s) + if m: + ast.handleDelTask(statements, fn, lineno, m) + return + m = __addhandler_regexp__.match(s) if m: ast.handleBBHandlers(statements, fn, lineno, m) |