summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
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)