diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-07-01 11:09:09 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-07-21 16:57:43 +0100 |
commit | acce65abb98529be15748892480d4c24396556f2 (patch) | |
tree | 2536b5509c6004dc6fce2bc9c100af23598738ca /bitbake/lib/bb/parse | |
parent | 0aff94023f931a84d21069d92522e0f5338f09a4 (diff) | |
download | poky-acce65abb98529be15748892480d4c24396556f2.tar.gz |
bitbake: build: Allow deltask to take multiple tasknames
deltask currently supports only one task to delete but it would be useful
if it could support a variable which gets expanded to allow flexibility
in the metadata.
This is simple to support in bitbake and is how other directives such
as inherit operate so adjust the parser/code to handle that. It means
that syntax like:
EXTRA_NOPACKAGE_DELTASKS = ""
deltask ${EXTRA_NOPACKAGE_DELTASKS}
is now allowed.
(Bitbake rev: 883d926120833c85a16dcf60425dd7af7699046a)
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 | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 5 |
2 files changed, 7 insertions, 8 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 785aa974eb..0714296af2 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -244,12 +244,14 @@ class AddTaskNode(AstNode): | |||
244 | bb.build.addtask(self.func, self.before, self.after, data) | 244 | bb.build.addtask(self.func, self.before, self.after, data) |
245 | 245 | ||
246 | class DelTaskNode(AstNode): | 246 | class DelTaskNode(AstNode): |
247 | def __init__(self, filename, lineno, func): | 247 | def __init__(self, filename, lineno, tasks): |
248 | AstNode.__init__(self, filename, lineno) | 248 | AstNode.__init__(self, filename, lineno) |
249 | self.func = func | 249 | self.tasks = tasks |
250 | 250 | ||
251 | def eval(self, data): | 251 | def eval(self, data): |
252 | bb.build.deltask(self.func, data) | 252 | tasks = data.expand(self.tasks).split() |
253 | for task in tasks: | ||
254 | bb.build.deltask(task, data) | ||
253 | 255 | ||
254 | class BBHandlerNode(AstNode): | 256 | class BBHandlerNode(AstNode): |
255 | def __init__(self, filename, lineno, fns): | 257 | def __init__(self, filename, lineno, fns): |
@@ -305,7 +307,7 @@ def handleAddTask(statements, filename, lineno, m): | |||
305 | statements.append(AddTaskNode(filename, lineno, func, before, after)) | 307 | statements.append(AddTaskNode(filename, lineno, func, before, after)) |
306 | 308 | ||
307 | def handleDelTask(statements, filename, lineno, m): | 309 | def handleDelTask(statements, filename, lineno, m): |
308 | func = m.group("func") | 310 | func = m.group(1) |
309 | if func is None: | 311 | if func is None: |
310 | return | 312 | return |
311 | 313 | ||
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 6e216effb8..215f940b60 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
@@ -26,7 +26,7 @@ __func_start_regexp__ = re.compile(r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*( | |||
26 | __inherit_regexp__ = re.compile(r"inherit\s+(.+)" ) | 26 | __inherit_regexp__ = re.compile(r"inherit\s+(.+)" ) |
27 | __export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" ) | 27 | __export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" ) |
28 | __addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") | 28 | __addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") |
29 | __deltask_regexp__ = re.compile(r"deltask\s+(?P<func>\w+)(?P<ignores>.*)") | 29 | __deltask_regexp__ = re.compile(r"deltask\s+(.+)") |
30 | __addhandler_regexp__ = re.compile(r"addhandler\s+(.+)" ) | 30 | __addhandler_regexp__ = re.compile(r"addhandler\s+(.+)" ) |
31 | __def_regexp__ = re.compile(r"def\s+(\w+).*:" ) | 31 | __def_regexp__ = re.compile(r"def\s+(\w+).*:" ) |
32 | __python_func_regexp__ = re.compile(r"(\s+.*)|(^$)|(^#)" ) | 32 | __python_func_regexp__ = re.compile(r"(\s+.*)|(^$)|(^#)" ) |
@@ -238,9 +238,6 @@ def feeder(lineno, s, fn, root, statements, eof=False): | |||
238 | 238 | ||
239 | m = __deltask_regexp__.match(s) | 239 | m = __deltask_regexp__.match(s) |
240 | if m: | 240 | if m: |
241 | # Check and warn "for deltask task1 task2" | ||
242 | if m.group('ignores'): | ||
243 | logger.warning('deltask ignored: "%s"' % m.group('ignores')) | ||
244 | ast.handleDelTask(statements, fn, lineno, m) | 241 | ast.handleDelTask(statements, fn, lineno, m) |
245 | return | 242 | return |
246 | 243 | ||