summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server/none.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 09:34:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 11:37:26 +0100
commitcd3c4292e7ccc8934f229fcf010f8615398b87b5 (patch)
tree0c9cbf81048e4b44bc613f78cd6d59f0d9400b2e /bitbake/lib/bb/server/none.py
parente386fe4542865119ae7e1574e260c037e926239e (diff)
downloadpoky-cd3c4292e7ccc8934f229fcf010f8615398b87b5.tar.gz
bitbake: Cleanup bitbake server init process to be clearer to follow
Create a standard format server class instance with method calls for each step in the server setup. There should be enough hooks for each of the different server types. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server/none.py')
-rw-r--r--bitbake/lib/bb/server/none.py59
1 files changed, 36 insertions, 23 deletions
diff --git a/bitbake/lib/bb/server/none.py b/bitbake/lib/bb/server/none.py
index 45cda2f5f4..6083631fe7 100644
--- a/bitbake/lib/bb/server/none.py
+++ b/bitbake/lib/bb/server/none.py
@@ -36,8 +36,7 @@ DEBUG = False
36import inspect, select 36import inspect, select
37 37
38class BitBakeServerCommands(): 38class BitBakeServerCommands():
39 def __init__(self, server, cooker): 39 def __init__(self, server):
40 self.cooker = cooker
41 self.server = server 40 self.server = server
42 41
43 def runCommand(self, command): 42 def runCommand(self, command):
@@ -106,13 +105,17 @@ class BBUIEventQueue:
106def chldhandler(signum, stackframe): 105def chldhandler(signum, stackframe):
107 pass 106 pass
108 107
109class BitBakeServer(): 108class BitBakeNoneServer():
110 # remove this when you're done with debugging 109 # remove this when you're done with debugging
111 # allow_reuse_address = True 110 # allow_reuse_address = True
112 111
113 def __init__(self, cooker): 112 def __init__(self):
114 self._idlefuns = {} 113 self._idlefuns = {}
115 self.commands = BitBakeServerCommands(self, cooker) 114 self.commands = BitBakeServerCommands(self)
115
116 def addcooker(self, cooker):
117 self.cooker = cooker
118 self.commands.cooker = cooker
116 119
117 def register_idle_function(self, function, data): 120 def register_idle_function(self, function, data):
118 """Register a function to be called while the server is idle""" 121 """Register a function to be called while the server is idle"""
@@ -157,25 +160,10 @@ class BitBakeServer():
157 except: 160 except:
158 pass 161 pass
159 162
160class BitbakeServerInfo():
161 def __init__(self, server):
162 self.server = server
163 self.commands = server.commands
164
165class BitBakeServerFork():
166 def __init__(self, cooker, server, serverinfo, logfile):
167 serverinfo.logfile = logfile
168 serverinfo.cooker = cooker
169 serverinfo.server = server
170
171class BitbakeUILauch():
172 def launch(self, serverinfo, uifunc, *args):
173 return bb.cooker.server_main(serverinfo.cooker, uifunc, *args)
174
175class BitBakeServerConnection(): 163class BitBakeServerConnection():
176 def __init__(self, serverinfo): 164 def __init__(self, server):
177 self.server = serverinfo.server 165 self.server = server.server
178 self.connection = serverinfo.commands 166 self.connection = self.server.commands
179 self.events = bb.server.none.BBUIEventQueue(self.server) 167 self.events = bb.server.none.BBUIEventQueue(self.server)
180 for event in bb.event.ui_queue: 168 for event in bb.event.ui_queue:
181 self.events.queue_event(event) 169 self.events.queue_event(event)
@@ -189,3 +177,28 @@ class BitBakeServerConnection():
189 self.connection.terminateServer() 177 self.connection.terminateServer()
190 except: 178 except:
191 pass 179 pass
180
181class BitBakeServer(object):
182 def initServer(self):
183 self.server = BitBakeNoneServer()
184
185 def addcooker(self, cooker):
186 self.cooker = cooker
187 self.server.addcooker(cooker)
188
189 def getServerIdleCB(self):
190 return self.server.register_idle_function
191
192 def saveConnectionDetails(self):
193 return
194
195 def detach(self, cooker_logfile):
196 self.logfile = cooker_logfile
197
198 def establishConnection(self):
199 self.connection = BitBakeServerConnection(self)
200 return self.connection
201
202 def launchUI(self, uifunc, *args):
203 return bb.cooker.server_main(self.cooker, uifunc, *args)
204