[gnome-continuous-yocto/gnomeostree-3.28-rocko: 6631/8267] bitbake: cooker: Use multiple BuildStarted events for multiconfig



commit f85f1ef24e59c0c058f96f0dfa82e50969fd580b
Author: Richard Purdie <richard purdie linuxfoundation org>
Date:   Wed Apr 26 21:03:15 2017 +0100

    bitbake: cooker: Use multiple BuildStarted events for multiconfig
    
    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.
    
    We need to ensure that BUILDNAME, BUILDSTART and DATE/TIME are set consistently
    in all the different multiconfig datastores. These events can write to the
    datastore so copies are not used. buildFile was also cleaned up to ensure it
    uses the right datastore in various places.
    
    (Bitbake rev: 0b00f0382780ab5390a5c3f756a9b4efafe0aec8)
    
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/bb/cooker.py |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 479dc5a..dc8f54c 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1172,12 +1172,14 @@ class BBCooker:
         """
         Setup any variables needed before starting a build
         """
-        t = time.gmtime() 
-        if not self.data.getVar("BUILDNAME", False):
-            self.data.setVar("BUILDNAME", "${DATE}${TIME}")
-        self.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S', t))
-        self.data.setVar("DATE", time.strftime('%Y%m%d', t))
-        self.data.setVar("TIME", time.strftime('%H%M%S', t))
+        t = time.gmtime()
+        for mc in self.databuilder.mcdata:
+            ds = self.databuilder.mcdata[mc]
+            if not ds.getVar("BUILDNAME", False):
+                ds.setVar("BUILDNAME", "${DATE}${TIME}")
+            ds.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S', t))
+            ds.setVar("DATE", time.strftime('%Y%m%d', t))
+            ds.setVar("TIME", time.strftime('%H%M%S', t))
 
     def reset_mtime_caches(self):
         """
@@ -1292,10 +1294,10 @@ class BBCooker:
         # Setup taskdata structure
         taskdata = {}
         taskdata[mc] = bb.taskdata.TaskData(self.configuration.abort)
-        taskdata[mc].add_provider(self.data, self.recipecaches[mc], item)
+        taskdata[mc].add_provider(self.databuilder.mcdata[mc], self.recipecaches[mc], item)
 
-        buildname = self.data.getVar("BUILDNAME")
-        bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.data)
+        buildname = self.databuilder.mcdata[mc].getVar("BUILDNAME")
+        bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.databuilder.mcdata[mc])
 
         # Execute the runqueue
         runlist = [[mc, item, task, fn]]
@@ -1325,7 +1327,7 @@ class BBCooker:
                 return False
 
             if not retval:
-                bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, 
failures, interrupted), self.data)
+                bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, 
failures, interrupted), self.databuilder.mcdata[mc])
                 self.command.finishAsyncCommand(msg)
                 return False
             if retval is True:
@@ -1362,7 +1364,8 @@ 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:
+                        bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, 
targets, failures, interrupted), self.databuilder.mcdata[mc])
                 finally:
                     self.command.finishAsyncCommand(msg)
                 return False
@@ -1395,7 +1398,8 @@ 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:
+            bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.databuilder.mcdata[mc])
 
         rq = bb.runqueue.RunQueue(self, self.data, self.recipecaches, taskdata, runlist)
         if 'universe' in targets:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]