]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake.lock: Add host:port to bitbake.lock for memres server
authorJason Wessel <jason.wessel@windriver.com>
Mon, 25 Nov 2013 21:21:26 +0000 (15:21 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 2 Dec 2013 17:32:40 +0000 (17:32 +0000)
The idea is to build on the --status-only option for bitbake and
expose a mechanism where the oe init scripts can easily switch between
memres server and the non-memres server.

In the case of the standard oe init script the following
can shut down the server:

if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then
    grep ":" bitbake.lock > /dev/null && BBSERVER=`cat bitbake.lock` bitbake --status-only
    if [ $? = 0 ] ; then
       echo "Shutting down bitbake memory resident server with bitbake -m"
       BBSERVER=`cat bitbake.lock` bitbake -m
    fi
fi

A similar function can be used to automatically detect if the server
is already running for the oe memres init script.  This new
functionality allows for the memres init script to be started in a new
shell and connect up to an alaready running server without seeing the
error of trying to start the server multiple times.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bin/bitbake
lib/bb/cooker.py
lib/bb/cookerdata.py
lib/bb/server/xmlrpc.py

index a0a2baa4bc69980bbe7101cd50b5d8b16b09a5f4..5857b9242c5b3b8430cdbdb2f704faed7d74d625 100755 (executable)
@@ -208,8 +208,10 @@ def start_server(servermodule, configParams, configuration):
     if configParams.bind:
         (host, port) = configParams.bind.split(':')
         server.initServer((host, int(port)))
+        configuration.interface = [ server.serverImpl.host, server.serverImpl.port ]
     else:
         server.initServer()
+        configuration.interface = []
 
     try:
         configuration.setServerRegIdleCallback(server.getServerIdleCB())
index b36ed6fe36a97056a611b410ba57078575aefc52..7b10f80680bad52cd430ee803560378bebb4ab85 100644 (file)
@@ -125,6 +125,14 @@ class BBCooker:
         self.lock = bb.utils.lockfile(lockfile, False, False)
         if not self.lock:
             bb.fatal("Only one copy of bitbake should be run against a build directory")
+        try:
+            self.lock.seek(0)
+            self.lock.truncate()
+            if len(configuration.interface) >= 2:
+                self.lock.write("%s:%s\n" % (configuration.interface[0], configuration.interface[1]));
+            self.lock.flush()
+        except:
+            pass
 
         # TOSTOP must not be set or our children will hang when they output
         fd = sys.stdout.fileno()
index e640ed0f35e40f2b9280c6e4c0ec747a8e90ad8b..6200b0ebac93640523717b5a49754dc2f7646c53 100644 (file)
@@ -127,6 +127,7 @@ class CookerConfiguration(object):
         self.dump_signatures = False
         self.dry_run = False
         self.tracking = False
+        self.interface = []
 
         self.env = {}
 
index 3a67ab0cf279519c05bb7d5ec479665510a1f83d..46d074a738830ef86158c930889033137a86b6e8 100644 (file)
@@ -198,6 +198,11 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer):
         Constructor
         """
         BaseImplServer.__init__(self)
+        if (interface[1] == 0):     # anonymous port, not getting reused
+            self.single_use = True
+        # Use auto port configuration
+        if (interface[1] == -1):
+            interface = (interface[0], 0)
         SimpleXMLRPCServer.__init__(self, interface,
                                     requestHandler=BitBakeXMLRPCRequestHandler,
                                     logRequests=False, allow_none=True)
@@ -208,8 +213,6 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer):
         self.autoregister_all_functions(self.commands, "")
         self.interface = interface
         self.single_use = False
-        if (interface[1] == 0):     # anonymous port, not getting reused
-            self.single_use = True
 
     def addcooker(self, cooker):
         BaseImplServer.addcooker(self, cooker)