summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/runqueue.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-09 09:21:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-14 15:26:03 +0000
commitc75985f40a4fc9ff2217fd22d0f84c59f7cec82b (patch)
tree3be77ff397a1f6360dcfcfcc07f4f59ff86550b0 /bitbake/lib/bb/runqueue.py
parent1a78cdaea68c4e682ef26ac8c773307977fb81bc (diff)
downloadpoky-c75985f40a4fc9ff2217fd22d0f84c59f7cec82b.tar.gz
bitbake: main/runqueue: Rework runall task and add runonly option
The runall commandline option was confusing people. There are in fact two different behaviours people may want. a) For a given target (or set of targets) look through the task graph and run task X only if its present and would have been built. b) For a given target (or set of targets) look through the task graph and run task X if any recipe in the taskgraph has such a target even if it wasn't in the original task graph. I've decided to interpret the existing "runall" option as b), even if right now if behaves like a). For a), which is a valid use case, this patch adds a "runonly" option. With both behaviours present, I'm hoping we can then kill off the "fetchall", "checkuriall" and other tasks from OE metadata and replace them with this option. This would significantly speed up task graph processing. (Deleting the checkuriall and fetchall tasks takes "bitbake core-image-sato -g" from 22s to 8s). (Bitbake rev: 546a662c877b2d3af35e3996950582ed2df41fe4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r--bitbake/lib/bb/runqueue.py49
1 files changed, 38 insertions, 11 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index d7acfabef4..48df013155 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -841,30 +841,57 @@ class RunQueueData:
841 # 841 #
842 # Once all active tasks are marked, prune the ones we don't need. 842 # Once all active tasks are marked, prune the ones we don't need.
843 843
844 delcount = 0 844 delcount = {}
845 for tid in list(self.runtaskentries.keys()): 845 for tid in list(self.runtaskentries.keys()):
846 if tid not in runq_build: 846 if tid not in runq_build:
847 delcount[tid] = self.runtaskentries[tid]
847 del self.runtaskentries[tid] 848 del self.runtaskentries[tid]
848 delcount += 1
849 849
850 self.init_progress_reporter.next_stage() 850 # Handle --runall
851 if self.cooker.configuration.runall:
852 # re-run the mark_active and then drop unused tasks from new list
853 runq_build = {}
854
855 for task in self.cooker.configuration.runall:
856 runall_tids = set()
857 for tid in list(self.runtaskentries):
858 wanttid = fn_from_tid(tid) + ":do_%s" % task
859 if wanttid in delcount:
860 self.runtaskentries[wanttid] = delcount[wanttid]
861 if wanttid in self.runtaskentries:
862 runall_tids.add(wanttid)
863
864 for tid in list(runall_tids):
865 mark_active(tid,1)
866
867 for tid in list(self.runtaskentries.keys()):
868 if tid not in runq_build:
869 delcount[tid] = self.runtaskentries[tid]
870 del self.runtaskentries[tid]
851 871
852 if self.cooker.configuration.runall is not None: 872 if len(self.runtaskentries) == 0:
853 runall = "do_%s" % self.cooker.configuration.runall 873 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)))
854 runall_tids = { k: v for k, v in self.runtaskentries.items() if taskname_from_tid(k) == runall }
855 874
875 self.init_progress_reporter.next_stage()
876
877 # Handle runonly
878 if self.cooker.configuration.runonly:
856 # re-run the mark_active and then drop unused tasks from new list 879 # re-run the mark_active and then drop unused tasks from new list
857 runq_build = {} 880 runq_build = {}
858 for tid in list(runall_tids): 881
859 mark_active(tid,1) 882 for task in self.cooker.configuration.runonly:
883 runonly_tids = { k: v for k, v in self.runtaskentries.items() if taskname_from_tid(k) == "do_%s" % task }
884
885 for tid in list(runonly_tids):
886 mark_active(tid,1)
860 887
861 for tid in list(self.runtaskentries.keys()): 888 for tid in list(self.runtaskentries.keys()):
862 if tid not in runq_build: 889 if tid not in runq_build:
890 delcount[tid] = self.runtaskentries[tid]
863 del self.runtaskentries[tid] 891 del self.runtaskentries[tid]
864 delcount += 1
865 892
866 if len(self.runtaskentries) == 0: 893 if len(self.runtaskentries) == 0:
867 bb.msg.fatal("RunQueue", "No remaining tasks to run for build target %s with runall %s" % (target, runall)) 894 bb.msg.fatal("RunQueue", "Could not find any tasks with the tasknames %s to run within the taskgraphs of the targets %s" % (str(self.cooker.configuration.runonly), str(self.targets)))
868 895
869 # 896 #
870 # Step D - Sanity checks and computation 897 # Step D - Sanity checks and computation
@@ -877,7 +904,7 @@ class RunQueueData:
877 else: 904 else:
878 bb.msg.fatal("RunQueue", "No active tasks and not in --continue mode?! Please report this bug.") 905 bb.msg.fatal("RunQueue", "No active tasks and not in --continue mode?! Please report this bug.")
879 906
880 logger.verbose("Pruned %s inactive tasks, %s left", delcount, len(self.runtaskentries)) 907 logger.verbose("Pruned %s inactive tasks, %s left", len(delcount), len(self.runtaskentries))
881 908
882 logger.verbose("Assign Weightings") 909 logger.verbose("Assign Weightings")
883 910