diff options
author | Joshua Lock <josh@linux.intel.com> | 2011-01-04 20:08:51 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-24 15:54:50 +0000 |
commit | 1b3eb0c35f504e8f652303a4b238034ecc5c5d02 (patch) | |
tree | 88193076474e939d0b18897eb5d341fb4d27258d /bitbake | |
parent | 920c402342bd490cd94b365c3e151de735dec0d6 (diff) | |
download | openembedded-core-contrib-1b3eb0c35f504e8f652303a4b238034ecc5c5d02.tar.gz |
bitbake: implement command to get all possible targets and their dependencies
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
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/command.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 25 | ||||
-rw-r--r-- | bitbake/lib/bb/event.py | 9 |
3 files changed, 44 insertions, 0 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index b88089298c..42b5b06712 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py @@ -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 diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index ff16daf83f..e30fde0743 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -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" diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 3467ddd613..064848baef 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -350,6 +350,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""" |