summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2019-04-29 16:11:58 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-30 12:05:24 +0100
commit82300691b045729dd35aec6878b4c199bea835fc (patch)
tree94b280709baacb840578e986cfd1e826e7749493 /bitbake
parent1165edbe508239d4fd21b49d7d52c7f4734ada5a (diff)
downloadpoky-82300691b045729dd35aec6878b4c199bea835fc.tar.gz
bitbake: BBHandler: Fix addtask and deltask
The following commands are not supported, but they were ignored silently, that may suprise users: * addtask task1 task2 task2 is ignored * addtask task1 before task2 before task3 Should be: addtask task1 before task2 task3 * addtask task1 after task2 after task3 Should be: addtask task1 after task2 task3 * deltask task1 task2 task2 is ignore This patch can check and warn for them. [YOCTO #13282] (Bitbake rev: 675689aa7cc7287efecf8ef775ca2059369167f1) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 9dba5f2334..314e8021f9 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -42,7 +42,7 @@ __func_start_regexp__ = re.compile(r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(
42__inherit_regexp__ = re.compile(r"inherit\s+(.+)" ) 42__inherit_regexp__ = re.compile(r"inherit\s+(.+)" )
43__export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" ) 43__export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" )
44__addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") 44__addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*")
45__deltask_regexp__ = re.compile(r"deltask\s+(?P<func>\w+)") 45__deltask_regexp__ = re.compile(r"deltask\s+(?P<func>\w+)(?P<ignores>.*)")
46__addhandler_regexp__ = re.compile(r"addhandler\s+(.+)" ) 46__addhandler_regexp__ = re.compile(r"addhandler\s+(.+)" )
47__def_regexp__ = re.compile(r"def\s+(\w+).*:" ) 47__def_regexp__ = re.compile(r"def\s+(\w+).*:" )
48__python_func_regexp__ = re.compile(r"(\s+.*)|(^$)|(^#)" ) 48__python_func_regexp__ = re.compile(r"(\s+.*)|(^$)|(^#)" )
@@ -236,11 +236,27 @@ def feeder(lineno, s, fn, root, statements, eof=False):
236 236
237 m = __addtask_regexp__.match(s) 237 m = __addtask_regexp__.match(s)
238 if m: 238 if m:
239 if len(m.group().split()) == 2:
240 # Check and warn for "addtask task1 task2"
241 m2 = re.match(r"addtask\s+(?P<func>\w+)(?P<ignores>.*)", s)
242 if m2 and m2.group('ignores'):
243 logger.warning('addtask ignored: "%s"' % m2.group('ignores'))
244
245 # Check and warn for "addtask task1 before task2 before task3", the
246 # similar to "after"
247 taskexpression = s.split()
248 for word in ('before', 'after'):
249 if taskexpression.count(word) > 1:
250 logger.warning("addtask contained multiple '%s' keywords, only one is supported" % word)
251
239 ast.handleAddTask(statements, fn, lineno, m) 252 ast.handleAddTask(statements, fn, lineno, m)
240 return 253 return
241 254
242 m = __deltask_regexp__.match(s) 255 m = __deltask_regexp__.match(s)
243 if m: 256 if m:
257 # Check and warn "for deltask task1 task2"
258 if m.group('ignores'):
259 logger.warning('deltask ignored: "%s"' % m.group('ignores'))
244 ast.handleDelTask(statements, fn, lineno, m) 260 ast.handleDelTask(statements, fn, lineno, m)
245 return 261 return
246 262