diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-03 15:20:05 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-03 23:28:15 +0100 |
commit | d1d60a68c2de40c2984d5040d14251c1be121b0b (patch) | |
tree | 1cb9365730f6b1b43b03bf96d6e50d91dd6cfa26 | |
parent | 38dd27f7191da002a16c561be3790ce487045b01 (diff) | |
download | bitbake-d1d60a68c2de40c2984d5040d14251c1be121b0b.zip |
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>
-rw-r--r-- | lib/bb/event.py | 10 | ||||
-rw-r--r-- | lib/bb/server/process.py | 2 | ||||
-rw-r--r-- | lib/bb/server/xmlrpc.py | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py index 3f96bcab..366bc418 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() diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index 3198635e..f022b86c 100644 --- a/lib/bb/server/process.py +++ b/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/lib/bb/server/xmlrpc.py b/lib/bb/server/xmlrpc.py index f1a20672..b7647c19 100644 --- a/lib/bb/server/xmlrpc.py +++ b/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): |