Skip to contentSkip to conversation

Respect force flag in runall and runonly

RFC New Joshua Watt 1 participant 2 messages Mar 27, 2018

lore
Share & tools
lore
#0 lore raw

Implements the ability to run bitbake commands like:

 $ bitbake -f --runall fetch core-image-mimimal
 $ bitbake -f --runonly fetch core-image-minimal

which will invalidate the stamps for all affected tasks forcing them to run even if they have already.

I've found this useful in a few circumstances. Most recently, I was attempting to do A/B performance comparison of so package QA checks, so it was pretty easy to figure out the impact of various QA checks with:

 $ time bitbake -f --runall package_qa core-image-minimal

Additionally, I currently do a number of actions like this (because we don't have runall):

 $ bitbake -g <image>
 $ xargs -a pn-buildlist bitbake -f -c <action>

And I would like to replace them with

 $ bitbake -f --runall <action> <image>

Is this something that is even necessary/wanted?

#1 lore raw

RFC 1/1 bitbake: respect force flag in runall and runonly

Specifying the force flag will now cause runall and runonly to invalidate the tasks before running them.

---
 bitbake/lib/bb/runqueue.py | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
bitbake/lib/bb/runqueue.py +20 -15
index f2e52cf758c..9ae5c9cb177 100644
@@ -795,6 +795,21 @@ class RunQueueData:
             for depend in depends:
                 mark_active(depend, depth+1)
 
+        def invalidate_task(tid, error_nostamp):
+            (mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
+            taskdep = self.dataCaches[mc].task_deps[taskfn]
+            if fn + ":" + taskname not in taskData[mc].taskentries:
+                logger.warning("Task %s does not exist, invalidating this task will have no effect" % taskname)
+            if 'nostamp' in taskdep and taskname in taskdep['nostamp']:
+                if error_nostamp:
+                    bb.fatal("Task %s is marked nostamp, cannot invalidate this task" % taskname)
+                else:
+                    bb.debug(1, "Task %s is marked nostamp, cannot invalidate this task" % taskname)
+            else:
+                logger.verbose("Invalidate task %s, %s", taskname, fn)
+                bb.parse.siggen.invalidate_task(taskname, self.dataCaches[mc], fn)
+
+
         self.target_tids = []
         for (mc, target, task, fn) in self.targets:
 
@@ -863,6 +878,8 @@ class RunQueueData:
 
                 for tid in list(runall_tids):
                     mark_active(tid,1)
+                    if self.cooker.configuration.force:
+                        invalidate_task(tid, False)
 
             for tid in list(self.runtaskentries.keys()):
                 if tid not in runq_build:
@@ -884,6 +901,8 @@ class RunQueueData:
 
                 for tid in list(runonly_tids):
                     mark_active(tid,1)
+                    if self.cooker.configuration.force:
+                        invalidate_task(tid, False)
 
             for tid in list(self.runtaskentries.keys()):
                 if tid not in runq_build:
@@ -1040,7 +1059,7 @@ class RunQueueData:
 
         # Create a whitelist usable by the stamp checks
         self.stampfnwhitelist = {}
-        for mc in self.taskData: 
+        for mc in self.taskData:
             self.stampfnwhitelist[mc] = []
             for entry in self.stampwhitelist.split():
                 if entry not in self.taskData[mc].build_targets:
@@ -1060,20 +1079,6 @@ class RunQueueData:
                     continue
                 self.runq_setscene_tids.append(tid)
 
-        def invalidate_task(tid, error_nostamp):
-            (mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
-            taskdep = self.dataCaches[mc].task_deps[taskfn]
-            if fn + ":" + taskname not in taskData[mc].taskentries:
-                logger.warning("Task %s does not exist, invalidating this task will have no effect" % taskname)
-            if 'nostamp' in taskdep and taskname in taskdep['nostamp']:
-                if error_nostamp:
-                    bb.fatal("Task %s is marked nostamp, cannot invalidate this task" % taskname)
-                else:
-                    bb.debug(1, "Task %s is marked nostamp, cannot invalidate this task" % taskname)
-            else:
-                logger.verbose("Invalidate task %s, %s", taskname, fn)
-                bb.parse.siggen.invalidate_task(taskname, self.dataCaches[mc], fn)
-
         self.init_progress_reporter.next_stage()
 
         # Invalidate task if force mode active
Signature · 1 line
2.14.3