diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-08 14:30:33 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:47 +0000 |
commit | 825e5045f40185666605392138289448e33ec72d (patch) | |
tree | 37ffa7fb4a139f7c6bc7801ed016d66c0aa1ce29 /bitbake/lib/bb/cooker.py | |
parent | ac4d926f413b127810130ad7a442e6daf1fdd1b9 (diff) | |
download | poky-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/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 33 |
1 files changed, 11 insertions, 22 deletions
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 | 54 | class state: | |
55 | # Different states cooker can be in | 55 | initial, parsing, running, shutdown, stop = range(5) |
56 | cookerClean = 1 | ||
57 | cookerParsing = 2 | ||
58 | cookerParsed = 3 | ||
59 | |||
60 | # Different action states the cooker can be in | ||
61 | cookerRun = 1 # Cooker is running normally | ||
62 | cookerShutdown = 2 # Active tasks should be brought to a controlled stop | ||
63 | cookerStop = 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 |