aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/taskdata.py
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-11-14 10:39:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-23 10:59:49 +0000
commit063d255fdcb3f79b2d1b0badedc80384b295a3f5 (patch)
treecfc8c11e3c6668e0e06f372b87fca1c6dab88913 /lib/bb/taskdata.py
parent3511d464f3a9d8b4334cda384b35016de69ce49e (diff)
downloadbitbake-063d255fdcb3f79b2d1b0badedc80384b295a3f5.tar.gz
taskdata.py: improve handling of depends/rdepends
Error handling only caught the cause where a dependency did not have any colon, but ignored the case where more than one was given. Now "pn:task:garbage" will raise an error instead of ignoring ":garbage". The error message had a misplaced line break (?) with the full stop on the next line. Indenting the explanation with a space might have been intended and is kept. split() was called three times instead of just once. Instead of improving the two instances of the code (one for 'depends', one for 'rdepends'), the common code is now in a helper function. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/taskdata.py')
-rw-r--r--lib/bb/taskdata.py33
1 files changed, 15 insertions, 18 deletions
diff --git a/lib/bb/taskdata.py b/lib/bb/taskdata.py
index d8bdbcabf..1f3b24c84 100644
--- a/lib/bb/taskdata.py
+++ b/lib/bb/taskdata.py
@@ -89,6 +89,19 @@ class TaskData:
self.add_extra_deps(fn, dataCache)
+ # Common code for dep_name/depends = 'depends'/idepends and 'rdepends'/irdepends
+ def handle_deps(task, dep_name, depends, seen):
+ if dep_name in task_deps and task in task_deps[dep_name]:
+ ids = []
+ for dep in task_deps[dep_name][task].split():
+ if dep:
+ parts = dep.split(":")
+ if len(parts) != 2:
+ bb.msg.fatal("TaskData", "Error for %s, dependency %s does not contain exactly one ':' character.\n Task '%s' should be specified in the form 'packagename:task'" % (fn, dep, dep_name))
+ ids.append((parts[0], parts[1]))
+ seen(parts[0])
+ depends.extend(ids)
+
for task in task_deps['tasks']:
tid = "%s:%s" % (fn, task)
@@ -105,24 +118,8 @@ class TaskData:
self.taskentries[tid].tdepends.extend(parentids)
# Touch all intertask dependencies
- if 'depends' in task_deps and task in task_deps['depends']:
- ids = []
- for dep in task_deps['depends'][task].split():
- if dep:
- if ":" not in dep:
- bb.msg.fatal("TaskData", "Error for %s, dependency %s does not contain ':' character\n. Task 'depends' should be specified in the form 'packagename:task'" % (fn, dep))
- ids.append(((dep.split(":")[0]), dep.split(":")[1]))
- self.seen_build_target(dep.split(":")[0])
- self.taskentries[tid].idepends.extend(ids)
- if 'rdepends' in task_deps and task in task_deps['rdepends']:
- ids = []
- for dep in task_deps['rdepends'][task].split():
- if dep:
- if ":" not in dep:
- bb.msg.fatal("TaskData", "Error for %s, dependency %s does not contain ':' character\n. Task 'rdepends' should be specified in the form 'packagename:task'" % (fn, dep))
- ids.append(((dep.split(":")[0]), dep.split(":")[1]))
- self.seen_run_target(dep.split(":")[0])
- self.taskentries[tid].irdepends.extend(ids)
+ handle_deps(task, 'depends', self.taskentries[tid].idepends, self.seen_build_target)
+ handle_deps(task, 'rdepends', self.taskentries[tid].irdepends, self.seen_run_target)
# Work out build dependencies
if not fn in self.depids: