diff options
| -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: | |||
| 222 | command.finishAsyncCommand() | 222 | command.finishAsyncCommand() |
| 223 | generateDotGraph.needcache = True | 223 | generateDotGraph.needcache = True |
| 224 | 224 | ||
| 225 | def generateTargetsTree(self, command, params): | ||
| 226 | """ | ||
| 227 | Generate a tree of all buildable targets. | ||
| 228 | """ | ||
| 229 | klass = params[0] | ||
| 230 | |||
| 231 | command.cooker.generateTargetsTree(klass) | ||
| 232 | command.finishAsyncCommand() | ||
| 233 | generateTargetsTree.needcache = True | ||
| 234 | |||
| 225 | def showVersions(self, command, params): | 235 | def showVersions(self, command, params): |
| 226 | """ | 236 | """ |
| 227 | Show the currently selected versions | 237 | 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: | |||
| 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" |
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): | |||
| 350 | Event.__init__(self) | 350 | Event.__init__(self) |
| 351 | self._depgraph = depgraph | 351 | self._depgraph = depgraph |
| 352 | 352 | ||
| 353 | class TargetsTreeGenerated(Event): | ||
| 354 | """ | ||
| 355 | Event when a set of buildable targets has been generated | ||
| 356 | """ | ||
| 357 | |||
| 358 | def __init__(self, model): | ||
| 359 | Event.__init__(self) | ||
| 360 | self._model = model | ||
| 361 | |||
| 353 | class MsgBase(Event): | 362 | class MsgBase(Event): |
| 354 | """Base class for messages""" | 363 | """Base class for messages""" |
| 355 | 364 | ||
