summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-09-19 11:25:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-20 11:48:39 +0100
commit14a04abb9b1a176a623d9f6f50ed62af67274170 (patch)
tree1a4e5a1a7233a180513e0d0cef92e49e598738ef
parent8d46be8a0d4e11750ba2471a5a9ecc363c325a62 (diff)
downloadpoky-14a04abb9b1a176a623d9f6f50ed62af67274170.tar.gz
bitbake: hob: report event handler failures
If an event handler failed we were not recieving an error message - parsing just "froze" at 99%. This is because we were expecting a CommandFailure event and this never happened in the case of RequestPackageInfo which is where the failure was occurring. This also required tweaking the error formatting slightly, taking the return value of the format function rather than the message property since the latter only seems to contain the first line without the traceback in the case of event handler failure. Other error cases were tested and their message formatting is unaffected by this change. Final part of the fix for [YOCTO #2651]. (Bitbake rev: 5bab81b124087d63d6eb62a861e1241714fcd483) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 35cbded97d..8fc1732a8e 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -156,6 +156,13 @@ class HobHandler(gobject.GObject):
156 targets.append(self.toolchain) 156 targets.append(self.toolchain)
157 self.runCommand(["buildTargets", targets, self.default_task]) 157 self.runCommand(["buildTargets", targets, self.default_task])
158 158
159 def display_error(self):
160 self.clear_busy()
161 self.emit("command-failed", self.error_msg)
162 self.error_msg = ""
163 if self.building:
164 self.building = False
165
159 def handle_event(self, event): 166 def handle_event(self, event):
160 if not event: 167 if not event:
161 return 168 return
@@ -178,8 +185,8 @@ class HobHandler(gobject.GObject):
178 elif isinstance(event, logging.LogRecord): 185 elif isinstance(event, logging.LogRecord):
179 if event.levelno >= logging.ERROR: 186 if event.levelno >= logging.ERROR:
180 formatter = bb.msg.BBLogFormatter() 187 formatter = bb.msg.BBLogFormatter()
181 formatter.format(event) 188 msg = formatter.format(event)
182 self.error_msg += event.message + '\n' 189 self.error_msg += msg + '\n'
183 190
184 elif isinstance(event, bb.event.TargetsTreeGenerated): 191 elif isinstance(event, bb.event.TargetsTreeGenerated):
185 self.current_phase = "data generation" 192 self.current_phase = "data generation"
@@ -211,11 +218,7 @@ class HobHandler(gobject.GObject):
211 self.run_next_command() 218 self.run_next_command()
212 elif isinstance(event, bb.command.CommandFailed): 219 elif isinstance(event, bb.command.CommandFailed):
213 self.commands_async = [] 220 self.commands_async = []
214 self.clear_busy() 221 self.display_error()
215 self.emit("command-failed", self.error_msg)
216 self.error_msg = ""
217 if self.building:
218 self.building = False
219 elif isinstance(event, (bb.event.ParseStarted, 222 elif isinstance(event, (bb.event.ParseStarted,
220 bb.event.CacheLoadStarted, 223 bb.event.CacheLoadStarted,
221 bb.event.TreeDataPreparationStarted, 224 bb.event.TreeDataPreparationStarted,
@@ -245,6 +248,9 @@ class HobHandler(gobject.GObject):
245 message["title"] = "Parsing recipes: " 248 message["title"] = "Parsing recipes: "
246 self.emit("parsing-completed", message) 249 self.emit("parsing-completed", message)
247 250
251 if self.error_msg and not self.commands_async:
252 self.display_error()
253
248 return 254 return
249 255
250 def init_cooker(self): 256 def init_cooker(self):