* [PATCH V2 0/3] Fixes for addtask and deltask @ 2019-04-29 8:11 Robert Yang 2019-04-29 8:11 ` [PATCH V2 1/3] bitbake: BBHandler: Fix " Robert Yang ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Robert Yang @ 2019-04-29 8:11 UTC (permalink / raw) To: bitbake-devel * V2: - Fix RP's comments on V1 - Add testcase for addtask and deltask * V1: - Initial version The following changes since commit 244cbcce0ecc4691a9ddfb0a44dc487ff7af0670: utils/multiprocess_launch: Improve failing subprocess output (2019-04-26 10:09:08 +0100) are available in the git repository at: git://git.pokylinux.org/poky-contrib rbt/addtask http://git.pokylinux.org/cgit.cgi//log/?h=rbt/addtask Robert Yang (3): bitbake: BBHandler: Fix addtask and deltask bitbake: build.py: check dependendent task for addtask bitbake: tests/parse.py: Add testcase for addtask and deltask bitbake/lib/bb/build.py | 3 +++ bitbake/lib/bb/parse/parse_py/BBHandler.py | 18 +++++++++++++++++- bitbake/lib/bb/tests/parse.py | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2 1/3] bitbake: BBHandler: Fix addtask and deltask 2019-04-29 8:11 [PATCH V2 0/3] Fixes for addtask and deltask Robert Yang @ 2019-04-29 8:11 ` Robert Yang 2019-04-29 8:11 ` [PATCH V2 2/3] bitbake: build.py: check dependendent task for addtask Robert Yang 2019-04-29 8:12 ` [PATCH V2 3/3] bitbake: tests/parse.py: Add testcase for addtask and deltask Robert Yang 2 siblings, 0 replies; 4+ messages in thread From: Robert Yang @ 2019-04-29 8:11 UTC (permalink / raw) To: bitbake-devel 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] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> --- bitbake/lib/bb/parse/parse_py/BBHandler.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 9dba5f2..314e802 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*)*( __inherit_regexp__ = re.compile(r"inherit\s+(.+)" ) __export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" ) __addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") -__deltask_regexp__ = re.compile(r"deltask\s+(?P<func>\w+)") +__deltask_regexp__ = re.compile(r"deltask\s+(?P<func>\w+)(?P<ignores>.*)") __addhandler_regexp__ = re.compile(r"addhandler\s+(.+)" ) __def_regexp__ = re.compile(r"def\s+(\w+).*:" ) __python_func_regexp__ = re.compile(r"(\s+.*)|(^$)|(^#)" ) @@ -236,11 +236,27 @@ def feeder(lineno, s, fn, root, statements, eof=False): m = __addtask_regexp__.match(s) if m: + if len(m.group().split()) == 2: + # Check and warn for "addtask task1 task2" + m2 = re.match(r"addtask\s+(?P<func>\w+)(?P<ignores>.*)", s) + if m2 and m2.group('ignores'): + logger.warning('addtask ignored: "%s"' % m2.group('ignores')) + + # Check and warn for "addtask task1 before task2 before task3", the + # similar to "after" + taskexpression = s.split() + for word in ('before', 'after'): + if taskexpression.count(word) > 1: + logger.warning("addtask contained multiple '%s' keywords, only one is supported" % word) + ast.handleAddTask(statements, fn, lineno, m) return m = __deltask_regexp__.match(s) if m: + # Check and warn "for deltask task1 task2" + if m.group('ignores'): + logger.warning('deltask ignored: "%s"' % m.group('ignores')) ast.handleDelTask(statements, fn, lineno, m) return -- 2.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 2/3] bitbake: build.py: check dependendent task for addtask 2019-04-29 8:11 [PATCH V2 0/3] Fixes for addtask and deltask Robert Yang 2019-04-29 8:11 ` [PATCH V2 1/3] bitbake: BBHandler: Fix " Robert Yang @ 2019-04-29 8:11 ` Robert Yang 2019-04-29 8:12 ` [PATCH V2 3/3] bitbake: tests/parse.py: Add testcase for addtask and deltask Robert Yang 2 siblings, 0 replies; 4+ messages in thread From: Robert Yang @ 2019-04-29 8:11 UTC (permalink / raw) To: bitbake-devel The following command is incorrect, but was ignored silently, that may suprise users: addtask task after task_not_existed This patch can check and warn for it. It would be better to also check "before" tasks, but there is no easier way to do it. [YOCTO #13282] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> --- bitbake/lib/bb/build.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 7571421..a83de8d 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py @@ -815,6 +815,9 @@ def add_tasks(tasklist, d): task_deps['parents'][task] = [] if 'deps' in flags: for dep in flags['deps']: + # Check and warn for "addtask task after foo" while foo does not exist + if not dep in tasklist: + bb.warn('%s: dependent task %s does not exist' % (d.getVar('PN'), dep)) dep = d.expand(dep) task_deps['parents'][task].append(dep) -- 2.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 3/3] bitbake: tests/parse.py: Add testcase for addtask and deltask 2019-04-29 8:11 [PATCH V2 0/3] Fixes for addtask and deltask Robert Yang 2019-04-29 8:11 ` [PATCH V2 1/3] bitbake: BBHandler: Fix " Robert Yang 2019-04-29 8:11 ` [PATCH V2 2/3] bitbake: build.py: check dependendent task for addtask Robert Yang @ 2019-04-29 8:12 ` Robert Yang 2 siblings, 0 replies; 4+ messages in thread From: Robert Yang @ 2019-04-29 8:12 UTC (permalink / raw) To: bitbake-devel Signed-off-by: Robert Yang <liezhi.yang@windriver.com> --- bitbake/lib/bb/tests/parse.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index 1bc4740..4467d17 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -187,3 +187,21 @@ python () { self.assertEqual(d1.getVar("VAR_var"), "B") self.assertEqual(d2.getVar("VAR_var"), None) + addtask_deltask = """ +addtask do_patch after do_foo after do_unpack before do_configure before do_compile +addtask do_fetch do_patch + +deltask do_fetch do_patch +""" + def test_parse_addtask_deltask(self): + import sys + f = self.parsehelper(self.addtask_deltask) + d = bb.parse.handle(f.name, self.d)[''] + + stdout = sys.stdout.getvalue() + self.assertTrue("addtask contained multiple 'before' keywords" in stdout) + self.assertTrue("addtask contained multiple 'after' keywords" in stdout) + self.assertTrue('addtask ignored: " do_patch"' in stdout) + self.assertTrue('deltask ignored: " do_patch"' in stdout) + self.assertTrue('dependent task do_foo does not exist' in stdout) + -- 2.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-29 8:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-04-29 8:11 [PATCH V2 0/3] Fixes for addtask and deltask Robert Yang 2019-04-29 8:11 ` [PATCH V2 1/3] bitbake: BBHandler: Fix " Robert Yang 2019-04-29 8:11 ` [PATCH V2 2/3] bitbake: build.py: check dependendent task for addtask Robert Yang 2019-04-29 8:12 ` [PATCH V2 3/3] bitbake: tests/parse.py: Add testcase for addtask and deltask Robert Yang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.