diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2016-11-14 10:39:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-23 10:59:56 +0000 |
commit | 7bb38a3358c336b3013d39169f4bb460fb1cf8c8 (patch) | |
tree | 17d9279bf2fdd4fd9cbcd87e36d1d05a66f49aa5 | |
parent | d7f76363fbcaa2449a1989f49aff643f87141606 (diff) | |
download | poky-7bb38a3358c336b3013d39169f4bb460fb1cf8c8.tar.gz |
bitbake: 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.
(Bitbake rev: 063d255fdcb3f79b2d1b0badedc80384b295a3f5)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/taskdata.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index d8bdbcabf9..1f3b24c845 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/lib/bb/taskdata.py | |||
@@ -89,6 +89,19 @@ class TaskData: | |||
89 | 89 | ||
90 | self.add_extra_deps(fn, dataCache) | 90 | self.add_extra_deps(fn, dataCache) |
91 | 91 | ||
92 | # Common code for dep_name/depends = 'depends'/idepends and 'rdepends'/irdepends | ||
93 | def handle_deps(task, dep_name, depends, seen): | ||
94 | if dep_name in task_deps and task in task_deps[dep_name]: | ||
95 | ids = [] | ||
96 | for dep in task_deps[dep_name][task].split(): | ||
97 | if dep: | ||
98 | parts = dep.split(":") | ||
99 | if len(parts) != 2: | ||
100 | 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)) | ||
101 | ids.append((parts[0], parts[1])) | ||
102 | seen(parts[0]) | ||
103 | depends.extend(ids) | ||
104 | |||
92 | for task in task_deps['tasks']: | 105 | for task in task_deps['tasks']: |
93 | 106 | ||
94 | tid = "%s:%s" % (fn, task) | 107 | tid = "%s:%s" % (fn, task) |
@@ -105,24 +118,8 @@ class TaskData: | |||
105 | self.taskentries[tid].tdepends.extend(parentids) | 118 | self.taskentries[tid].tdepends.extend(parentids) |
106 | 119 | ||
107 | # Touch all intertask dependencies | 120 | # Touch all intertask dependencies |
108 | if 'depends' in task_deps and task in task_deps['depends']: | 121 | handle_deps(task, 'depends', self.taskentries[tid].idepends, self.seen_build_target) |
109 | ids = [] | 122 | handle_deps(task, 'rdepends', self.taskentries[tid].irdepends, self.seen_run_target) |
110 | for dep in task_deps['depends'][task].split(): | ||
111 | if dep: | ||
112 | if ":" not in dep: | ||
113 | 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)) | ||
114 | ids.append(((dep.split(":")[0]), dep.split(":")[1])) | ||
115 | self.seen_build_target(dep.split(":")[0]) | ||
116 | self.taskentries[tid].idepends.extend(ids) | ||
117 | if 'rdepends' in task_deps and task in task_deps['rdepends']: | ||
118 | ids = [] | ||
119 | for dep in task_deps['rdepends'][task].split(): | ||
120 | if dep: | ||
121 | if ":" not in dep: | ||
122 | 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)) | ||
123 | ids.append(((dep.split(":")[0]), dep.split(":")[1])) | ||
124 | self.seen_run_target(dep.split(":")[0]) | ||
125 | self.taskentries[tid].irdepends.extend(ids) | ||
126 | 123 | ||
127 | # Work out build dependencies | 124 | # Work out build dependencies |
128 | if not fn in self.depids: | 125 | if not fn in self.depids: |