[bitbake-devel] [PATCH 2/3] cooker: Experiment with multiple BuildStarted for multiconfig

Richard Purdie richard.purdie at linuxfoundation.org
Thu Jul 6 15:48:06 UTC 2017


Currently builds in multiple TMPDIRs with multiconfig can break
since the BuildStarted event is used to create directory strutures in several
cases (e.g. buildstats.bbclass) and there is only on BuildStarted event
generated in a multiconfig build.

We have two options, a) to add a new MultiConfigBuildStarted event which is
generated once per multiconfig, or b) allow multiple BuildStarted events.

Having reviewed the code and current users of BuildStarted, sending one event
per multiconfig seems like its the best way forward and the existing code looks
able to cope with the duplication of events. I did also check toaster and I think
that can handle this issue too (multiconfig builds may have other issues there).

I'm therefore proposing we send multiple BuildStarted events for multiconfig
and for consistency, send multiple BuildCompleted events too.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/cooker.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 479dc5a..c140220 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1191,6 +1191,10 @@ class BBCooker:
         if siggen_cache:
             bb.parse.siggen.checksum_cache.mtime_cache.clear()
 
+    def copyBuildVars(self, d):
+        for i in ["BUILDNAME", "BUILDSTART", "DATE", "TIME"]:
+            d.setVar(i, self.data.getVar(i, False))
+
     def matchFiles(self, bf):
         """
         Find the .bb files which match the expression in 'buildfile'.
@@ -1362,7 +1366,10 @@ class BBCooker:
 
             if not retval:
                 try:
-                    bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.data)
+                    for mc in self.multiconfigs:
+                        localdata = data.createCopy(self.databuilder.mcdata[mc])
+                        self.copyBuildVars(localdata)
+                        bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), localdata)
                 finally:
                     self.command.finishAsyncCommand(msg)
                 return False
@@ -1395,7 +1402,10 @@ class BBCooker:
                 ntargets.append("multiconfig:%s:%s:%s" % (target[0], target[1], target[2]))
             ntargets.append("%s:%s" % (target[1], target[2]))
 
-        bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.data)
+        for mc in self.multiconfigs:
+            localdata = data.createCopy(self.databuilder.mcdata[mc])
+            self.copyBuildVars(localdata)
+            bb.event.fire(bb.event.BuildStarted(buildname, ntargets), localdata)
 
         rq = bb.runqueue.RunQueue(self, self.data, self.recipecaches, taskdata, runlist)
         if 'universe' in targets:
-- 
2.7.4




More information about the bitbake-devel mailing list