summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-18 22:01:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-21 08:41:11 +0100
commitdd71707d5a5a420a4406ce88164ac2a32cc04956 (patch)
treefd0dc4f3749c9a43d3157d16623ab3b3bcbc13ab /bitbake/lib/bb
parent201fe6ee427069eff60654a78722dfda987927bf (diff)
downloadpoky-dd71707d5a5a420a4406ce88164ac2a32cc04956.tar.gz
bitbake: event/command: Allow UI to request the UI eventhander ID
The UI may want to change its event mask however to do this, it needs the event handler's ID. Tweak the code to allow this to be stored and add a command to query it. Use the new command in the process server backend. (Bitbake rev: f8cf2cb58b80ce74f756a11a9773b6b0e78d51ee) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/command.py5
-rw-r--r--bitbake/lib/bb/event.py11
-rw-r--r--bitbake/lib/bb/server/process.py7
3 files changed, 19 insertions, 4 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 36891b923f..eb7c86f4fe 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -238,6 +238,11 @@ class CommandsSync:
238 return command.cooker.matchFile(fMatch) 238 return command.cooker.matchFile(fMatch)
239 matchFile.needconfig = False 239 matchFile.needconfig = False
240 240
241 def getUIHandlerNum(self, command, params):
242 return bb.event.get_uihandler()
243 getUIHandlerNum.needconfig = False
244 getUIHandlerNum.readonly = True
245
241 def setEventMask(self, command, params): 246 def setEventMask(self, command, params):
242 handlerNum = params[0] 247 handlerNum = params[0]
243 llevel = params[1] 248 llevel = params[1]
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index d5c5ef3544..92ee3e92d4 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -288,13 +288,13 @@ def set_eventfilter(func):
288 _eventfilter = func 288 _eventfilter = func
289 289
290def register_UIHhandler(handler, mainui=False): 290def register_UIHhandler(handler, mainui=False):
291 if mainui:
292 global _uiready
293 _uiready = True
294 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 291 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1
295 _ui_handlers[_ui_handler_seq] = handler 292 _ui_handlers[_ui_handler_seq] = handler
296 level, debug_domains = bb.msg.constructLogOptions() 293 level, debug_domains = bb.msg.constructLogOptions()
297 _ui_logfilters[_ui_handler_seq] = UIEventFilter(level, debug_domains) 294 _ui_logfilters[_ui_handler_seq] = UIEventFilter(level, debug_domains)
295 if mainui:
296 global _uiready
297 _uiready = _ui_handler_seq
298 return _ui_handler_seq 298 return _ui_handler_seq
299 299
300def unregister_UIHhandler(handlerNum, mainui=False): 300def unregister_UIHhandler(handlerNum, mainui=False):
@@ -305,6 +305,11 @@ def unregister_UIHhandler(handlerNum, mainui=False):
305 del _ui_handlers[handlerNum] 305 del _ui_handlers[handlerNum]
306 return 306 return
307 307
308def get_uihandler():
309 if _uiready is False:
310 return None
311 return _uiready
312
308# Class to allow filtering of events and specific filtering of LogRecords *before* we put them over the IPC 313# Class to allow filtering of events and specific filtering of LogRecords *before* we put them over the IPC
309class UIEventFilter(object): 314class UIEventFilter(object):
310 def __init__(self, level, debug_domains): 315 def __init__(self, level, debug_domains):
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index a8ba4681c6..cfcd76495c 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -63,7 +63,12 @@ class ServerCommunicator():
63 pass 63 pass
64 64
65 def getEventHandle(self): 65 def getEventHandle(self):
66 return self.event_handle.value 66 handle, error = self.runCommand(["getUIHandlerNum"])
67 if error:
68 logger.error("Unable to get UI Handler Number: %s" % error)
69 raise BaseException(error)
70
71 return handle
67 72
68class EventAdapter(): 73class EventAdapter():
69 """ 74 """