summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2013-11-25 15:21:27 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-02 11:28:27 +0000
commit6ff9c9e39de57964ad7f711a77243a7049e9cada (patch)
treefce7119ba7d8e48a7ab1dfafd16b18244ddb6a80 /bitbake/lib
parent0bea372b0fe6d77b2f6b742214f97a0db79e3990 (diff)
downloadpoky-6ff9c9e39de57964ad7f711a77243a7049e9cada.tar.gz
bitbake: bitbake, xmlrpc.py: Implement memory resident auto port configuration/restart
This patch adds the ability to dynamically select a port for the bitbake memory resident server when the BBSERVER port is set to -1. This allows for running multiple instances of the bitbake memory resident server on the same system in different build directories. The client portion of the bitbake instance can also request that the server automatically start when using the auto port feature. This is to deal with a bitbake instance that eventually times out and exits or that has died for some unknown reason. The new functionality allows for lazy startup of the server after sourcing the init script for the memory resident functionality. (Bitbake rev: d6abc07ff385357d312d8435b89e0a9c1f965433) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 82c0e8d8a6..3a67ab0cf2 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -338,13 +338,38 @@ class BitBakeXMLRPCClient(BitBakeBaseServer):
338 def saveConnectionDetails(self, remote): 338 def saveConnectionDetails(self, remote):
339 self.remote = remote 339 self.remote = remote
340 340
341 def saveConnectionConfigParams(self, configParams):
342 self.configParams = configParams
343
341 def establishConnection(self, featureset): 344 def establishConnection(self, featureset):
342 # The format of "remote" must be "server:port" 345 # The format of "remote" must be "server:port"
343 try: 346 try:
344 [host, port] = self.remote.split(":") 347 [host, port] = self.remote.split(":")
345 port = int(port) 348 port = int(port)
346 except: 349 except Exception as e:
347 return None 350 bb.fatal("Failed to read remote definition (%s)" % str(e))
351
352 # use automatic port if port set to -1, meaning read it from
353 # the bitbake.lock file
354 if port == -1:
355 lock_location = "%s/bitbake.lock" % self.configParams.environment.get('BUILDDIR')
356 lock = bb.utils.lockfile(lock_location, False, False)
357 if lock:
358 # This means there is no server running which we can
359 # connect to on the local system.
360 bb.utils.unlockfile(lock)
361 return None
362
363 try:
364 lf = open(lock_location, 'r')
365 remotedef = lf.readline()
366 [host, port] = remotedef.split(":")
367 port = int(port)
368 lf.close()
369 self.remote = remotedef
370 except Exception as e:
371 bb.fatal("Failed to read bitbake.lock (%s)" % str(e))
372
348 # We need our IP for the server connection. We get the IP 373 # We need our IP for the server connection. We get the IP
349 # by trying to connect with the server 374 # by trying to connect with the server
350 try: 375 try:
@@ -352,8 +377,8 @@ class BitBakeXMLRPCClient(BitBakeBaseServer):
352 s.connect((host, port)) 377 s.connect((host, port))
353 ip = s.getsockname()[0] 378 ip = s.getsockname()[0]
354 s.close() 379 s.close()
355 except: 380 except Exception as e:
356 return None 381 bb.fatal("Could not create socket for %s:%s (%s)" % (host, port, str(e)))
357 try: 382 try:
358 self.serverImpl = XMLRPCProxyServer(host, port) 383 self.serverImpl = XMLRPCProxyServer(host, port)
359 self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset) 384 self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset)