summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-12-08 10:50:24 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-09 22:15:48 +0000
commitc1ef10afb66c83b116e36e0e01ea8a753579b914 (patch)
tree308142a8656b893430164d316e7f29a268b88c1f /bitbake/lib
parenteb0a6fc210565d1cd9cb5316635e481431ef54ef (diff)
downloadpoky-c1ef10afb66c83b116e36e0e01ea8a753579b914.tar.gz
bitbake: event: add a means of filtering events internally
When using external tinfoil-based utilities, it is useful to be able to turn off most of the event handlers; for example sstate_eventhandler doesn't like being sent events for any recipe which has been skipped. (Bitbake rev: 41236c28985a3b66b3737382a94e39dbf6480160) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/event.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 32df779786..9645476e59 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -67,6 +67,7 @@ _ui_logfilters = {}
67_ui_handler_seq = 0 67_ui_handler_seq = 0
68_event_handler_map = {} 68_event_handler_map = {}
69_catchall_handlers = {} 69_catchall_handlers = {}
70_eventfilter = None
70 71
71def execute_handler(name, handler, event, d): 72def execute_handler(name, handler, event, d):
72 event.data = d 73 event.data = d
@@ -94,6 +95,9 @@ def fire_class_handlers(event, d):
94 evt_hmap = _event_handler_map.get(eid, {}) 95 evt_hmap = _event_handler_map.get(eid, {})
95 for name, handler in _handlers.iteritems(): 96 for name, handler in _handlers.iteritems():
96 if name in _catchall_handlers or name in evt_hmap: 97 if name in _catchall_handlers or name in evt_hmap:
98 if _eventfilter:
99 if not _eventfilter(name, handler, event, d):
100 continue
97 execute_handler(name, handler, event, d) 101 execute_handler(name, handler, event, d)
98 102
99ui_queue = [] 103ui_queue = []
@@ -204,6 +208,10 @@ def remove(name, handler):
204 """Remove an Event handler""" 208 """Remove an Event handler"""
205 _handlers.pop(name) 209 _handlers.pop(name)
206 210
211def set_eventfilter(func):
212 global _eventfilter
213 _eventfilter = func
214
207def register_UIHhandler(handler): 215def register_UIHhandler(handler):
208 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 216 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1
209 _ui_handlers[_ui_handler_seq] = handler 217 _ui_handlers[_ui_handler_seq] = handler