From 4b9de767f02d504c619582e0d62c9acd3230e76e Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 3 Sep 2015 15:20:05 +0100 Subject: bitbake: event/server: Add _uiready flag to handle missing error messages 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] (Bitbake rev: d1d60a68c2de40c2984d5040d14251c1be121b0b) Signed-off-by: Richard Purdie --- bitbake/lib/bb/event.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/bb/event.py') diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 3f96bcab32..366bc41884 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 +114,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 +136,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 +220,10 @@ def set_eventfilter(func): global _eventfilter _eventfilter = func -def register_UIHhandler(handler): +def register_UIHhandler(handler, mainui=False): + if mainui: + global _uiready + _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() -- cgit v1.2.3-54-g00ecf