Patchwork [bitbake-devel] lib/bb/event: improve handling of event queue on exit

login
register
mail settings
Submitter Paul Eggleton
Date Sept. 11, 2012, 9:37 a.m.
Message ID <1347356243-7920-1-git-send-email-paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/36263/
State New
Headers show

Comments

Paul Eggleton - Sept. 11, 2012, 9:37 a.m.
If BitBake exits before a UI handler (server) has been registered, we
print the event queue; if there are any errors or other non-debug
messages just print these and suppress the rest of the message queue.

This improves the output when sanity check failures occur with OE-Core
by avoiding printing a long stream of uninformative debug messages.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/event.py |   12 ++++++++++++
 1 file changed, 12 insertions(+)
Chris Larson - Sept. 12, 2012, 5:02 p.m.
On Tue, Sep 11, 2012 at 2:37 AM, Paul Eggleton
<paul.eggleton@linux.intel.com> wrote:
> If BitBake exits before a UI handler (server) has been registered, we
> print the event queue; if there are any errors or other non-debug
> messages just print these and suppress the rest of the message queue.
>
> This improves the output when sanity check failures occur with OE-Core
> by avoiding printing a long stream of uninformative debug messages.
>
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>

+1

This one is biting us, obscuring the useful sanity check messages.

Acked-by: Christopher Larson <chris_larson@mentor.com>
Richard Purdie - Sept. 14, 2012, 8:28 a.m.
On Tue, 2012-09-11 at 10:37 +0100, Paul Eggleton wrote:
> If BitBake exits before a UI handler (server) has been registered, we
> print the event queue; if there are any errors or other non-debug
> messages just print these and suppress the rest of the message queue.
> 
> This improves the output when sanity check failures occur with OE-Core
> by avoiding printing a long stream of uninformative debug messages.
> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
>  bitbake/lib/bb/event.py |   12 ++++++++++++
>  1 file changed, 12 insertions(+)

Merged to master, thanks.

Richard

Patch

diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index fa179d8..ab62d4d 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -104,6 +104,18 @@  def print_ui_queue():
         console = logging.StreamHandler(sys.stdout)
         console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s"))
         logger.handlers = [console]
+
+        # First check to see if we have any proper messages
+        msgprint = False
+        for event in ui_queue:
+            if isinstance(event, logging.LogRecord):
+                if event.levelno > logging.DEBUG:
+                    logger.handle(event)
+                    msgprint = True
+        if msgprint:
+            return
+
+        # Nope, so just print all of the messages we have (including debug messages)
         for event in ui_queue:
             if isinstance(event, logging.LogRecord):
                 logger.handle(event)