diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-23 16:16:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-26 11:29:46 +0100 |
commit | 69aab78dd830b0ad570cf9b7bfe2da8e8b793e23 (patch) | |
tree | 8c799233df8ef5f3e9129da4c54241acea2c65f9 /bitbake/lib/bb/event.py | |
parent | bfab986ccd59636d0b0e79309f020e55481b0567 (diff) | |
download | poky-69aab78dd830b0ad570cf9b7bfe2da8e8b793e23.tar.gz |
bitbake: bitbake: Add ui event handlers filtering
Add functionality to allow UIs to update and change the types of events they
recieve. To do this we need to add a new command and also need to be able
to obtain the current event hander ID. In the case of xmlrpc, this is
straightforward, in the case of the process server we need to save the result
in a multiprocessing.Value() so we can retrive it. An excplit command
was added to the server API to facilitate this.
The same function can also be used to mask or unmask specific log messages,
allowing the UI to optionally differ from the standard set of message
filtering.
Based upon work by Cristiana Voicu <cristiana.voicu@intel.com>
(Bitbake rev: ba5a6c88785d9889d4172ec79937ac2a5555327e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r-- | bitbake/lib/bb/event.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 8ffd2c3e18..1169cbfb2b 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -193,7 +193,7 @@ def register(name, handler, mask=[]): | |||
193 | else: | 193 | else: |
194 | _handlers[name] = handler | 194 | _handlers[name] = handler |
195 | 195 | ||
196 | if not mask: | 196 | if not mask or '*' in mask: |
197 | _catchall_handlers[name] = True | 197 | _catchall_handlers[name] = True |
198 | else: | 198 | else: |
199 | for m in mask: | 199 | for m in mask: |
@@ -225,7 +225,7 @@ class UIEventFilter(object): | |||
225 | self.update(None, level, debug_domains) | 225 | self.update(None, level, debug_domains) |
226 | 226 | ||
227 | def update(self, eventmask, level, debug_domains): | 227 | def update(self, eventmask, level, debug_domains): |
228 | self.eventmask = None | 228 | self.eventmask = eventmask |
229 | self.stdlevel = level | 229 | self.stdlevel = level |
230 | self.debug_domains = debug_domains | 230 | self.debug_domains = debug_domains |
231 | 231 | ||
@@ -236,9 +236,20 @@ class UIEventFilter(object): | |||
236 | if event.name in self.debug_domains and event.levelno >= self.debug_domains[event.name]: | 236 | if event.name in self.debug_domains and event.levelno >= self.debug_domains[event.name]: |
237 | return True | 237 | return True |
238 | return False | 238 | return False |
239 | # Implement other event masking here on self.eventmask | 239 | eid = str(event.__class__)[8:-2] |
240 | if eid not in self.eventmask: | ||
241 | return False | ||
240 | return True | 242 | return True |
241 | 243 | ||
244 | def set_UIHmask(handlerNum, level, debug_domains, mask): | ||
245 | if not handlerNum in _ui_handlers: | ||
246 | return False | ||
247 | if '*' in mask: | ||
248 | _ui_logfilters[handlerNum].update(None, level, debug_domains) | ||
249 | else: | ||
250 | _ui_logfilters[handlerNum].update(mask, level, debug_domains) | ||
251 | return True | ||
252 | |||
242 | def getName(e): | 253 | def getName(e): |
243 | """Returns the name of a class or class instance""" | 254 | """Returns the name of a class or class instance""" |
244 | if getattr(e, "__name__", None) == None: | 255 | if getattr(e, "__name__", None) == None: |