summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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