summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
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-04 16:23:56 +0100
commit4b9de767f02d504c619582e0d62c9acd3230e76e (patch)
tree70309fa949bda24c8a5f6ab59e70d335e315b72e /bitbake/lib
parent7c079463c96891f0dbf6d7744c0d6bfe7af1e0ca (diff)
downloadpoky-4b9de767f02d504c619582e0d62c9acd3230e76e.tar.gz
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/event.py10
-rw-r--r--bitbake/lib/bb/server/process.py2
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py2
3 files changed, 9 insertions, 5 deletions
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
69_event_handler_map = {} 69_event_handler_map = {}
70_catchall_handlers = {} 70_catchall_handlers = {}
71_eventfilter = None 71_eventfilter = None
72_uiready = False
72 73
73def execute_handler(name, handler, event, d): 74def execute_handler(name, handler, event, d):
74 event.data = d 75 event.data = d
@@ -113,7 +114,7 @@ def print_ui_queue():
113 """If we're exiting before a UI has been spawned, display any queued 114 """If we're exiting before a UI has been spawned, display any queued
114 LogRecords to the console.""" 115 LogRecords to the console."""
115 logger = logging.getLogger("BitBake") 116 logger = logging.getLogger("BitBake")
116 if not _ui_handlers: 117 if not _uiready:
117 from bb.msg import BBLogFormatter 118 from bb.msg import BBLogFormatter
118 console = logging.StreamHandler(sys.stdout) 119 console = logging.StreamHandler(sys.stdout)
119 console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s")) 120 console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s"))
@@ -135,7 +136,7 @@ def print_ui_queue():
135 logger.handle(event) 136 logger.handle(event)
136 137
137def fire_ui_handlers(event, d): 138def fire_ui_handlers(event, d):
138 if not _ui_handlers: 139 if not _uiready:
139 # No UI handlers registered yet, queue up the messages 140 # No UI handlers registered yet, queue up the messages
140 ui_queue.append(event) 141 ui_queue.append(event)
141 return 142 return
@@ -219,7 +220,10 @@ def set_eventfilter(func):
219 global _eventfilter 220 global _eventfilter
220 _eventfilter = func 221 _eventfilter = func
221 222
222def register_UIHhandler(handler): 223def register_UIHhandler(handler, mainui=False):
224 if mainui:
225 global _uiready
226 _uiready = True
223 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 227 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1
224 _ui_handlers[_ui_handler_seq] = handler 228 _ui_handlers[_ui_handler_seq] = handler
225 level, debug_domains = bb.msg.constructLogOptions() 229 level, debug_domains = bb.msg.constructLogOptions()
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 3198635e2f..f022b86c94 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -97,7 +97,7 @@ class ProcessServer(Process, BaseImplServer):
97 def run(self): 97 def run(self):
98 for event in bb.event.ui_queue: 98 for event in bb.event.ui_queue:
99 self.event_queue.put(event) 99 self.event_queue.put(event)
100 self.event_handle.value = bb.event.register_UIHhandler(self) 100 self.event_handle.value = bb.event.register_UIHhandler(self, True)
101 101
102 bb.cooker.server_main(self.cooker, self.main) 102 bb.cooker.server_main(self.cooker, self.main)
103 103
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index f1a2067246..b7647c198f 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -99,7 +99,7 @@ class BitBakeServerCommands():
99 if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]): 99 if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]):
100 return None 100 return None
101 101
102 self.event_handle = bb.event.register_UIHhandler(s) 102 self.event_handle = bb.event.register_UIHhandler(s, True)
103 return self.event_handle 103 return self.event_handle
104 104
105 def unregisterEventHandler(self, handlerNum): 105 def unregisterEventHandler(self, handlerNum):