]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
implement command to get all possible targets and their dependencies
authorJoshua Lock <josh@linux.intel.com>
Tue, 4 Jan 2011 20:08:51 +0000 (20:08 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 3 Mar 2011 22:30:21 +0000 (22:30 +0000)
Add a new command generateTargetsTree() which returns a dependency tree of
possible targets (tasks and recipes) as well as their dependency information.

Optional parameter 'klass' also ensures any recipes which inherit the
specified class path (i.e. 'classes/image.bbclass') are included in the model

(From Poky rev: 1b3eb0c35f504e8f652303a4b238034ecc5c5d02)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/command.py
lib/bb/cooker.py
lib/bb/event.py

index c5c8de19010db709a1b752b4d42951ed528ace84..d84898a848f0e5f917bb90f3eb0e4f53b491678a 100644 (file)
@@ -222,6 +222,16 @@ class CommandsAsync:
         command.finishAsyncCommand()
     generateDotGraph.needcache = True
 
+    def generateTargetsTree(self, command, params):
+        """
+        Generate a tree of all buildable targets.
+        """
+        klass = params[0]
+
+        command.cooker.generateTargetsTree(klass)
+        command.finishAsyncCommand()
+    generateTargetsTree.needcache = True
+
     def showVersions(self, command, params):
         """
         Show the currently selected versions
index 31dbb227a98e0cc4ea34884d87a7a9e6bfbec8c8..89a2d604aac64fd5d90aee8c3ac9d3653e9e2d81 100644 (file)
@@ -430,6 +430,31 @@ class BBCooker:
             if not regex in matched:
                 collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern))
 
+    def checkInheritsClass(self, klass):
+        pkg_list = []
+        for pfn in self.status.pkg_fn:
+            inherits = self.status.inherits.get(pfn, None)
+            if inherits and inherits.count(klass) > 0:
+                pkg_list.append(self.status.pkg_fn[pfn])
+
+        return pkg_list
+
+    def generateTargetsTree(self, klass):
+        """
+        Generate a dependency tree of buildable targets
+        Generate an event with the result
+        """
+        pkgs = ['world']
+        # if inherited_class passed ensure all recipes which inherit the
+        # specified class are included in pkgs
+        if klass:
+            extra_pkgs = self.checkInheritsClass(klass)
+            pkgs = pkgs + extra_pkgs
+
+        # generate a dependency tree for all our packages
+        tree = self.generateDepTreeData(pkgs, 'build')
+        bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data)
+
     def buildWorldTargetList(self):
         """
          Build package list for "bitbake world"
index 5c0db18627443c0984e67dba35e2d167c03fd7e2..2acf9b119525a43a195feb65b0b12ddfd87c89a9 100644 (file)
@@ -351,6 +351,15 @@ class DepTreeGenerated(Event):
         Event.__init__(self)
         self._depgraph = depgraph
 
+class TargetsTreeGenerated(Event):
+    """
+    Event when a set of buildable targets has been generated
+    """
+
+    def __init__(self, model):
+        Event.__init__(self)
+        self._model = model
+
 class MsgBase(Event):
     """Base class for messages"""