summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
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
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')
-rw-r--r--bitbake/lib/bb/cookerdata.py3
-rwxr-xr-xbitbake/lib/bb/main.py8
-rw-r--r--bitbake/lib/bb/runqueue.py49
3 files changed, 46 insertions, 14 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index fab47c75f5..c67f012b72 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -143,7 +143,8 @@ class CookerConfiguration(object):
143 self.writeeventlog = False 143 self.writeeventlog = False
144 self.server_only = False 144 self.server_only = False
145 self.limited_deps = False 145 self.limited_deps = False
146 self.runall = None 146 self.runall = []
147 self.runonly = []
147 148
148 self.env = {} 149 self.env = {}
149 150
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py
index 7711b290de..f4474e410f 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -292,8 +292,12 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters):
292 help="Writes the event log of the build to a bitbake event json file. " 292 help="Writes the event log of the build to a bitbake event json file. "
293 "Use '' (empty string) to assign the name automatically.") 293 "Use '' (empty string) to assign the name automatically.")
294 294
295 parser.add_option("", "--runall", action="store", dest="runall", 295 parser.add_option("", "--runall", action="append", dest="runall",
296 help="Run the specified task for all build targets and their dependencies.") 296 help="Run the specified task for any recipe in the taskgraph of the specified target (even if it wouldn't otherwise have run).")
297
298 parser.add_option("", "--runonly", action="append", dest="runonly",
299 help="Run only the specified task within the taskgraph of the specified targets (and any task dependencies those tasks may have).")
300
297 301
298 options, targets = parser.parse_args(argv) 302 options, targets = parser.parse_args(argv)
299 303
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