bitbake: add a new option "--server-only"
Create a new option "--server-only" for bitbake command, which allows bitbake runs as a server, and let frontend connect the server itself. "--server-only" should work with "-t xmlrpc", or bitbake will exit. bitbake --server-only -t xmlrpc will print out the server address and port information. (Bitbake rev: 2677254cf9792cee083605267570d93b425cc2db) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
eb2a8fe6c0
commit
ce9e6bad8f
|
@ -165,6 +165,9 @@ Default BBFILES are the .bb files in the current directory.""")
|
||||||
parser.add_option("", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not",
|
parser.add_option("", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not",
|
||||||
action = "store_true", dest = "revisions_changed", default = False)
|
action = "store_true", dest = "revisions_changed", default = False)
|
||||||
|
|
||||||
|
parser.add_option("", "--server-only", help = "Run bitbake without UI, the frontend can connect with bitbake server itself",
|
||||||
|
action = "store_true", dest = "server_only", default = False)
|
||||||
|
|
||||||
options, args = parser.parse_args(sys.argv)
|
options, args = parser.parse_args(sys.argv)
|
||||||
|
|
||||||
configuration = BBConfiguration(options)
|
configuration = BBConfiguration(options)
|
||||||
|
@ -186,6 +189,9 @@ Default BBFILES are the .bb files in the current directory.""")
|
||||||
sys.exit("FATAL: Invalid server type '%s' specified.\n"
|
sys.exit("FATAL: Invalid server type '%s' specified.\n"
|
||||||
"Valid interfaces: xmlrpc, process [default], none." % servertype)
|
"Valid interfaces: xmlrpc, process [default], none." % servertype)
|
||||||
|
|
||||||
|
if configuration.server_only and configuration.servertype != "xmlrpc":
|
||||||
|
sys.exit("FATAL: If '--server-only' is defined, we must set the servertype as 'xmlrpc'.\n")
|
||||||
|
|
||||||
# Save a logfile for cooker into the current working directory. When the
|
# Save a logfile for cooker into the current working directory. When the
|
||||||
# server is daemonized this logfile will be truncated.
|
# server is daemonized this logfile will be truncated.
|
||||||
cooker_logfile = os.path.join(os.getcwd(), "cooker.log")
|
cooker_logfile = os.path.join(os.getcwd(), "cooker.log")
|
||||||
|
@ -222,14 +228,17 @@ Default BBFILES are the .bb files in the current directory.""")
|
||||||
|
|
||||||
logger.removeHandler(handler)
|
logger.removeHandler(handler)
|
||||||
|
|
||||||
# Setup a connection to the server (cooker)
|
if not configuration.server_only:
|
||||||
server_connection = server.establishConnection()
|
# Setup a connection to the server (cooker)
|
||||||
|
server_connection = server.establishConnection()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return server.launchUI(ui_main, server_connection.connection, server_connection.events)
|
return server.launchUI(ui_main, server_connection.connection, server_connection.events)
|
||||||
finally:
|
finally:
|
||||||
bb.event.ui_queue = []
|
bb.event.ui_queue = []
|
||||||
server_connection.terminate()
|
server_connection.terminate()
|
||||||
|
else:
|
||||||
|
print("server address: %s, server port: %s" % (server.serverinfo.host, server.serverinfo.port))
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue