summaryrefslogtreecommitdiffstats
path: root/lib/bb/event.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-03 15:20:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-03 23:28:15 +0100
commitd1d60a68c2de40c2984d5040d14251c1be121b0b (patch)
tree1cb9365730f6b1b43b03bf96d6e50d91dd6cfa26 /lib/bb/event.py
parent38dd27f7191da002a16c561be3790ce487045b01 (diff)
downloadbitbake-contrib-d1d60a68c2de40c2984d5040d14251c1be121b0b.tar.gz
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] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/event.py')
-rw-r--r--lib/bb/event.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 3f96bcab3..366bc4188 100644
--- a/lib/bb/event.py
+++ b/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()