diff options
Diffstat (limited to 'bitbake/bin/bitbake')
-rwxr-xr-x | bitbake/bin/bitbake | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index ab881c537d..f120baccf0 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake | |||
@@ -301,6 +301,9 @@ def main(): | |||
301 | if configParams.observe_only and (not configParams.remote_server or configParams.bind): | 301 | if configParams.observe_only and (not configParams.remote_server or configParams.bind): |
302 | sys.exit("FATAL: '--observe-only' can only be used by UI clients connecting to a server.\n") | 302 | sys.exit("FATAL: '--observe-only' can only be used by UI clients connecting to a server.\n") |
303 | 303 | ||
304 | if configParams.kill_server and not configParams.remote_server: | ||
305 | sys.exit("FATAL: '--kill-server' can only be used to terminate a remote server") | ||
306 | |||
304 | if "BBDEBUG" in os.environ: | 307 | if "BBDEBUG" in os.environ: |
305 | level = int(os.environ["BBDEBUG"]) | 308 | level = int(os.environ["BBDEBUG"]) |
306 | if level > configuration.debug: | 309 | if level > configuration.debug: |
@@ -332,29 +335,14 @@ def main(): | |||
332 | server = servermodule.BitBakeXMLRPCClient(configParams.observe_only) | 335 | server = servermodule.BitBakeXMLRPCClient(configParams.observe_only) |
333 | server.saveConnectionDetails(configParams.remote_server) | 336 | server.saveConnectionDetails(configParams.remote_server) |
334 | 337 | ||
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 | 338 | ||
342 | if not configParams.server_only: | 339 | if not configParams.server_only: |
343 | if configParams.status_only: | ||
344 | server_connection = _getServerConnection(server, featureset) | ||
345 | server_connection.terminate() | ||
346 | sys.exit(0) | ||
347 | |||
348 | # Setup a connection to the server (cooker) | ||
349 | try: | 340 | try: |
350 | server_connection = server.establishConnection(featureset) | 341 | server_connection = server.establishConnection(featureset) |
351 | except: | 342 | except Exception as e: |
352 | if configParams.kill_server: | 343 | if configParams.kill_server: |
353 | bb.fatal("Server already offline") | 344 | sys.exit(0) |
354 | configParams.bind = configParams.remote_server | 345 | bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e))) |
355 | start_server(servermodule, configParams, configuration, featureset) | ||
356 | bb.event.ui_queue = [] | ||
357 | server_connection = _getServerConnection(server, featureset) | ||
358 | 346 | ||
359 | # Restore the environment in case the UI needs it | 347 | # Restore the environment in case the UI needs it |
360 | for k in cleanedvars: | 348 | for k in cleanedvars: |
@@ -362,6 +350,16 @@ def main(): | |||
362 | 350 | ||
363 | logger.removeHandler(handler) | 351 | logger.removeHandler(handler) |
364 | 352 | ||
353 | |||
354 | if configParams.status_only: | ||
355 | server_connection.terminate() | ||
356 | sys.exit(0) | ||
357 | |||
358 | if configParams.kill_server: | ||
359 | server_connection.connection.terminateServer() | ||
360 | bb.event.ui_queue = [] | ||
361 | sys.exit(0) | ||
362 | |||
365 | try: | 363 | try: |
366 | return ui_module.main(server_connection.connection, server_connection.events, configParams) | 364 | return ui_module.main(server_connection.connection, server_connection.events, configParams) |
367 | finally: | 365 | finally: |