From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] event/server: Add _uiready flag to handle missing error messages
Date: Thu, 03 Sep 2015 15:20:05 +0100 [thread overview]
Message-ID: <1441290005.24871.116.camel@linuxfoundation.org> (raw)
If you start and suspend a bitbake execution so the bitbake lock is held,
then try and run "bitbake -w '' X", you will see bitbake return an error exit
code but print no message about what happened at all.
The reason is that the -w option creates a "UI" which swallows the messages. The
code which handles this exit failure mode thinks a UI has printed the messages
and therefore doesn't do so.
This adds in an extra parameter to the UI registration code so that we
can figure out whether its a primary UI or not and base decisions on whether
to display information on that instead. This fixes the error shown above and
some bizarre failures on the Yocto Project Autobuilder.
[YOCTO #8239]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index da20fbf..059229e 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -69,6 +69,7 @@ _ui_handler_seq = 0
_event_handler_map = {}
_catchall_handlers = {}
_eventfilter = None
+_uiready = False
def execute_handler(name, handler, event, d):
event.data = d
@@ -113,7 +117,7 @@ def print_ui_queue():
"""If we're exiting before a UI has been spawned, display any queued
LogRecords to the console."""
logger = logging.getLogger("BitBake")
- if not _ui_handlers:
+ if not _uiready:
from bb.msg import BBLogFormatter
console = logging.StreamHandler(sys.stdout)
console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s"))
@@ -135,7 +139,7 @@ def print_ui_queue():
logger.handle(event)
def fire_ui_handlers(event, d):
- if not _ui_handlers:
+ if not _uiready:
# No UI handlers registered yet, queue up the messages
ui_queue.append(event)
return
@@ -219,7 +223,9 @@ def set_eventfilter(func):
global _eventfilter
_eventfilter = func
-def register_UIHhandler(handler):
+def register_UIHhandler(handler, mainui=False):
+ if mainui:
+ _uiready = True
bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1
_ui_handlers[_ui_handler_seq] = handler
level, debug_domains = bb.msg.constructLogOptions()
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 3198635..f022b86 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -97,7 +97,7 @@ class ProcessServer(Process, BaseImplServer):
def run(self):
for event in bb.event.ui_queue:
self.event_queue.put(event)
- self.event_handle.value = bb.event.register_UIHhandler(self)
+ self.event_handle.value = bb.event.register_UIHhandler(self, True)
bb.cooker.server_main(self.cooker, self.main)
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index f1a2067..b7647c1 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -99,7 +99,7 @@ class BitBakeServerCommands():
if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]):
return None
- self.event_handle = bb.event.register_UIHhandler(s)
+ self.event_handle = bb.event.register_UIHhandler(s, True)
return self.event_handle
def unregisterEventHandler(self, handlerNum):
next reply other threads:[~2015-09-03 14:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-03 14:20 Richard Purdie [this message]
2015-09-03 17:54 ` [PATCH] event/server: Add _uiready flag to handle missing error messages Christopher Larson
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=1441290005.24871.116.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--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.