Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Commit

Permalink
bitbake: bitbake: implement --foreground command line option
Browse files Browse the repository at this point in the history
This option makes bitbake xmlrpc server to run in foreground.
It should be useful for debugging purposes.

(Bitbake rev: 9d4254be5853a546a346bf0d19919dcfba12773d)

Signed-off-by: Ed Bartosh <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
  • Loading branch information
Ed Bartosh authored and rpurdie committed Jul 21, 2016
1 parent 380b6e8 commit 4cba010
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bitbake/lib/bb/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def parseCommandLine(self, argv=sys.argv):
help="Run bitbake without a UI, only starting a server "
"(cooker) process.")

parser.add_option("", "--foreground", action="store_true",
help="Run bitbake server in foreground.")

parser.add_option("-B", "--bind", action="store", dest="bind", default=False,
help="The name/address for the bitbake server to bind to.")

Expand Down Expand Up @@ -357,7 +360,8 @@ def start_server(servermodule, configParams, configuration, features):
if isinstance(event, logging.LogRecord):
logger.handle(event)
raise
server.detach()
if not configParams.foreground:
server.detach()
cooker.lock.close()
return server

Expand Down Expand Up @@ -398,6 +402,10 @@ def bitbake_main(configParams, configuration):
("the BBSERVER environment variable" if "BBSERVER" in os.environ \
else "the '--remote-server' option"))

elif configParams.foreground:
raise BBMainException("FATAL: The '--foreground' option can only be used "
"with --server-only.\n")

if configParams.bind and configParams.servertype != "xmlrpc":
raise BBMainException("FATAL: If '-B' or '--bind' is defined, we must "
"set the servertype as 'xmlrpc'.\n")
Expand Down Expand Up @@ -495,6 +503,8 @@ def bitbake_main(configParams, configuration):
else:
print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host,
server.serverImpl.port))
if configParams.foreground:
server.serverImpl.serve_forever()
return 0

return 1

0 comments on commit 4cba010

Please sign in to comment.