summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 17:23:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 20:38:27 +0100
commit355338c40c6fc65d10980cfd75e9ab5ff96ed43a (patch)
tree1f9564de6685fd2237e14809e353249017531416 /bitbake/lib/bb/cooker.py
parent9f33dde6e71b7b66db357b1bf289ae63e0db77d2 (diff)
downloadpoky-355338c40c6fc65d10980cfd75e9ab5ff96ed43a.tar.gz
bitbake/cooker.py: Misc sync with upstream
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py29
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
28import itertools 28import itertools
29import logging 29import logging
30import multiprocessing 30import multiprocessing
31import signal
32import sre_constants 31import sre_constants
33import threading 32import threading
34from cStringIO import StringIO 33from 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' %