diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-12-08 10:50:24 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-09 22:15:48 +0000 |
commit | c1ef10afb66c83b116e36e0e01ea8a753579b914 (patch) | |
tree | 308142a8656b893430164d316e7f29a268b88c1f /bitbake/lib/bb | |
parent | eb0a6fc210565d1cd9cb5316635e481431ef54ef (diff) | |
download | ast2050-yocto-poky-c1ef10afb66c83b116e36e0e01ea8a753579b914.zip ast2050-yocto-poky-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/bb')
-rw-r--r-- | bitbake/lib/bb/event.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 32df779..9645476 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -67,6 +67,7 @@ _ui_logfilters = {} _ui_handler_seq = 0 _event_handler_map = {} _catchall_handlers = {} +_eventfilter = None def execute_handler(name, handler, event, d): event.data = d @@ -94,6 +95,9 @@ def fire_class_handlers(event, d): evt_hmap = _event_handler_map.get(eid, {}) for name, handler in _handlers.iteritems(): if name in _catchall_handlers or name in evt_hmap: + if _eventfilter: + if not _eventfilter(name, handler, event, d): + continue execute_handler(name, handler, event, d) ui_queue = [] @@ -204,6 +208,10 @@ def remove(name, handler): """Remove an Event handler""" _handlers.pop(name) +def set_eventfilter(func): + global _eventfilter + _eventfilter = func + def register_UIHhandler(handler): bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 _ui_handlers[_ui_handler_seq] = handler |