summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server/xmlrpc.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/server/xmlrpc.py')
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py50
1 files changed, 36 insertions, 14 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index e7b6010874..4a16f9d525 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -122,8 +122,7 @@ def _create_server(host, port):
122 return s 122 return s
123 123
124class BitBakeServerCommands(): 124class BitBakeServerCommands():
125 def __init__(self, server, cooker): 125 def __init__(self, server):
126 self.cooker = cooker
127 self.server = server 126 self.server = server
128 127
129 def registerEventHandler(self, host, port): 128 def registerEventHandler(self, host, port):
@@ -160,11 +159,11 @@ class BitBakeServerCommands():
160 """ 159 """
161 return True 160 return True
162 161
163class BitBakeServer(SimpleXMLRPCServer): 162class BitBakeXMLRPCServer(SimpleXMLRPCServer):
164 # remove this when you're done with debugging 163 # remove this when you're done with debugging
165 # allow_reuse_address = True 164 # allow_reuse_address = True
166 165
167 def __init__(self, cooker, interface = ("localhost", 0)): 166 def __init__(self, interface = ("localhost", 0)):
168 """ 167 """
169 Constructor 168 Constructor
170 """ 169 """
@@ -174,9 +173,12 @@ class BitBakeServer(SimpleXMLRPCServer):
174 self._idlefuns = {} 173 self._idlefuns = {}
175 self.host, self.port = self.socket.getsockname() 174 self.host, self.port = self.socket.getsockname()
176 #self.register_introspection_functions() 175 #self.register_introspection_functions()
177 commands = BitBakeServerCommands(self, cooker) 176 self.commands = BitBakeServerCommands(self)
178 self.autoregister_all_functions(commands, "") 177 self.autoregister_all_functions(self.commands, "")
178
179 def addcooker(self, cooker):
179 self.cooker = cooker 180 self.cooker = cooker
181 self.commands.cooker = cooker
180 182
181 def autoregister_all_functions(self, context, prefix): 183 def autoregister_all_functions(self, context, prefix):
182 """ 184 """
@@ -244,14 +246,6 @@ class BitbakeServerInfo():
244 self.host = server.host 246 self.host = server.host
245 self.port = server.port 247 self.port = server.port
246 248
247class BitBakeServerFork():
248 def __init__(self, cooker, server, serverinfo, logfile):
249 daemonize.createDaemon(server.serve_forever, logfile)
250
251class BitbakeUILauch():
252 def launch(self, serverinfo, uifunc, *args):
253 return uifunc(*args)
254
255class BitBakeServerConnection(): 249class BitBakeServerConnection():
256 def __init__(self, serverinfo): 250 def __init__(self, serverinfo):
257 self.connection = _create_server(serverinfo.host, serverinfo.port) 251 self.connection = _create_server(serverinfo.host, serverinfo.port)
@@ -271,3 +265,31 @@ class BitBakeServerConnection():
271 self.connection.terminateServer() 265 self.connection.terminateServer()
272 except: 266 except:
273 pass 267 pass
268
269class BitBakeServer(object):
270 def initServer(self):
271 self.server = BitBakeXMLRPCServer()
272
273 def addcooker(self, cooker):
274 self.cooker = cooker
275 self.server.addcooker(cooker)
276
277 def getServerIdleCB(self):
278 return self.server.register_idle_function
279
280 def saveConnectionDetails(self):
281 self.serverinfo = BitbakeServerInfo(self.server)
282
283 def detach(self, cooker_logfile):
284 daemonize.createDaemon(self.server.serve_forever, cooker_logfile)
285 del self.cooker
286 del self.server
287
288 def establishConnection(self):
289 self.connection = BitBakeServerConnection(self.serverinfo)
290 return self.connection
291
292 def launchUI(self, uifunc, *args):
293 return uifunc(*args)
294
295