@@ -932,9 +932,13 @@ def add_tasks(tasklist, d):
# don't assume holding a reference
d.setVar('_task_deps', task_deps)
+def ensure_task_prefix(name):
+ if name[:3] != "do_":
+ name = "do_" + name
+ return name
+
def addtask(task, before, after, d):
- if task[:3] != "do_":
- task = "do_" + task
+ task = ensure_task_prefix(task)
d.setVarFlag(task, "task", 1)
bbtasks = d.getVar('__BBTASKS', False) or []
@@ -946,19 +950,20 @@ def addtask(task, before, after, d):
if after is not None:
# set up deps for function
for entry in after.split():
+ entry = ensure_task_prefix(entry)
if entry not in existing:
existing.append(entry)
d.setVarFlag(task, "deps", existing)
if before is not None:
# set up things that depend on this func
for entry in before.split():
+ entry = ensure_task_prefix(entry)
existing = d.getVarFlag(entry, "deps", False) or []
if task not in existing:
d.setVarFlag(entry, "deps", [task] + existing)
def deltask(task, d):
- if task[:3] != "do_":
- task = "do_" + task
+ task = ensure_task_prefix(task)
bbtasks = d.getVar('__BBTASKS', False) or []
if task in bbtasks:
@@ -188,6 +188,9 @@ addtask do_mytask3
deltask do_mytask3# comment
deltask do_mytask4 # comment2
+# Ensure a missing task prefix on after works
+addtask do_mytask5 after mytask
+
MYVAR = "do_patch"
EMPTYVAR = ""
deltask do_fetch ${MYVAR} ${EMPTYVAR}
@@ -198,7 +201,8 @@ deltask ${EMPTYVAR}
f = self.parsehelper(self.addtask_deltask)
d = bb.parse.handle(f.name, self.d)['']
- self.assertEqual(['do_fetch2', 'do_patch2', 'do_myplaintask', 'do_mytask', 'do_mytask2'], d.getVar("__BBTASKS"))
+ self.assertEqual(['do_fetch2', 'do_patch2', 'do_myplaintask', 'do_mytask', 'do_mytask2', 'do_mytask5'], d.getVar("__BBTASKS"))
+ self.assertEqual(['do_mytask'], d.getVarFlag("do_mytask5", "deps"))
broken_multiline_comment = """
# First line of comment \\
"addtask do_XXX before YYY after ZZZ " where YYY or ZZZ is missing the "do_" prefix don't work as expected. Ajust the code so that it doesn't just silently do the wrong thing but works as expected. Expand a test case to cover this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/build.py | 13 +++++++++---- lib/bb/tests/parse.py | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-)