summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/lib/bb/main.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py
index 1c32e9308d..849cade8ca 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -247,6 +247,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters):
247 help="Run bitbake without a UI, only starting a server " 247 help="Run bitbake without a UI, only starting a server "
248 "(cooker) process.") 248 "(cooker) process.")
249 249
250 parser.add_option("", "--foreground", action="store_true",
251 help="Run bitbake server in foreground.")
252
250 parser.add_option("-B", "--bind", action="store", dest="bind", default=False, 253 parser.add_option("-B", "--bind", action="store", dest="bind", default=False,
251 help="The name/address for the bitbake server to bind to.") 254 help="The name/address for the bitbake server to bind to.")
252 255
@@ -357,7 +360,8 @@ def start_server(servermodule, configParams, configuration, features):
357 if isinstance(event, logging.LogRecord): 360 if isinstance(event, logging.LogRecord):
358 logger.handle(event) 361 logger.handle(event)
359 raise 362 raise
360 server.detach() 363 if not configParams.foreground:
364 server.detach()
361 cooker.lock.close() 365 cooker.lock.close()
362 return server 366 return server
363 367
@@ -398,6 +402,10 @@ def bitbake_main(configParams, configuration):
398 ("the BBSERVER environment variable" if "BBSERVER" in os.environ \ 402 ("the BBSERVER environment variable" if "BBSERVER" in os.environ \
399 else "the '--remote-server' option")) 403 else "the '--remote-server' option"))
400 404
405 elif configParams.foreground:
406 raise BBMainException("FATAL: The '--foreground' option can only be used "
407 "with --server-only.\n")
408
401 if configParams.bind and configParams.servertype != "xmlrpc": 409 if configParams.bind and configParams.servertype != "xmlrpc":
402 raise BBMainException("FATAL: If '-B' or '--bind' is defined, we must " 410 raise BBMainException("FATAL: If '-B' or '--bind' is defined, we must "
403 "set the servertype as 'xmlrpc'.\n") 411 "set the servertype as 'xmlrpc'.\n")
@@ -495,6 +503,8 @@ def bitbake_main(configParams, configuration):
495 else: 503 else:
496 print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host, 504 print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host,
497 server.serverImpl.port)) 505 server.serverImpl.port))
506 if configParams.foreground:
507 server.serverImpl.serve_forever()
498 return 0 508 return 0
499 509
500 return 1 510 return 1