summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/runqueue.py
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-05 11:41:46 +0000
commit47e5c456a20432b511d830df9cbd4113a4352b2c (patch)
tree46812114a7cddcdb90619e64b4a920c56513d714 /bitbake/lib/bb/runqueue.py
parenta45d5e201c6fdfc12663de65d9872ff681fcaa79 (diff)
downloadpoky-47e5c456a20432b511d830df9cbd4113a4352b2c.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: 3428e3c54eb5cc03ff96f9cee6dc839afee7a419) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-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 774cdbca0b..7d4cbed775 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 not self.runtaskentries: 958 if not self.runtaskentries:
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 not self.runtaskentries: 983 if not self.runtaskentries: