Skip to contentSkip to conversation

knotty, bitbake: add option to terminate a remote server

PATCH New Alex DAMIAN 1 participant 2 messages Jun 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 knotty, bitbake: add option to terminate a remote server

From: Alexandru DAMIAN <[email protected]>

I add an option to terminate a remote server gracefully as not to need a kill command.

---
 bin/bitbake         | 3 +++
 lib/bb/ui/knotty.py | 4 ++++
 2 files changed, 7 insertions(+)
bin/bitbake +3 -0
index ef0c5d8..e924eec 100755
@@ -197,6 +197,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters):
         parser.add_option("", "--remote-server", help = "Connect to the specified server",
                    action = "store", dest = "remote_server", default = False)
 
+        parser.add_option("-m", "--kill-server", help = "Terminate the remote server",
+                    action = "store_true", dest = "kill_server", default = False)
+
         parser.add_option("", "--observe-only", help = "Connect to a server as an observing-only client",
                    action = "store_true", dest = "observe_only", default = False)
 
lib/bb/ui/knotty.py +4 -0
index 465203f..db73ddf 100644
@@ -253,6 +253,10 @@ def main(server, eventHandler, params, tf = TerminalFilter):
     console.setFormatter(format)
     logger.addHandler(console)
 
+    if params.options.remote_server and params.options.kill_server:
+        server.terminateServer()
+        return
+
     if consolelogfile and not params.options.show_environment:
         bb.utils.mkdirhier(os.path.dirname(consolelogfile))
         conlogformat = bb.msg.BBLogFormatter(format_str)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 2/2 bitbake: read BBSERVER environement for remote server

From: Alexandru DAMIAN <[email protected]>

This change allows bitbake to connect to a remote server by reading the BBSERVER environment variable and effecting the config. Basically a shortcut to the command line parameters.

---
 bin/bitbake | 9 +++++++++
 1 file changed, 9 insertions(+)
bin/bitbake +9 -0
index e924eec..1c2214d 100755
@@ -204,6 +204,12 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters):
                    action = "store_true", dest = "observe_only", default = False)
 
         options, targets = parser.parse_args(sys.argv)
+
+        # some environmental variables set also configuration options
+        if "BBSERVER" in os.environ:
+            options.servertype = "xmlrpc"
+            options.remote_server = os.environ["BBSERVER"]
+
         return options, targets[1:]
 
 
@@ -268,6 +274,9 @@ def main():
             sys.exit("FATAL: If '--server-only' is defined, we must set the servertype as 'xmlrpc'.\n")
         if not configParams.bind:
             sys.exit("FATAL: The '--server-only' option requires a name/address to bind to with the -B option.\n")
+        if configParams.remote_server:
+            sys.exit("FATAL: The '--server-only' option conflicts with the '--remote-server' option. %s\n" % 
+                ("Please check your BBSERVER environment" if "BBSERVER" in os.environ else "" ))
 
     if configParams.bind and configParams.servertype != "xmlrpc":
         sys.exit("FATAL: If '-B' or '--bind' is defined, we must set the servertype as 'xmlrpc'.\n")
Signature · 1 line
1.8.1.2