summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-12-08 14:30:33 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:47 +0000
commit825e5045f40185666605392138289448e33ec72d (patch)
tree37ffa7fb4a139f7c6bc7801ed016d66c0aa1ce29 /bitbake/lib/bb
parentac4d926f413b127810130ad7a442e6daf1fdd1b9 (diff)
downloadpoky-825e5045f40185666605392138289448e33ec72d.tar.gz
cooker: merge cookerState and cookerAction
(Bitbake rev: c7c8945ef7ca9465312e630b7fa5f0a87ac8b6c7) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/command.py7
-rw-r--r--bitbake/lib/bb/cooker.py33
2 files changed, 15 insertions, 25 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 9a8d689e2a..654ede0e85 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -81,7 +81,8 @@ class Command:
81 (command, options) = self.currentAsyncCommand 81 (command, options) = self.currentAsyncCommand
82 commandmethod = getattr(CommandsAsync, command) 82 commandmethod = getattr(CommandsAsync, command)
83 needcache = getattr( commandmethod, "needcache" ) 83 needcache = getattr( commandmethod, "needcache" )
84 if needcache and self.cooker.cookerState != bb.cooker.cookerParsed: 84 if (needcache and self.cooker.state in
85 (bb.cooker.state.initial, bb.cooker.state.parsing)):
85 self.cooker.updateCache() 86 self.cooker.updateCache()
86 return True 87 return True
87 else: 88 else:
@@ -123,13 +124,13 @@ class CommandsSync:
123 """ 124 """
124 Trigger cooker 'shutdown' mode 125 Trigger cooker 'shutdown' mode
125 """ 126 """
126 command.cooker.cookerAction = bb.cooker.cookerShutdown 127 command.cooker.state = bb.cooker.state.shutdown
127 128
128 def stateStop(self, command, params): 129 def stateStop(self, command, params):
129 """ 130 """
130 Stop the cooker 131 Stop the cooker
131 """ 132 """
132 command.cooker.cookerAction = bb.cooker.cookerStop 133 command.cooker.state = bb.cooker.state.stop
133 134
134 def getCmdLineAction(self, command, params): 135 def getCmdLineAction(self, command, params):
135 """ 136 """
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index bf896e9428..9f4afbb59e 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -51,16 +51,8 @@ class NothingToBuild(Exception):
51 Exception raised when there is nothing to build 51 Exception raised when there is nothing to build
52 """ 52 """
53 53
54 54class state:
55# Different states cooker can be in 55 initial, parsing, running, shutdown, stop = range(5)
56cookerClean = 1
57cookerParsing = 2
58cookerParsed = 3
59
60# Different action states the cooker can be in
61cookerRun = 1 # Cooker is running normally
62cookerShutdown = 2 # Active tasks should be brought to a controlled stop
63cookerStop = 3 # Stop, now!
64 56
65#============================================================================# 57#============================================================================#
66# BBCooker 58# BBCooker
@@ -112,8 +104,7 @@ class BBCooker:
112 termios.tcsetattr(fd, termios.TCSANOW, tcattr) 104 termios.tcsetattr(fd, termios.TCSANOW, tcattr)
113 105
114 self.command = bb.command.Command(self) 106 self.command = bb.command.Command(self)
115 self.cookerState = cookerClean 107 self.state = state.initial
116 self.cookerAction = cookerRun
117 108
118 def parseConfiguration(self): 109 def parseConfiguration(self):
119 110
@@ -681,9 +672,9 @@ class BBCooker:
681 672
682 def buildFileIdle(server, rq, abort): 673 def buildFileIdle(server, rq, abort):
683 674
684 if abort or self.cookerAction == cookerStop: 675 if abort or self.state == state.stop:
685 rq.finish_runqueue(True) 676 rq.finish_runqueue(True)
686 elif self.cookerAction == cookerShutdown: 677 elif self.state == state.shutdown:
687 rq.finish_runqueue(False) 678 rq.finish_runqueue(False)
688 failures = 0 679 failures = 0
689 try: 680 try:
@@ -718,9 +709,9 @@ class BBCooker:
718 targets = self.checkPackages(targets) 709 targets = self.checkPackages(targets)
719 710
720 def buildTargetsIdle(server, rq, abort): 711 def buildTargetsIdle(server, rq, abort):
721 if abort or self.cookerAction == cookerStop: 712 if abort or self.state == state.stop:
722 rq.finish_runqueue(True) 713 rq.finish_runqueue(True)
723 elif self.cookerAction == cookerShutdown: 714 elif self.state == state.shutdown:
724 rq.finish_runqueue(False) 715 rq.finish_runqueue(False)
725 failures = 0 716 failures = 0
726 try: 717 try:
@@ -763,12 +754,10 @@ class BBCooker:
763 self.server.register_idle_function(buildTargetsIdle, rq) 754 self.server.register_idle_function(buildTargetsIdle, rq)
764 755
765 def updateCache(self): 756 def updateCache(self):
766 757 if self.state == state.running:
767 if self.cookerState == cookerParsed:
768 return 758 return
769 759
770 if self.cookerState != cookerParsing: 760 if self.state != state.parsing:
771
772 self.parseConfiguration () 761 self.parseConfiguration ()
773 762
774 # Import Psyco if available and not disabled 763 # Import Psyco if available and not disabled
@@ -798,12 +787,12 @@ class BBCooker:
798 bb.data.renameVar("__depends", "__base_depends", self.configuration.data) 787 bb.data.renameVar("__depends", "__base_depends", self.configuration.data)
799 788
800 self.parser = CookerParser(self, filelist, masked) 789 self.parser = CookerParser(self, filelist, masked)
801 self.cookerState = cookerParsing 790 self.state = state.parsing
802 791
803 if not self.parser.parse_next(): 792 if not self.parser.parse_next():
804 collectlog.debug(1, "parsing complete") 793 collectlog.debug(1, "parsing complete")
805 self.buildDepgraph() 794 self.buildDepgraph()
806 self.cookerState = cookerParsed 795 self.state = state.running
807 return None 796 return None
808 797
809 return True 798 return True