diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-11-28 15:01:08 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-11-28 13:54:31 -0800 |
commit | d4125bcac0b1ff225dbfd90d2a5722a2f4e64ff8 (patch) | |
tree | fc42e4f4518015a160edfa88f23ef699839171e2 | |
parent | c0202071428fde6ef0a93de9c99d416624628813 (diff) | |
download | poky-d4125bcac0b1ff225dbfd90d2a5722a2f4e64ff8.tar.gz |
bitbake: Simplfy pre and post cooker hooks
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/server/none.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 7 |
3 files changed, 9 insertions, 16 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 33eb65e2f3..054dac8634 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -70,7 +70,7 @@ class BBCooker: | |||
70 | self.bb_cache = None | 70 | self.bb_cache = None |
71 | 71 | ||
72 | if server: | 72 | if server: |
73 | self.server = server.BitBakeServer(self, self.pre_serve, self.post_serve) | 73 | self.server = server.BitBakeServer(self) |
74 | 74 | ||
75 | self.configuration = configuration | 75 | self.configuration = configuration |
76 | 76 | ||
@@ -925,6 +925,8 @@ class BBCooker: | |||
925 | 925 | ||
926 | 926 | ||
927 | def server_main(cooker, func, *args): | 927 | def server_main(cooker, func, *args): |
928 | cooker.pre_serve() | ||
929 | |||
928 | if cooker.configuration.profile: | 930 | if cooker.configuration.profile: |
929 | try: | 931 | try: |
930 | import cProfile as profile | 932 | import cProfile as profile |
@@ -956,11 +958,12 @@ def server_main(cooker, func, *args): | |||
956 | 958 | ||
957 | print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed") | 959 | print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed") |
958 | 960 | ||
959 | return ret | ||
960 | else: | 961 | else: |
961 | return func(*args) | 962 | ret = func(*args) |
962 | 963 | ||
964 | cooker.post_serve() | ||
963 | 965 | ||
966 | return ret | ||
964 | 967 | ||
965 | class CookerExit(bb.event.Event): | 968 | class CookerExit(bb.event.Event): |
966 | """ | 969 | """ |
diff --git a/bitbake/lib/bb/server/none.py b/bitbake/lib/bb/server/none.py index 38f713c519..dafb2feba9 100644 --- a/bitbake/lib/bb/server/none.py +++ b/bitbake/lib/bb/server/none.py | |||
@@ -109,11 +109,9 @@ class BitBakeServer(): | |||
109 | # remove this when you're done with debugging | 109 | # remove this when you're done with debugging |
110 | # allow_reuse_address = True | 110 | # allow_reuse_address = True |
111 | 111 | ||
112 | def __init__(self, cooker, pre_serve, post_serve): | 112 | def __init__(self, cooker): |
113 | self._idlefuns = {} | 113 | self._idlefuns = {} |
114 | self.commands = BitBakeServerCommands(self, cooker) | 114 | self.commands = BitBakeServerCommands(self, cooker) |
115 | self.pre_serve = pre_serve | ||
116 | self.post_serve = post_serve | ||
117 | 115 | ||
118 | def register_idle_function(self, function, data): | 116 | def register_idle_function(self, function, data): |
119 | """Register a function to be called while the server is idle""" | 117 | """Register a function to be called while the server is idle""" |
@@ -169,10 +167,7 @@ class BitBakeServerFork(): | |||
169 | 167 | ||
170 | class BitbakeUILauch(): | 168 | class BitbakeUILauch(): |
171 | def launch(self, serverinfo, uifunc, *args): | 169 | def launch(self, serverinfo, uifunc, *args): |
172 | serverinfo.server.pre_serve() | 170 | return bb.cooker.server_main(serverinfo.cooker, uifunc, *args) |
173 | ret = bb.cooker.server_main(serverinfo.cooker, uifunc, *args) | ||
174 | serverinfo.server.post_serve() | ||
175 | return ret | ||
176 | 171 | ||
177 | class BitBakeServerConnection(): | 172 | class BitBakeServerConnection(): |
178 | def __init__(self, serverinfo): | 173 | def __init__(self, serverinfo): |
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py index 30b83d2b13..5d3cc3e106 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, pre_serve, post_serve, interface = ("localhost", 0)): | 90 | def __init__(self, cooker, interface = ("localhost", 0)): |
91 | """ | 91 | """ |
92 | Constructor | 92 | Constructor |
93 | """ | 93 | """ |
@@ -100,8 +100,6 @@ class BitBakeServer(SimpleXMLRPCServer): | |||
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 | 102 | self.cooker = cooker |
103 | self.pre_serve = pre_serve | ||
104 | self.post_serve = post_serve | ||
105 | 103 | ||
106 | def autoregister_all_functions(self, context, prefix): | 104 | def autoregister_all_functions(self, context, prefix): |
107 | """ | 105 | """ |
@@ -125,8 +123,6 @@ class BitBakeServer(SimpleXMLRPCServer): | |||
125 | """ | 123 | """ |
126 | Serve Requests. Overloaded to honor a quit command | 124 | Serve Requests. Overloaded to honor a quit command |
127 | """ | 125 | """ |
128 | self.pre_serve() | ||
129 | |||
130 | self.quit = False | 126 | self.quit = False |
131 | self.timeout = 0 # Run Idle calls for our first callback | 127 | self.timeout = 0 # Run Idle calls for our first callback |
132 | while not self.quit: | 128 | while not self.quit: |
@@ -163,7 +159,6 @@ class BitBakeServer(SimpleXMLRPCServer): | |||
163 | except: | 159 | except: |
164 | pass | 160 | pass |
165 | 161 | ||
166 | self.post_serve() | ||
167 | self.server_close() | 162 | self.server_close() |
168 | return | 163 | return |
169 | 164 | ||