summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/runqueue.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-10 09:21:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-11 11:54:26 +0100
commitd48d8aa1e7add733de277f050c71b84a84ce9c6b (patch)
tree6f6aa9a88a61a98e1296d1e35b9284f70e0aef84 /bitbake/lib/bb/runqueue.py
parent4a2147f54fc386ed3b9fdc9481ae95a358130854 (diff)
downloadpoky-d48d8aa1e7add733de277f050c71b84a84ce9c6b.tar.gz
bitbake/runqueue: Fix 'full' stamp checking to be more efficient and cache results
This should fix issues where bitbake would seemingly lock up when checking certain configurations of stampfiles. The cache is kept within the runqueue since that feels like the right place to associate this cache data. (Bitbake rev: e95755c4931b26d9f8102ed3652dff969145cfc9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r--bitbake/lib/bb/runqueue.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 462c685d2f..60ef5ea976 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -875,7 +875,7 @@ class RunQueue:
875 bb.msg.fatal("RunQueue", "check_stamps fatal internal error") 875 bb.msg.fatal("RunQueue", "check_stamps fatal internal error")
876 return current 876 return current
877 877
878 def check_stamp_task(self, task, taskname = None, recurse = False): 878 def check_stamp_task(self, task, taskname = None, recurse = False, cache = None):
879 def get_timestamp(f): 879 def get_timestamp(f):
880 try: 880 try:
881 if not os.access(f, os.F_OK): 881 if not os.access(f, os.F_OK):
@@ -911,10 +911,16 @@ class RunQueue:
911 if taskname != "do_setscene" and taskname.endswith("_setscene"): 911 if taskname != "do_setscene" and taskname.endswith("_setscene"):
912 return True 912 return True
913 913
914 if cache is None:
915 cache = {}
916
914 iscurrent = True 917 iscurrent = True
915 t1 = get_timestamp(stampfile) 918 t1 = get_timestamp(stampfile)
916 for dep in self.rqdata.runq_depends[task]: 919 for dep in self.rqdata.runq_depends[task]:
917 if iscurrent: 920 if iscurrent:
921 if dep in cache:
922 iscurrent = cache[dep]
923 continue
918 fn2 = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[dep]] 924 fn2 = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[dep]]
919 taskname2 = self.rqdata.runq_task[dep] 925 taskname2 = self.rqdata.runq_task[dep]
920 stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCache, fn2) 926 stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCache, fn2)
@@ -931,7 +937,9 @@ class RunQueue:
931 logger.debug(2, 'Stampfile %s < %s', stampfile, stampfile2) 937 logger.debug(2, 'Stampfile %s < %s', stampfile, stampfile2)
932 iscurrent = False 938 iscurrent = False
933 if recurse and iscurrent: 939 if recurse and iscurrent:
934 iscurrent = self.check_stamp_task(dep, recurse=True) 940 iscurrent = self.check_stamp_task(dep, recurse=True, cache=cache)
941 cache[dep] = iscurrent
942 cache[task] = iscurrent
935 return iscurrent 943 return iscurrent
936 944
937 def execute_runqueue(self): 945 def execute_runqueue(self):
@@ -1041,6 +1049,8 @@ class RunQueueExecute:
1041 self.build_stamps = {} 1049 self.build_stamps = {}
1042 self.failed_fnids = [] 1050 self.failed_fnids = []
1043 1051
1052 self.stampcache = {}
1053
1044 def runqueue_process_waitpid(self): 1054 def runqueue_process_waitpid(self):
1045 """ 1055 """
1046 Return none is there are no processes awaiting result collection, otherwise 1056 Return none is there are no processes awaiting result collection, otherwise
@@ -1384,7 +1394,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
1384 self.task_skip(task) 1394 self.task_skip(task)
1385 return True 1395 return True
1386 1396
1387 if self.rq.check_stamp_task(task, taskname): 1397 if self.rq.check_stamp_task(task, taskname, cache=self.stampcache):
1388 logger.debug(2, "Stamp current task %s (%s)", task, 1398 logger.debug(2, "Stamp current task %s (%s)", task,
1389 self.rqdata.get_user_idstring(task)) 1399 self.rqdata.get_user_idstring(task))
1390 self.task_skip(task) 1400 self.task_skip(task)
@@ -1568,7 +1578,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
1568 bb.build.make_stamp(taskname + "_setscene", self.rqdata.dataCache, fn) 1578 bb.build.make_stamp(taskname + "_setscene", self.rqdata.dataCache, fn)
1569 continue 1579 continue
1570 1580
1571 if self.rq.check_stamp_task(realtask, taskname + "_setscene"): 1581 if self.rq.check_stamp_task(realtask, taskname + "_setscene", cache=self.stampcache):
1572 logger.debug(2, 'Setscene stamp current for task %s(%s)', task, self.rqdata.get_user_idstring(realtask)) 1582 logger.debug(2, 'Setscene stamp current for task %s(%s)', task, self.rqdata.get_user_idstring(realtask))
1573 stamppresent.append(task) 1583 stamppresent.append(task)
1574 self.task_skip(task) 1584 self.task_skip(task)
@@ -1661,7 +1671,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
1661 fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[realtask]] 1671 fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[realtask]]
1662 1672
1663 taskname = self.rqdata.runq_task[realtask] + "_setscene" 1673 taskname = self.rqdata.runq_task[realtask] + "_setscene"
1664 if self.rq.check_stamp_task(realtask, self.rqdata.runq_task[realtask], recurse = True): 1674 if self.rq.check_stamp_task(realtask, self.rqdata.runq_task[realtask], recurse = True, cache=self.stampcache):
1665 logger.debug(2, 'Stamp for underlying task %s(%s) is current, so skipping setscene variant', 1675 logger.debug(2, 'Stamp for underlying task %s(%s) is current, so skipping setscene variant',
1666 task, self.rqdata.get_user_idstring(realtask)) 1676 task, self.rqdata.get_user_idstring(realtask))
1667 self.task_failoutright(task) 1677 self.task_failoutright(task)
@@ -1673,7 +1683,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
1673 self.task_failoutright(task) 1683 self.task_failoutright(task)
1674 return True 1684 return True
1675 1685
1676 if self.rq.check_stamp_task(realtask, taskname): 1686 if self.rq.check_stamp_task(realtask, taskname, cache=self.stampcache):
1677 logger.debug(2, 'Setscene stamp current task %s(%s), so skip it and its dependencies', 1687 logger.debug(2, 'Setscene stamp current task %s(%s), so skip it and its dependencies',
1678 task, self.rqdata.get_user_idstring(realtask)) 1688 task, self.rqdata.get_user_idstring(realtask))
1679 self.task_skip(task) 1689 self.task_skip(task)