All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH] hob: report event handler failures
Date: Wed, 19 Sep 2012 11:25:42 +0100	[thread overview]
Message-ID: <1348050342-5402-1-git-send-email-paul.eggleton@linux.intel.com> (raw)

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].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 35cbded..8fc1732 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):
                 targets.append(self.toolchain)
             self.runCommand(["buildTargets", targets, self.default_task])
 
+    def display_error(self):
+        self.clear_busy()
+        self.emit("command-failed", self.error_msg)
+        self.error_msg = ""
+        if self.building:
+            self.building = False
+
     def handle_event(self, event):
         if not event:
             return
@@ -178,8 +185,8 @@ class HobHandler(gobject.GObject):
         elif isinstance(event, logging.LogRecord):
             if event.levelno >= logging.ERROR:
                 formatter = bb.msg.BBLogFormatter()
-                formatter.format(event)
-                self.error_msg += event.message + '\n'
+                msg = formatter.format(event)
+                self.error_msg += msg + '\n'
 
         elif isinstance(event, bb.event.TargetsTreeGenerated):
             self.current_phase = "data generation"
@@ -211,11 +218,7 @@ class HobHandler(gobject.GObject):
             self.run_next_command()
         elif isinstance(event, bb.command.CommandFailed):
             self.commands_async = []
-            self.clear_busy()
-            self.emit("command-failed", self.error_msg)
-            self.error_msg = ""
-            if self.building:
-                self.building = False
+            self.display_error()
         elif isinstance(event, (bb.event.ParseStarted,
                  bb.event.CacheLoadStarted,
                  bb.event.TreeDataPreparationStarted,
@@ -245,6 +248,9 @@ class HobHandler(gobject.GObject):
             message["title"] = "Parsing recipes: "
             self.emit("parsing-completed", message)
 
+        if self.error_msg and not self.commands_async:
+            self.display_error()
+
         return
 
     def init_cooker(self):
-- 
1.7.9.5




             reply	other threads:[~2012-09-19 10:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 10:25 Paul Eggleton [this message]
2012-09-19 12:02 ` [PATCH] hob: report event handler failures Jason Wessel
2012-09-20 10:49 ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348050342-5402-1-git-send-email-paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.