summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/command.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-12-10 16:53:19 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:49 +0000
commit098f63d6727e3b4db0a8906deee52c75f03047fb (patch)
treea6937b895dc0126fa684695b15e42700f8fb3eb2 /bitbake/lib/bb/command.py
parent5a92e67b8655d0971c6e3e8233e984ef9ad42997 (diff)
downloadpoky-098f63d6727e3b4db0a8906deee52c75f03047fb.tar.gz
Rename command events, adjust compareRevisions
- Moved the logic for comparing revisions from cooker into command - Removed 'Cooker' from the event names - Renamed the 'ExitCode' event into CommandExit, and changed CommandFailed to be a subclass of CommandExit (Bitbake rev: c51ed5d7a9971fad6019dac6c35a71b8a54ab16a) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/command.py')
-rw-r--r--bitbake/lib/bb/command.py58
1 files changed, 24 insertions, 34 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
35async_cmds = {} 35async_cmds = {}
36sync_cmds = {} 36sync_cmds = {}
37 37
38
39class CommandCompleted(bb.event.Event):
40 pass
41
42class CommandExit(bb.event.Event):
43 def __init__(self, exitcode):
44 bb.event.Event.__init__(self)
45 self.exitcode = int(exitcode)
46
47class CommandFailed(CommandExit):
48 def __init__(self, message):
49 self.error = message
50 CommandExit.__init__(self, 1)
51
38class Command: 52class 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#
259class CookerCommandCompleted(bb.event.Event):
260 """
261 Cooker command completed
262 """
263 def __init__(self):
264 bb.event.Event.__init__(self)
265
266
267class 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
275class 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)