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/lib/bb/cooker.py | |
parent | 920c402342bd490cd94b365c3e151de735dec0d6 (diff) | |
download | poky-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/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 25 |
1 files changed, 25 insertions, 0 deletions
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: | |||
430 | if not regex in matched: | 430 | if not regex in matched: |
431 | collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern)) | 431 | collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern)) |
432 | 432 | ||
433 | def checkInheritsClass(self, klass): | ||
434 | pkg_list = [] | ||
435 | for pfn in self.status.pkg_fn: | ||
436 | inherits = self.status.inherits.get(pfn, None) | ||
437 | if inherits and inherits.count(klass) > 0: | ||
438 | pkg_list.append(self.status.pkg_fn[pfn]) | ||
439 | |||
440 | return pkg_list | ||
441 | |||
442 | def generateTargetsTree(self, klass): | ||
443 | """ | ||
444 | Generate a dependency tree of buildable targets | ||
445 | Generate an event with the result | ||
446 | """ | ||
447 | pkgs = ['world'] | ||
448 | # if inherited_class passed ensure all recipes which inherit the | ||
449 | # specified class are included in pkgs | ||
450 | if klass: | ||
451 | extra_pkgs = self.checkInheritsClass(klass) | ||
452 | pkgs = pkgs + extra_pkgs | ||
453 | |||
454 | # generate a dependency tree for all our packages | ||
455 | tree = self.generateDepTreeData(pkgs, 'build') | ||
456 | bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) | ||
457 | |||
433 | def buildWorldTargetList(self): | 458 | def buildWorldTargetList(self): |
434 | """ | 459 | """ |
435 | Build package list for "bitbake world" | 460 | Build package list for "bitbake world" |