diff options
| -rwxr-xr-x | bitbake/bin/bitbake | 34 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/toasterui.py | 16 |
2 files changed, 28 insertions, 22 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: |
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 9a9fe6f2d8..c1696b2a31 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py | |||
| @@ -226,11 +226,19 @@ def main(server, eventHandler, params ): | |||
| 226 | 226 | ||
| 227 | buildinfohelper.update_build_information(event, errors, warnings, taskfailures) | 227 | buildinfohelper.update_build_information(event, errors, warnings, taskfailures) |
| 228 | 228 | ||
| 229 | |||
| 230 | brbe = server.runCommand(["getVariable", "TOASTER_BRBE"])[0] | ||
| 229 | # we start a new build info | 231 | # we start a new build info |
| 230 | errors = 0 | 232 | if brbe is not None: |
| 231 | warnings = 0 | 233 | print "we are under BuildEnvironment management - after the build, we exit" |
| 232 | taskfailures = [] | 234 | server.terminateServer() |
| 233 | buildinfohelper = BuildInfoHelper(server, build_history_enabled) | 235 | else: |
| 236 | print "prepared for new build" | ||
| 237 | errors = 0 | ||
| 238 | warnings = 0 | ||
| 239 | taskfailures = [] | ||
| 240 | buildinfohelper = BuildInfoHelper(server, build_history_enabled) | ||
| 241 | |||
| 234 | continue | 242 | continue |
| 235 | 243 | ||
| 236 | if isinstance(event, bb.event.MetadataEvent): | 244 | if isinstance(event, bb.event.MetadataEvent): |
