diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-08 14:30:33 -0500 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-12-08 19:12:35 -0500 |
commit | c7c8945ef7ca9465312e630b7fa5f0a87ac8b6c7 (patch) | |
tree | 4eefcd0d4d423c438725f948dcede773a285b6e9 /lib/bb | |
parent | 9caf65e79f95fe0045e727391e974c4c1e7411ff (diff) | |
download | bitbake-contrib-c7c8945ef7ca9465312e630b7fa5f0a87ac8b6c7.tar.gz |
cooker: merge cookerState and cookerAction
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb')
-rw-r--r-- | lib/bb/command.py | 7 | ||||
-rw-r--r-- | lib/bb/cooker.py | 33 |
2 files changed, 15 insertions, 25 deletions
diff --git a/lib/bb/command.py b/lib/bb/command.py index 9a8d689e2..654ede0e8 100644 --- a/lib/bb/command.py +++ b/lib/bb/command.py @@ -81,7 +81,8 @@ class Command: (command, options) = self.currentAsyncCommand commandmethod = getattr(CommandsAsync, command) needcache = getattr( commandmethod, "needcache" ) - if needcache and self.cooker.cookerState != bb.cooker.cookerParsed: + if (needcache and self.cooker.state in + (bb.cooker.state.initial, bb.cooker.state.parsing)): self.cooker.updateCache() return True else: @@ -123,13 +124,13 @@ class CommandsSync: """ Trigger cooker 'shutdown' mode """ - command.cooker.cookerAction = bb.cooker.cookerShutdown + command.cooker.state = bb.cooker.state.shutdown def stateStop(self, command, params): """ Stop the cooker """ - command.cooker.cookerAction = bb.cooker.cookerStop + command.cooker.state = bb.cooker.state.stop def getCmdLineAction(self, command, params): """ diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 2844101f3..4e6ff73b6 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -52,16 +52,8 @@ class NothingToBuild(Exception): Exception raised when there is nothing to build """ - -# Different states cooker can be in -cookerClean = 1 -cookerParsing = 2 -cookerParsed = 3 - -# Different action states the cooker can be in -cookerRun = 1 # Cooker is running normally -cookerShutdown = 2 # Active tasks should be brought to a controlled stop -cookerStop = 3 # Stop, now! +class state: + initial, parsing, running, shutdown, stop = range(5) #============================================================================# # BBCooker @@ -109,8 +101,7 @@ class BBCooker: termios.tcsetattr(fd, termios.TCSANOW, tcattr) self.command = bb.command.Command(self) - self.cookerState = cookerClean - self.cookerAction = cookerRun + self.state = state.initial def parseConfiguration(self): @@ -668,9 +659,9 @@ class BBCooker: def buildFileIdle(server, rq, abort): - if abort or self.cookerAction == cookerStop: + if abort or self.state == state.stop: rq.finish_runqueue(True) - elif self.cookerAction == cookerShutdown: + elif self.state == state.shutdown: rq.finish_runqueue(False) failures = 0 try: @@ -705,9 +696,9 @@ class BBCooker: targets = self.checkPackages(targets) def buildTargetsIdle(server, rq, abort): - if abort or self.cookerAction == cookerStop: + if abort or self.state == state.stop: rq.finish_runqueue(True) - elif self.cookerAction == cookerShutdown: + elif self.state == state.shutdown: rq.finish_runqueue(False) failures = 0 try: @@ -747,12 +738,10 @@ class BBCooker: self.server.register_idle_function(buildTargetsIdle, rq) def updateCache(self): - - if self.cookerState == cookerParsed: + if self.state == state.running: return - if self.cookerState != cookerParsing: - + if self.state != state.parsing: self.parseConfiguration () # Import Psyco if available and not disabled @@ -782,12 +771,12 @@ class BBCooker: bb.data.renameVar("__depends", "__base_depends", self.configuration.data) self.parser = CookerParser(self, filelist, masked) - self.cookerState = cookerParsing + self.state = state.parsing if not self.parser.parse_next(): collectlog.debug(1, "parsing complete") self.buildDepgraph() - self.cookerState = cookerParsed + self.state = state.running return None return True |