diff options
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index b66d0038ac..dc196ae801 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -28,7 +28,6 @@ import atexit | |||
| 28 | import itertools | 28 | import itertools |
| 29 | import logging | 29 | import logging |
| 30 | import multiprocessing | 30 | import multiprocessing |
| 31 | import signal | ||
| 32 | import sre_constants | 31 | import sre_constants |
| 33 | import threading | 32 | import threading |
| 34 | from cStringIO import StringIO | 33 | from cStringIO import StringIO |
| @@ -148,6 +147,8 @@ class BBCooker: | |||
| 148 | self.command = bb.command.Command(self) | 147 | self.command = bb.command.Command(self) |
| 149 | self.state = state.initial | 148 | self.state = state.initial |
| 150 | 149 | ||
| 150 | self.parser = None | ||
| 151 | |||
| 151 | def parseConfiguration(self): | 152 | def parseConfiguration(self): |
| 152 | 153 | ||
| 153 | 154 | ||
| @@ -799,9 +800,6 @@ class BBCooker: | |||
| 799 | buildname = bb.data.getVar("BUILDNAME", self.configuration.data) | 800 | buildname = bb.data.getVar("BUILDNAME", self.configuration.data) |
| 800 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.configuration.event_data) | 801 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.configuration.event_data) |
| 801 | 802 | ||
| 802 | # Clear locks | ||
| 803 | bb.fetch.persistent_database_connection = {} | ||
| 804 | |||
| 805 | # Execute the runqueue | 803 | # Execute the runqueue |
| 806 | runlist = [[item, "do_%s" % task]] | 804 | runlist = [[item, "do_%s" % task]] |
| 807 | 805 | ||
| @@ -821,6 +819,10 @@ class BBCooker: | |||
| 821 | buildlog.error("'%s' failed" % taskdata.fn_index[fnid]) | 819 | buildlog.error("'%s' failed" % taskdata.fn_index[fnid]) |
| 822 | failures += len(exc.args) | 820 | failures += len(exc.args) |
| 823 | retval = False | 821 | retval = False |
| 822 | except SystemExit as exc: | ||
| 823 | self.command.finishAsyncCommand() | ||
| 824 | return False | ||
| 825 | |||
| 824 | if not retval: | 826 | if not retval: |
| 825 | bb.event.fire(bb.event.BuildCompleted(buildname, item, failures), self.configuration.event_data) | 827 | bb.event.fire(bb.event.BuildCompleted(buildname, item, failures), self.configuration.event_data) |
| 826 | self.command.finishAsyncCommand() | 828 | self.command.finishAsyncCommand() |
| @@ -858,6 +860,10 @@ class BBCooker: | |||
| 858 | buildlog.error("'%s' failed" % taskdata.fn_index[fnid]) | 860 | buildlog.error("'%s' failed" % taskdata.fn_index[fnid]) |
| 859 | failures += len(exc.args) | 861 | failures += len(exc.args) |
| 860 | retval = False | 862 | retval = False |
| 863 | except SystemExit as exc: | ||
| 864 | self.command.finishAsyncCommand() | ||
| 865 | return False | ||
| 866 | |||
| 861 | if not retval: | 867 | if not retval: |
| 862 | bb.event.fire(bb.event.BuildCompleted(buildname, targets, failures), self.configuration.event_data) | 868 | bb.event.fire(bb.event.BuildCompleted(buildname, targets, failures), self.configuration.event_data) |
| 863 | self.command.finishAsyncCommand() | 869 | self.command.finishAsyncCommand() |
| @@ -883,9 +889,6 @@ class BBCooker: | |||
| 883 | runlist.append([k, "do_%s" % task]) | 889 | runlist.append([k, "do_%s" % task]) |
| 884 | taskdata.add_unresolved(localdata, self.status) | 890 | taskdata.add_unresolved(localdata, self.status) |
| 885 | 891 | ||
| 886 | # Clear locks | ||
| 887 | bb.fetch.persistent_database_connection = {} | ||
| 888 | |||
| 889 | rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist) | 892 | rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist) |
| 890 | 893 | ||
| 891 | self.server_registration_cb(buildTargetsIdle, rq) | 894 | self.server_registration_cb(buildTargetsIdle, rq) |
| @@ -894,6 +897,10 @@ class BBCooker: | |||
| 894 | if self.state == state.running: | 897 | if self.state == state.running: |
| 895 | return | 898 | return |
| 896 | 899 | ||
| 900 | if self.state in (state.shutdown, state.stop): | ||
| 901 | self.parser.shutdown(clean=False) | ||
| 902 | sys.exit(1) | ||
| 903 | |||
| 897 | if self.state != state.parsing: | 904 | if self.state != state.parsing: |
| 898 | self.parseConfiguration () | 905 | self.parseConfiguration () |
| 899 | 906 | ||
| @@ -1194,9 +1201,8 @@ class CookerParser(object): | |||
| 1194 | 1201 | ||
| 1195 | def start(self): | 1202 | def start(self): |
| 1196 | def init(cfg): | 1203 | def init(cfg): |
| 1197 | signal.signal(signal.SIGINT, signal.SIG_IGN) | ||
| 1198 | multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cooker.configuration.data, ), exitpriority=1) | ||
| 1199 | parse_file.cfg = cfg | 1204 | parse_file.cfg = cfg |
| 1205 | multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cooker.configuration.data, ), exitpriority=1) | ||
| 1200 | 1206 | ||
| 1201 | self.results = self.load_cached() | 1207 | self.results = self.load_cached() |
| 1202 | 1208 | ||
| @@ -1225,7 +1231,7 @@ class CookerParser(object): | |||
| 1225 | 1231 | ||
| 1226 | sync = threading.Thread(target=self.bb_cache.sync) | 1232 | sync = threading.Thread(target=self.bb_cache.sync) |
| 1227 | sync.start() | 1233 | sync.start() |
| 1228 | atexit.register(lambda: sync.join()) | 1234 | multiprocessing.util.Finalize(None, sync.join, exitpriority=-100) |
| 1229 | bb.codeparser.parser_cache_savemerge(self.cooker.configuration.data) | 1235 | bb.codeparser.parser_cache_savemerge(self.cooker.configuration.data) |
| 1230 | 1236 | ||
| 1231 | def load_cached(self): | 1237 | def load_cached(self): |
| @@ -1239,9 +1245,6 @@ class CookerParser(object): | |||
| 1239 | except StopIteration: | 1245 | except StopIteration: |
| 1240 | self.shutdown() | 1246 | self.shutdown() |
| 1241 | return False | 1247 | return False |
| 1242 | except KeyboardInterrupt: | ||
| 1243 | self.shutdown(clean=False) | ||
| 1244 | raise | ||
| 1245 | except ParsingFailure as exc: | 1248 | except ParsingFailure as exc: |
| 1246 | self.shutdown(clean=False) | 1249 | self.shutdown(clean=False) |
| 1247 | bb.fatal('Unable to parse %s: %s' % | 1250 | bb.fatal('Unable to parse %s: %s' % |
