diff options
| author | Richard Purdie <rpurdie@linux.intel.com> | 2010-11-13 21:23:54 +0800 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-11-13 21:23:54 +0800 |
| commit | 05ba6fc7cb5a389737a238f312f4148e6b837d71 (patch) | |
| tree | 7b0d8688095f94fd2010c63f0b0aadff301eccbf /bitbake/lib/bb/server/xmlrpc.py | |
| parent | 89929e1f283c8508c505c9731ad933880abf22a1 (diff) | |
| download | poky-05ba6fc7cb5a389737a238f312f4148e6b837d71.tar.gz | |
bitbake: Rewrite profiling code so its functional for both none and xmlrpc backends
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/server/xmlrpc.py')
| -rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py index cb2949fb9f..30b83d2b13 100644 --- a/bitbake/lib/bb/server/xmlrpc.py +++ b/bitbake/lib/bb/server/xmlrpc.py | |||
| @@ -87,7 +87,7 @@ class BitBakeServer(SimpleXMLRPCServer): | |||
| 87 | # remove this when you're done with debugging | 87 | # remove this when you're done with debugging |
| 88 | # allow_reuse_address = True | 88 | # allow_reuse_address = True |
| 89 | 89 | ||
| 90 | def __init__(self, cooker, interface = ("localhost", 0)): | 90 | def __init__(self, cooker, pre_serve, post_serve, interface = ("localhost", 0)): |
| 91 | """ | 91 | """ |
| 92 | Constructor | 92 | Constructor |
| 93 | """ | 93 | """ |
| @@ -99,6 +99,9 @@ class BitBakeServer(SimpleXMLRPCServer): | |||
| 99 | #self.register_introspection_functions() | 99 | #self.register_introspection_functions() |
| 100 | commands = BitBakeServerCommands(self, cooker) | 100 | commands = BitBakeServerCommands(self, cooker) |
| 101 | self.autoregister_all_functions(commands, "") | 101 | self.autoregister_all_functions(commands, "") |
| 102 | self.cooker = cooker | ||
| 103 | self.pre_serve = pre_serve | ||
| 104 | self.post_serve = post_serve | ||
| 102 | 105 | ||
| 103 | def autoregister_all_functions(self, context, prefix): | 106 | def autoregister_all_functions(self, context, prefix): |
| 104 | """ | 107 | """ |
| @@ -116,9 +119,14 @@ class BitBakeServer(SimpleXMLRPCServer): | |||
| 116 | self._idlefuns[function] = data | 119 | self._idlefuns[function] = data |
| 117 | 120 | ||
| 118 | def serve_forever(self): | 121 | def serve_forever(self): |
| 122 | bb.cooker.server_main(self.cooker, self._serve_forever) | ||
| 123 | |||
| 124 | def _serve_forever(self): | ||
| 119 | """ | 125 | """ |
| 120 | Serve Requests. Overloaded to honor a quit command | 126 | Serve Requests. Overloaded to honor a quit command |
| 121 | """ | 127 | """ |
| 128 | self.pre_serve() | ||
| 129 | |||
| 122 | self.quit = False | 130 | self.quit = False |
| 123 | self.timeout = 0 # Run Idle calls for our first callback | 131 | self.timeout = 0 # Run Idle calls for our first callback |
| 124 | while not self.quit: | 132 | while not self.quit: |
| @@ -155,6 +163,7 @@ class BitBakeServer(SimpleXMLRPCServer): | |||
| 155 | except: | 163 | except: |
| 156 | pass | 164 | pass |
| 157 | 165 | ||
| 166 | self.post_serve() | ||
| 158 | self.server_close() | 167 | self.server_close() |
| 159 | return | 168 | return |
| 160 | 169 | ||
| @@ -164,8 +173,12 @@ class BitbakeServerInfo(): | |||
| 164 | self.port = server.port | 173 | self.port = server.port |
| 165 | 174 | ||
| 166 | class BitBakeServerFork(): | 175 | class BitBakeServerFork(): |
| 167 | def __init__(self, serverinfo, command, logfile): | 176 | def __init__(self, cooker, server, serverinfo, logfile): |
| 168 | daemonize.createDaemon(command, logfile) | 177 | daemonize.createDaemon(server.serve_forever, logfile) |
| 178 | |||
| 179 | class BitbakeUILauch(): | ||
| 180 | def launch(self, serverinfo, uifunc, *args): | ||
| 181 | return uifunc(*args) | ||
| 169 | 182 | ||
| 170 | class BitBakeServerConnection(): | 183 | class BitBakeServerConnection(): |
| 171 | def __init__(self, serverinfo): | 184 | def __init__(self, serverinfo): |
