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/server/process.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/server/process.py')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 99a6bf55cc..e2cec49b74 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -37,8 +37,9 @@ from . import BitBakeBaseServer, BitBakeBaseServerConnection, BaseImplServer | |||
37 | logger = logging.getLogger('BitBake') | 37 | logger = logging.getLogger('BitBake') |
38 | 38 | ||
39 | class ServerCommunicator(): | 39 | class ServerCommunicator(): |
40 | def __init__(self, connection): | 40 | def __init__(self, connection, event_handle): |
41 | self.connection = connection | 41 | self.connection = connection |
42 | self.event_handle = event_handle | ||
42 | 43 | ||
43 | def runCommand(self, command): | 44 | def runCommand(self, command): |
44 | # @todo try/except | 45 | # @todo try/except |
@@ -54,6 +55,8 @@ class ServerCommunicator(): | |||
54 | except KeyboardInterrupt: | 55 | except KeyboardInterrupt: |
55 | pass | 56 | pass |
56 | 57 | ||
58 | def getEventHandle(self): | ||
59 | return self.event_handle.value | ||
57 | 60 | ||
58 | class EventAdapter(): | 61 | class EventAdapter(): |
59 | """ | 62 | """ |
@@ -84,11 +87,12 @@ class ProcessServer(Process, BaseImplServer): | |||
84 | 87 | ||
85 | self.keep_running = Event() | 88 | self.keep_running = Event() |
86 | self.keep_running.set() | 89 | self.keep_running.set() |
90 | self.event_handle = multiprocessing.Value("i") | ||
87 | 91 | ||
88 | def run(self): | 92 | def run(self): |
89 | for event in bb.event.ui_queue: | 93 | for event in bb.event.ui_queue: |
90 | self.event_queue.put(event) | 94 | self.event_queue.put(event) |
91 | self.event_handle = bb.event.register_UIHhandler(self) | 95 | self.event_handle.value = bb.event.register_UIHhandler(self) |
92 | bb.cooker.server_main(self.cooker, self.main) | 96 | bb.cooker.server_main(self.cooker, self.main) |
93 | 97 | ||
94 | def main(self): | 98 | def main(self): |
@@ -106,7 +110,7 @@ class ProcessServer(Process, BaseImplServer): | |||
106 | logger.exception('Running command %s', command) | 110 | logger.exception('Running command %s', command) |
107 | 111 | ||
108 | self.event_queue.close() | 112 | self.event_queue.close() |
109 | bb.event.unregister_UIHhandler(self.event_handle) | 113 | bb.event.unregister_UIHhandler(self.event_handle.value) |
110 | self.command_channel.close() | 114 | self.command_channel.close() |
111 | self.cooker.stop() | 115 | self.cooker.stop() |
112 | self.idle_commands(.1) | 116 | self.idle_commands(.1) |
@@ -147,7 +151,7 @@ class BitBakeProcessServerConnection(BitBakeBaseServerConnection): | |||
147 | self.procserver = serverImpl | 151 | self.procserver = serverImpl |
148 | self.ui_channel = ui_channel | 152 | self.ui_channel = ui_channel |
149 | self.event_queue = event_queue | 153 | self.event_queue = event_queue |
150 | self.connection = ServerCommunicator(self.ui_channel) | 154 | self.connection = ServerCommunicator(self.ui_channel, self.procserver.event_handle) |
151 | self.events = self.event_queue | 155 | self.events = self.event_queue |
152 | 156 | ||
153 | def terminate(self): | 157 | def terminate(self): |