[bitbake-devel] [PATCH v2 1/2] bitbake: xmplrpc: split connect method

Ed Bartosh ed.bartosh at linux.intel.com
Tue Jan 5 13:45:37 UTC 2016


Current code in connect method sets up event queue, which requires
registering UI handler. This functionality may not be needed for
some operations, e.g. for server termination.

Moved functionality of setting up event queue in from 'connect'
method to 'setupEventQueue' in BitBakeXMLRPCServerConnection class.

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>

diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py
index c8530fc..dd04393 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -403,6 +403,7 @@ def bitbake_main(configParams, configuration):
     if not configParams.server_only:
         try:
             server_connection = server.establishConnection(featureset)
+            server_connection.setupEventQueue()
         except Exception as e:
             bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e)))
 
diff --git a/bitbake/lib/bb/server/__init__.py b/bitbake/lib/bb/server/__init__.py
index da5e480..538a633 100644
--- a/bitbake/lib/bb/server/__init__.py
+++ b/bitbake/lib/bb/server/__init__.py
@@ -63,6 +63,9 @@ class BitBakeBaseServerConnection():
     def terminate(self):
         pass
 
+    def setupEventQueue(self):
+        pass
+
 
 """ BitBakeBaseServer class is the common ancestor to all Bitbake servers
 
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 17eb28b..1ceca51 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -302,7 +302,9 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
             return None
 
         self.transport.set_connection_token(token)
+        return self
 
+    def setupEventQueue(self):
         self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo)
         for event in bb.event.ui_queue:
             self.events.queue_event(event)
@@ -314,8 +316,6 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection):
             # no need to log it here, the error shall be sent to the client
             raise BaseException(error)
 
-        return self
-
     def removeClient(self):
         if not self.observer_only:
             self.connection.removeClient()
-- 
2.1.4




More information about the bitbake-devel mailing list