diff options
-rw-r--r-- | bitbake/lib/bb/command.py | 58 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/depexp.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 6 |
6 files changed, 41 insertions, 49 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index 30c7240cf2..b88089298c 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py | |||
@@ -35,12 +35,25 @@ import bb.data | |||
35 | async_cmds = {} | 35 | async_cmds = {} |
36 | sync_cmds = {} | 36 | sync_cmds = {} |
37 | 37 | ||
38 | |||
39 | class CommandCompleted(bb.event.Event): | ||
40 | pass | ||
41 | |||
42 | class CommandExit(bb.event.Event): | ||
43 | def __init__(self, exitcode): | ||
44 | bb.event.Event.__init__(self) | ||
45 | self.exitcode = int(exitcode) | ||
46 | |||
47 | class CommandFailed(CommandExit): | ||
48 | def __init__(self, message): | ||
49 | self.error = message | ||
50 | CommandExit.__init__(self, 1) | ||
51 | |||
38 | class Command: | 52 | class Command: |
39 | """ | 53 | """ |
40 | A queue of asynchronous commands for bitbake | 54 | A queue of asynchronous commands for bitbake |
41 | """ | 55 | """ |
42 | def __init__(self, cooker): | 56 | def __init__(self, cooker): |
43 | |||
44 | self.cooker = cooker | 57 | self.cooker = cooker |
45 | self.cmds_sync = CommandsSync() | 58 | self.cmds_sync = CommandsSync() |
46 | self.cmds_async = CommandsAsync() | 59 | self.cmds_async = CommandsAsync() |
@@ -105,11 +118,13 @@ class Command: | |||
105 | self.finishAsyncCommand(traceback.format_exc()) | 118 | self.finishAsyncCommand(traceback.format_exc()) |
106 | return False | 119 | return False |
107 | 120 | ||
108 | def finishAsyncCommand(self, error = None): | 121 | def finishAsyncCommand(self, msg=None, code=None): |
109 | if error: | 122 | if msg: |
110 | bb.event.fire(CookerCommandFailed(error), self.cooker.configuration.event_data) | 123 | bb.event.fire(CommandFailed(msg), self.cooker.configuration.event_data) |
124 | elif code: | ||
125 | bb.event.fire(CommandExit(code), self.cooker.configuration.event_data) | ||
111 | else: | 126 | else: |
112 | bb.event.fire(CookerCommandCompleted(), self.cooker.configuration.event_data) | 127 | bb.event.fire(CommandCompleted(), self.cooker.configuration.event_data) |
113 | self.currentAsyncCommand = None | 128 | self.currentAsyncCommand = None |
114 | 129 | ||
115 | 130 | ||
@@ -249,33 +264,8 @@ class CommandsAsync: | |||
249 | """ | 264 | """ |
250 | Parse the .bb files | 265 | Parse the .bb files |
251 | """ | 266 | """ |
252 | command.cooker.compareRevisions() | 267 | if bb.fetch.fetcher_compare_revisions(command.cooker.configuration.data): |
253 | command.finishAsyncCommand() | 268 | command.finishAsyncCommand(code=1) |
269 | else: | ||
270 | command.finishAsyncCommand() | ||
254 | compareRevisions.needcache = True | 271 | compareRevisions.needcache = True |
255 | |||
256 | # | ||
257 | # Events | ||
258 | # | ||
259 | class CookerCommandCompleted(bb.event.Event): | ||
260 | """ | ||
261 | Cooker command completed | ||
262 | """ | ||
263 | def __init__(self): | ||
264 | bb.event.Event.__init__(self) | ||
265 | |||
266 | |||
267 | class CookerCommandFailed(bb.event.Event): | ||
268 | """ | ||
269 | Cooker command completed | ||
270 | """ | ||
271 | def __init__(self, error): | ||
272 | bb.event.Event.__init__(self) | ||
273 | self.error = error | ||
274 | |||
275 | class CookerCommandSetExitCode(bb.event.Event): | ||
276 | """ | ||
277 | Set the exit code for a cooker command | ||
278 | """ | ||
279 | def __init__(self, exitcode): | ||
280 | bb.event.Event.__init__(self) | ||
281 | self.exitcode = int(exitcode) | ||
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 3b4eae8c4c..8ac88b99a4 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -191,10 +191,6 @@ class BBCooker: | |||
191 | 191 | ||
192 | logger.plain("%-35s %25s %25s", p, lateststr, prefstr) | 192 | logger.plain("%-35s %25s %25s", p, lateststr, prefstr) |
193 | 193 | ||
194 | def compareRevisions(self): | ||
195 | ret = bb.fetch.fetcher_compare_revisons(self.configuration.data) | ||
196 | bb.event.fire(bb.command.CookerCommandSetExitCode(ret), self.configuration.event_data) | ||
197 | |||
198 | def showEnvironment(self, buildfile = None, pkgs_to_build = []): | 194 | def showEnvironment(self, buildfile = None, pkgs_to_build = []): |
199 | """ | 195 | """ |
200 | Show the outer or per-package environment | 196 | Show the outer or per-package environment |
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 0562d72a23..668b788698 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -174,7 +174,7 @@ def fetcher_init(d): | |||
174 | pd.addDomain("BB_URI_HEADREVS") | 174 | pd.addDomain("BB_URI_HEADREVS") |
175 | pd.addDomain("BB_URI_LOCALCOUNT") | 175 | pd.addDomain("BB_URI_LOCALCOUNT") |
176 | 176 | ||
177 | def fetcher_compare_revisons(d): | 177 | def fetcher_compare_revisions(d): |
178 | """ | 178 | """ |
179 | Compare the revisions in the persistant cache with current values and | 179 | Compare the revisions in the persistant cache with current values and |
180 | return true/false on whether they've changed. | 180 | return true/false on whether they've changed. |
diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py index 31004db44a..a6039ec57d 100644 --- a/bitbake/lib/bb/ui/depexp.py +++ b/bitbake/lib/bb/ui/depexp.py | |||
@@ -21,6 +21,8 @@ import gobject | |||
21 | import gtk | 21 | import gtk |
22 | import threading | 22 | import threading |
23 | import xmlrpclib | 23 | import xmlrpclib |
24 | import bb | ||
25 | import bb.event | ||
24 | from bb.ui.crumbs.progress import ProgressBar | 26 | from bb.ui.crumbs.progress import ProgressBar |
25 | 27 | ||
26 | # Package Model | 28 | # Package Model |
@@ -236,11 +238,13 @@ def main(server, eventHandler): | |||
236 | parse(event._depgraph, dep.pkg_model, dep.depends_model) | 238 | parse(event._depgraph, dep.pkg_model, dep.depends_model) |
237 | gtk.gdk.threads_leave() | 239 | gtk.gdk.threads_leave() |
238 | 240 | ||
239 | if isinstance(event, bb.command.CookerCommandCompleted): | 241 | if isinstance(event, bb.command.CommandCompleted): |
240 | continue | 242 | continue |
241 | if isinstance(event, bb.command.CookerCommandFailed): | 243 | if isinstance(event, bb.command.CommandFailed): |
242 | print("Command execution failed: %s" % event.error) | 244 | print("Command execution failed: %s" % event.error) |
243 | break | 245 | return event.exitcode |
246 | if isinstance(event, bb.command.CommandExit): | ||
247 | return event.exitcode | ||
244 | if isinstance(event, bb.cooker.CookerExit): | 248 | if isinstance(event, bb.cooker.CookerExit): |
245 | break | 249 | break |
246 | 250 | ||
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index e0f08ecb6e..d3534a0f5b 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -163,15 +163,15 @@ def main(server, eventHandler): | |||
163 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) | 163 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) |
164 | continue | 164 | continue |
165 | 165 | ||
166 | if isinstance(event, bb.command.CookerCommandCompleted): | 166 | if isinstance(event, bb.command.CommandCompleted): |
167 | break | 167 | break |
168 | if isinstance(event, bb.command.CookerCommandSetExitCode): | 168 | if isinstance(event, bb.command.CommandFailed): |
169 | return_value = event.exitcode | 169 | return_value = event.exitcode |
170 | continue | ||
171 | if isinstance(event, bb.command.CookerCommandFailed): | ||
172 | return_value = 1 | ||
173 | logger.error("Command execution failed: %s" % event.error) | 170 | logger.error("Command execution failed: %s" % event.error) |
174 | break | 171 | break |
172 | if isinstance(event, bb.command.CommandExit): | ||
173 | return_value = event.exitcode | ||
174 | continue | ||
175 | if isinstance(event, bb.cooker.CookerExit): | 175 | if isinstance(event, bb.cooker.CookerExit): |
176 | break | 176 | break |
177 | if isinstance(event, bb.event.MultipleProviders): | 177 | if isinstance(event, bb.event.MultipleProviders): |
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 3bc8373964..1db4ec173b 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
@@ -288,12 +288,14 @@ class NCursesUI: | |||
288 | # else: | 288 | # else: |
289 | # bb.msg.error(bb.msg.domain.Build, "see log in %s" % logfile) | 289 | # bb.msg.error(bb.msg.domain.Build, "see log in %s" % logfile) |
290 | 290 | ||
291 | if isinstance(event, bb.command.CookerCommandCompleted): | 291 | if isinstance(event, bb.command.CommandCompleted): |
292 | exitflag = True | 292 | exitflag = True |
293 | if isinstance(event, bb.command.CookerCommandFailed): | 293 | if isinstance(event, bb.command.CommandFailed): |
294 | mw.appendText("Command execution failed: %s" % event.error) | 294 | mw.appendText("Command execution failed: %s" % event.error) |
295 | time.sleep(2) | 295 | time.sleep(2) |
296 | exitflag = True | 296 | exitflag = True |
297 | if isinstance(event, bb.command.CommandExit): | ||
298 | exitflag = True | ||
297 | if isinstance(event, bb.cooker.CookerExit): | 299 | if isinstance(event, bb.cooker.CookerExit): |
298 | exitflag = True | 300 | exitflag = True |
299 | 301 | ||