diff options
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/bin/bitbake | 23 | ||||
-rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 21 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 3 |
3 files changed, 29 insertions, 18 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index fcfe0434ce..ab881c537d 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake | |||
@@ -332,26 +332,29 @@ def main(): | |||
332 | server = servermodule.BitBakeXMLRPCClient(configParams.observe_only) | 332 | server = servermodule.BitBakeXMLRPCClient(configParams.observe_only) |
333 | server.saveConnectionDetails(configParams.remote_server) | 333 | server.saveConnectionDetails(configParams.remote_server) |
334 | 334 | ||
335 | def _getServerConnection(server, featureset): | ||
336 | try: | ||
337 | server_connection = server.establishConnection(featureset) | ||
338 | except Exception as e: | ||
339 | bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e))) | ||
340 | return server_connection | ||
341 | |||
335 | if not configParams.server_only: | 342 | if not configParams.server_only: |
336 | if configParams.status_only: | 343 | if configParams.status_only: |
337 | try: | 344 | server_connection = _getServerConnection(server, featureset) |
338 | server_connection = server.establishConnection(featureset) | ||
339 | except: | ||
340 | sys.exit(1) | ||
341 | if not server_connection: | ||
342 | sys.exit(1) | ||
343 | server_connection.terminate() | 345 | server_connection.terminate() |
344 | sys.exit(0) | 346 | sys.exit(0) |
345 | 347 | ||
346 | # Setup a connection to the server (cooker) | 348 | # Setup a connection to the server (cooker) |
347 | server_connection = server.establishConnection(featureset) | 349 | try: |
348 | if not server_connection: | 350 | server_connection = server.establishConnection(featureset) |
351 | except: | ||
349 | if configParams.kill_server: | 352 | if configParams.kill_server: |
350 | bb.fatal("Server already killed") | 353 | bb.fatal("Server already offline") |
351 | configParams.bind = configParams.remote_server | 354 | configParams.bind = configParams.remote_server |
352 | start_server(servermodule, configParams, configuration, featureset) | 355 | start_server(servermodule, configParams, configuration, featureset) |
353 | bb.event.ui_queue = [] | 356 | bb.event.ui_queue = [] |
354 | server_connection = server.establishConnection(featureset) | 357 | server_connection = _getServerConnection(server, featureset) |
355 | 358 | ||
356 | # Restore the environment in case the UI needs it | 359 | # Restore the environment in case the UI needs it |
357 | for k in cleanedvars: | 360 | for k in cleanedvars: |
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py index 6fc5543a80..d6f4338ae5 100644 --- a/bitbake/lib/bb/server/xmlrpc.py +++ b/bitbake/lib/bb/server/xmlrpc.py | |||
@@ -80,7 +80,7 @@ class BBTransport(xmlrpclib.Transport): | |||
80 | 80 | ||
81 | def _create_server(host, port, timeout = 60): | 81 | def _create_server(host, port, timeout = 60): |
82 | t = BBTransport(timeout) | 82 | t = BBTransport(timeout) |
83 | s = xmlrpclib.Server("http://%s:%d/" % (host, port), transport=t, allow_none=True) | 83 | s = xmlrpclib.ServerProxy("http://%s:%d/" % (host, port), transport=t, allow_none=True) |
84 | return s, t | 84 | return s, t |
85 | 85 | ||
86 | class BitBakeServerCommands(): | 86 | class BitBakeServerCommands(): |
@@ -253,9 +253,13 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer): | |||
253 | socktimeout = self.socket.gettimeout() or nextsleep | 253 | socktimeout = self.socket.gettimeout() or nextsleep |
254 | socktimeout = min(socktimeout, nextsleep) | 254 | socktimeout = min(socktimeout, nextsleep) |
255 | # Mirror what BaseServer handle_request would do | 255 | # Mirror what BaseServer handle_request would do |
256 | fd_sets = select.select(fds, [], [], socktimeout) | 256 | try: |
257 | if fd_sets[0] and self in fd_sets[0]: | 257 | fd_sets = select.select(fds, [], [], socktimeout) |
258 | self._handle_request_noblock() | 258 | if fd_sets[0] and self in fd_sets[0]: |
259 | self._handle_request_noblock() | ||
260 | except IOError: | ||
261 | # we ignore interrupted calls | ||
262 | pass | ||
259 | 263 | ||
260 | # Tell idle functions we're exiting | 264 | # Tell idle functions we're exiting |
261 | for function, data in self._idlefuns.items(): | 265 | for function, data in self._idlefuns.items(): |
@@ -346,7 +350,8 @@ class BitBakeXMLRPCClient(BitBakeBaseServer): | |||
346 | [host, port] = self.remote.split(":") | 350 | [host, port] = self.remote.split(":") |
347 | port = int(port) | 351 | port = int(port) |
348 | except Exception as e: | 352 | except Exception as e: |
349 | bb.fatal("Failed to read remote definition (%s)" % str(e)) | 353 | bb.warn("Failed to read remote definition (%s)" % str(e)) |
354 | raise e | ||
350 | 355 | ||
351 | # We need our IP for the server connection. We get the IP | 356 | # We need our IP for the server connection. We get the IP |
352 | # by trying to connect with the server | 357 | # by trying to connect with the server |
@@ -356,13 +361,15 @@ class BitBakeXMLRPCClient(BitBakeBaseServer): | |||
356 | ip = s.getsockname()[0] | 361 | ip = s.getsockname()[0] |
357 | s.close() | 362 | s.close() |
358 | except Exception as e: | 363 | except Exception as e: |
359 | bb.fatal("Could not create socket for %s:%s (%s)" % (host, port, str(e))) | 364 | bb.warn("Could not create socket for %s:%s (%s)" % (host, port, str(e))) |
365 | raise e | ||
360 | try: | 366 | try: |
361 | self.serverImpl = XMLRPCProxyServer(host, port) | 367 | self.serverImpl = XMLRPCProxyServer(host, port) |
362 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset) | 368 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset) |
363 | return self.connection.connect() | 369 | return self.connection.connect() |
364 | except Exception as e: | 370 | except Exception as e: |
365 | bb.fatal("Could not connect to server at %s:%s (%s)" % (host, port, str(e))) | 371 | bb.warn("Could not connect to server at %s:%s (%s)" % (host, port, str(e))) |
372 | raise e | ||
366 | 373 | ||
367 | def endSession(self): | 374 | def endSession(self): |
368 | self.connection.removeClient() | 375 | self.connection.removeClient() |
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index 98658f68bf..eb760c00c3 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
@@ -47,7 +47,8 @@ class BBUIEventQueue: | |||
47 | self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port) | 47 | self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port) |
48 | 48 | ||
49 | if (self.EventHandle == None): | 49 | if (self.EventHandle == None): |
50 | bb.fatal("Could not register UI event handler") | 50 | bb.warn("Could not register UI event handler %s:%d" % (self.host, self.port)) |
51 | raise Exception("Could not register UI event handler") | ||
51 | 52 | ||
52 | self.server = server | 53 | self.server = server |
53 | 54 | ||