summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-04 14:23:43 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-21 11:35:37 +0000
commita5d653f69371f3d7a815adaa1bab292d58dccf9f (patch)
treed46465869670465d320c2d1d4884a40742778ed6
parent8fe7b8d53a4ffbdd950d6269fd68739a22c75c45 (diff)
downloadpoky-a5d653f69371f3d7a815adaa1bab292d58dccf9f.tar.gz
bitbake: runqueue: Fix runall option task deletion ordering issue
The runbuild option handling in runqueue was flawed as items deleted from the main task list may be dependencies and hence cause index errors. Rather than modify runtaskentries straight away, compute a new shorted list and use that as an input to the second phase. This avoids the need to add tasks back to the list meaning delcount can be simplifed to a simple counter. The second use case in runonly doen't re-add items so doesn't have this issue. (Bitbake rev: 44574295d54ec9e48c9ecdd4eb869c4494e77679) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 3428e3c54eb5cc03ff96f9cee6dc839afee7a419) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/runqueue.py35
1 files changed, 16 insertions, 19 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 10511a09dc..3300bb4f98 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -926,38 +926,35 @@ class RunQueueData:
926 # 926 #
927 # Once all active tasks are marked, prune the ones we don't need. 927 # Once all active tasks are marked, prune the ones we don't need.
928 928
929 delcount = {}
930 for tid in list(self.runtaskentries.keys()):
931 if tid not in runq_build:
932 delcount[tid] = self.runtaskentries[tid]
933 del self.runtaskentries[tid]
934
935 # Handle --runall 929 # Handle --runall
936 if self.cooker.configuration.runall: 930 if self.cooker.configuration.runall:
937 # re-run the mark_active and then drop unused tasks from new list 931 # re-run the mark_active and then drop unused tasks from new list
938 runq_build = {} 932 reduced_tasklist = set(self.runtaskentries.keys())
933 for tid in list(self.runtaskentries.keys()):
934 if tid not in runq_build:
935 reduced_tasklist.remove(tid)
939 936
940 for task in self.cooker.configuration.runall: 937 for task in self.cooker.configuration.runall:
941 if not task.startswith("do_"): 938 if not task.startswith("do_"):
942 task = "do_{0}".format(task) 939 task = "do_{0}".format(task)
943 runall_tids = set() 940 runall_tids = set()
944 for tid in list(self.runtaskentries): 941 for tid in reduced_tasklist:
945 wanttid = "{0}:{1}".format(fn_from_tid(tid), task) 942 wanttid = "{0}:{1}".format(fn_from_tid(tid), task)
946 if wanttid in delcount:
947 self.runtaskentries[wanttid] = delcount[wanttid]
948 if wanttid in self.runtaskentries: 943 if wanttid in self.runtaskentries:
949 runall_tids.add(wanttid) 944 runall_tids.add(wanttid)
950 945
951 for tid in list(runall_tids): 946 for tid in list(runall_tids):
952 mark_active(tid,1) 947 mark_active(tid, 1)
953 if self.cooker.configuration.force: 948 if self.cooker.configuration.force:
954 invalidate_task(tid, False) 949 invalidate_task(tid, False)
955 950
956 for tid in list(self.runtaskentries.keys()): 951 delcount = set()
957 if tid not in runq_build: 952 for tid in list(self.runtaskentries.keys()):
958 delcount[tid] = self.runtaskentries[tid] 953 if tid not in runq_build:
959 del self.runtaskentries[tid] 954 delcount.add(tid)
955 del self.runtaskentries[tid]
960 956
957 if self.cooker.configuration.runall:
961 if len(self.runtaskentries) == 0: 958 if len(self.runtaskentries) == 0:
962 bb.msg.fatal("RunQueue", "Could not find any tasks with the tasknames %s to run within the recipes of the taskgraphs of the targets %s" % (str(self.cooker.configuration.runall), str(self.targets))) 959 bb.msg.fatal("RunQueue", "Could not find any tasks with the tasknames %s to run within the recipes of the taskgraphs of the targets %s" % (str(self.cooker.configuration.runall), str(self.targets)))
963 960
@@ -971,16 +968,16 @@ class RunQueueData:
971 for task in self.cooker.configuration.runonly: 968 for task in self.cooker.configuration.runonly:
972 if not task.startswith("do_"): 969 if not task.startswith("do_"):
973 task = "do_{0}".format(task) 970 task = "do_{0}".format(task)
974 runonly_tids = { k: v for k, v in self.runtaskentries.items() if taskname_from_tid(k) == task } 971 runonly_tids = [k for k in self.runtaskentries.keys() if taskname_from_tid(k) == task]
975 972
976 for tid in list(runonly_tids): 973 for tid in runonly_tids:
977 mark_active(tid,1) 974 mark_active(tid, 1)
978 if self.cooker.configuration.force: 975 if self.cooker.configuration.force:
979 invalidate_task(tid, False) 976 invalidate_task(tid, False)
980 977
981 for tid in list(self.runtaskentries.keys()): 978 for tid in list(self.runtaskentries.keys()):
982 if tid not in runq_build: 979 if tid not in runq_build:
983 delcount[tid] = self.runtaskentries[tid] 980 delcount.add(tid)
984 del self.runtaskentries[tid] 981 del self.runtaskentries[tid]
985 982
986 if len(self.runtaskentries) == 0: 983 if len(self.runtaskentries) == 0: