Skip to contentSkip to conversation

bitbake: implement --foreground command line option

PATCH New Ed Bartosh 1 participant 1 message Jul 19, 2016

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 bitbake: implement --foreground command line option

This option makes bitbake xmlrpc server to run in foreground. It should be useful for debugging purposes.

---
 bitbake/lib/bb/main.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
bitbake/lib/bb/main.py +11 -1
index 3fc3ff5..09aeb9a 100755
@@ -247,6 +247,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters):
                           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.")
 
@@ -354,7 +357,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
 
@@ -395,6 +399,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")
@@ -484,6 +492,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
Signature · 1 line
2.1.4