Patchwork [bitbake-devel,2/7] bitbake: cooker, runqueue: send the task dependency tree

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 18, 2013, 12:15 p.m.
Message ID <97928e1d7425fd7e61427d7829330c4c482c6feb.1379505533.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58311/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 18, 2013, 12:15 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

Adding a CookerFeature that allows UIs to enable
receving a dependency tree once the task data has been
computed and the runQueue is ready to start.

This will allow the clients to display dependency
data in an efficient manner, and not recompute the runqueue
specifically to get the dependency data.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/bb/cooker.py   | 5 ++++-
 bitbake/lib/bb/runqueue.py | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 8776e18..dd45ae8 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -81,7 +81,7 @@  class SkippedPackage:
 
 
 class CookerFeatures(object):
-    _feature_list = [HOB_EXTRA_CACHES] = range(1)
+    _feature_list = [HOB_EXTRA_CACHES, SEND_DEPENDS_TREE] = range(2)
 
     def __init__(self):
         self._features=set()
@@ -457,7 +457,10 @@  class BBCooker:
         runlist, taskdata = self.prepareTreeData(pkgs_to_build, task)
         rq = bb.runqueue.RunQueue(self, self.data, self.recipecache, taskdata, runlist)
         rq.rqdata.prepare()
+        return self.buildDependTree(rq, taskdata)
 
+
+    def buildDependTree(self, rq, taskdata):
         seen_fnids = []
         depend_tree = {}
         depend_tree["depends"] = {}
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 6346c77..472509f 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -999,6 +999,11 @@  class RunQueue:
             else:
                 self.state = runQueueSceneInit
 
+                # we are ready to run, see if any UI client needs the dependency info
+                if bb.cooker.CookerFeatures.SEND_DEPENDS_TREE in self.cooker.featureset:
+                    depgraph = self.cooker.buildDependTree(self, self.rqdata.taskData)
+                    bb.event.fire(bb.event.DepTreeGenerated(depgraph), self.cooker.data)
+
         if self.state is runQueueSceneInit:
             if self.cooker.configuration.dump_signatures:
                 self.dump_signatures()