diff options
Diffstat (limited to 'bitbake/lib/bb/server/xmlrpc.py')
| -rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py index 8326623520..389327a60f 100644 --- a/bitbake/lib/bb/server/xmlrpc.py +++ b/bitbake/lib/bb/server/xmlrpc.py | |||
| @@ -89,12 +89,23 @@ class BitBakeServerCommands(): | |||
| 89 | self.server = server | 89 | self.server = server |
| 90 | self.has_client = False | 90 | self.has_client = False |
| 91 | 91 | ||
| 92 | def registerEventHandler(self, host, port): | 92 | def registerEventHandler(self, host, port, featureset = []): |
| 93 | """ | 93 | """ |
| 94 | Register a remote UI Event Handler | 94 | Register a remote UI Event Handler |
| 95 | """ | 95 | """ |
| 96 | s, t = _create_server(host, port) | 96 | s, t = _create_server(host, port) |
| 97 | 97 | ||
| 98 | # we don't allow connections if the cooker is running | ||
| 99 | if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]): | ||
| 100 | return None | ||
| 101 | |||
| 102 | original_featureset = list(self.cooker.featureset) | ||
| 103 | for f in featureset: | ||
| 104 | self.cooker.featureset.setFeature(f) | ||
| 105 | |||
| 106 | if (original_featureset != list(self.cooker.featureset)): | ||
| 107 | self.cooker.reset() | ||
| 108 | |||
| 98 | self.event_handle = bb.event.register_UIHhandler(s) | 109 | self.event_handle = bb.event.register_UIHhandler(s) |
| 99 | return self.event_handle | 110 | return self.event_handle |
| 100 | 111 | ||
| @@ -263,11 +274,12 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer): | |||
| 263 | self.connection_token = token | 274 | self.connection_token = token |
| 264 | 275 | ||
| 265 | class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection): | 276 | class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection): |
| 266 | def __init__(self, serverImpl, clientinfo=("localhost", 0), observer_only = False): | 277 | def __init__(self, serverImpl, clientinfo=("localhost", 0), observer_only = False, featureset = []): |
| 267 | self.connection, self.transport = _create_server(serverImpl.host, serverImpl.port) | 278 | self.connection, self.transport = _create_server(serverImpl.host, serverImpl.port) |
| 268 | self.clientinfo = clientinfo | 279 | self.clientinfo = clientinfo |
| 269 | self.serverImpl = serverImpl | 280 | self.serverImpl = serverImpl |
| 270 | self.observer_only = observer_only | 281 | self.observer_only = observer_only |
| 282 | self.featureset = featureset | ||
| 271 | 283 | ||
| 272 | def connect(self): | 284 | def connect(self): |
| 273 | if not self.observer_only: | 285 | if not self.observer_only: |
| @@ -277,7 +289,8 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection): | |||
| 277 | if token is None: | 289 | if token is None: |
| 278 | return None | 290 | return None |
| 279 | self.transport.set_connection_token(token) | 291 | self.transport.set_connection_token(token) |
| 280 | self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo) | 292 | |
| 293 | self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo, self.featureset) | ||
| 281 | for event in bb.event.ui_queue: | 294 | for event in bb.event.ui_queue: |
| 282 | self.events.queue_event(event) | 295 | self.events.queue_event(event) |
| 283 | return self | 296 | return self |
| @@ -301,14 +314,15 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection): | |||
| 301 | 314 | ||
| 302 | class BitBakeServer(BitBakeBaseServer): | 315 | class BitBakeServer(BitBakeBaseServer): |
| 303 | def initServer(self, interface = ("localhost", 0)): | 316 | def initServer(self, interface = ("localhost", 0)): |
| 317 | self.interface = interface | ||
| 304 | self.serverImpl = XMLRPCServer(interface) | 318 | self.serverImpl = XMLRPCServer(interface) |
| 305 | 319 | ||
| 306 | def detach(self): | 320 | def detach(self): |
| 307 | daemonize.createDaemon(self.serverImpl.serve_forever, "bitbake-cookerdaemon.log") | 321 | daemonize.createDaemon(self.serverImpl.serve_forever, "bitbake-cookerdaemon.log") |
| 308 | del self.cooker | 322 | del self.cooker |
| 309 | 323 | ||
| 310 | def establishConnection(self): | 324 | def establishConnection(self, featureset): |
| 311 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl) | 325 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, self.interface, False, featureset) |
| 312 | return self.connection.connect() | 326 | return self.connection.connect() |
| 313 | 327 | ||
| 314 | def set_connection_token(self, token): | 328 | def set_connection_token(self, token): |
| @@ -318,12 +332,13 @@ class BitBakeXMLRPCClient(BitBakeBaseServer): | |||
| 318 | 332 | ||
| 319 | def __init__(self, observer_only = False): | 333 | def __init__(self, observer_only = False): |
| 320 | self.observer_only = observer_only | 334 | self.observer_only = observer_only |
| 335 | # if we need extra caches, just tell the server to load them all | ||
| 321 | pass | 336 | pass |
| 322 | 337 | ||
| 323 | def saveConnectionDetails(self, remote): | 338 | def saveConnectionDetails(self, remote): |
| 324 | self.remote = remote | 339 | self.remote = remote |
| 325 | 340 | ||
| 326 | def establishConnection(self): | 341 | def establishConnection(self, featureset): |
| 327 | # The format of "remote" must be "server:port" | 342 | # The format of "remote" must be "server:port" |
| 328 | try: | 343 | try: |
| 329 | [host, port] = self.remote.split(":") | 344 | [host, port] = self.remote.split(":") |
| @@ -340,7 +355,7 @@ class BitBakeXMLRPCClient(BitBakeBaseServer): | |||
| 340 | except: | 355 | except: |
| 341 | return None | 356 | return None |
| 342 | self.serverImpl = XMLRPCProxyServer(host, port) | 357 | self.serverImpl = XMLRPCProxyServer(host, port) |
| 343 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only) | 358 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset) |
| 344 | return self.connection.connect() | 359 | return self.connection.connect() |
| 345 | 360 | ||
| 346 | def endSession(self): | 361 | def endSession(self): |
