diff options
author | Lee Chee Yang <chee.yang.lee@intel.com> | 2020-11-05 08:59:21 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-11-08 14:04:42 +0000 |
commit | 03f8c9d9f91ac9efe54e22e78575e4a248cfa62f (patch) | |
tree | ea49e1a3ce9780c63bc5fd336ceadcbefc56b122 | |
parent | bf0e7912c8a76eaeac12a4e1f523da8a10a8780d (diff) | |
download | poky-03f8c9d9f91ac9efe54e22e78575e4a248cfa62f.tar.gz |
bitbake: BBHandler: prompt error when task name contain expression
Task name contain expresion (eg, do_foo_remove_bar) can cause fatal error.
Check for naming before addtask. Prompt with understandable error message
when expression found in task name.
[YOCTO #8805]
(Bitbake rev: 5b4a5bb0960386f9c524c220e43a16e60e38964d)
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 215f940b60..8a520e3071 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
@@ -13,7 +13,7 @@ | |||
13 | # | 13 | # |
14 | 14 | ||
15 | import re, bb, os | 15 | import re, bb, os |
16 | import bb.build, bb.utils | 16 | import bb.build, bb.utils, bb.data_smart |
17 | 17 | ||
18 | from . import ConfHandler | 18 | from . import ConfHandler |
19 | from .. import resolve_file, ast, logger, ParseError | 19 | from .. import resolve_file, ast, logger, ParseError |
@@ -233,6 +233,10 @@ def feeder(lineno, s, fn, root, statements, eof=False): | |||
233 | if taskexpression.count(word) > 1: | 233 | if taskexpression.count(word) > 1: |
234 | logger.warning("addtask contained multiple '%s' keywords, only one is supported" % word) | 234 | logger.warning("addtask contained multiple '%s' keywords, only one is supported" % word) |
235 | 235 | ||
236 | # Check and warn for having task with exprssion as part of task name | ||
237 | for te in taskexpression: | ||
238 | if any( ( "%s_" % keyword ) in te for keyword in bb.data_smart.__setvar_keyword__ ): | ||
239 | raise ParseError("Task name '%s' contains a keyword which is not recommended/supported.\nPlease rename the task not to include the keyword.\n%s" % (te, ("\n".join(map(str, bb.data_smart.__setvar_keyword__)))), fn) | ||
236 | ast.handleAddTask(statements, fn, lineno, m) | 240 | ast.handleAddTask(statements, fn, lineno, m) |
237 | return | 241 | return |
238 | 242 | ||