diff options
-rw-r--r-- | bitbake/lib/bb/command.py | 11 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 58 |
2 files changed, 56 insertions, 13 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index be269372f0..06e886973b 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py | |||
@@ -242,14 +242,21 @@ class CommandsAsync: | |||
242 | included in the package list. | 242 | included in the package list. |
243 | If pkg_list provided use that list (plus any extras brought in by | 243 | If pkg_list provided use that list (plus any extras brought in by |
244 | klass) rather than generating a tree for all packages. | 244 | klass) rather than generating a tree for all packages. |
245 | |||
246 | Add a new option "resolve" to indicate if we need to resolve the | ||
247 | replacement for "virtual/xxx" like pn. | ||
245 | """ | 248 | """ |
246 | klass = params[0] | 249 | klass = params[0] |
247 | if len(params) > 1: | 250 | resolve = False |
251 | if len(params) > 2: | ||
252 | pkg_list = params[1] | ||
253 | resolve = params[2] | ||
254 | elif len(params) > 1: | ||
248 | pkg_list = params[1] | 255 | pkg_list = params[1] |
249 | else: | 256 | else: |
250 | pkg_list = [] | 257 | pkg_list = [] |
251 | 258 | ||
252 | command.cooker.generateTargetsTree(klass, pkg_list) | 259 | command.cooker.generateTargetsTree(klass, pkg_list, resolve) |
253 | command.finishAsyncCommand() | 260 | command.finishAsyncCommand() |
254 | generateTargetsTree.needcache = True | 261 | generateTargetsTree.needcache = True |
255 | 262 | ||
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index b0b58a6fdb..91fdc96b8a 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -429,7 +429,20 @@ class BBCooker: | |||
429 | 429 | ||
430 | return depend_tree | 430 | return depend_tree |
431 | 431 | ||
432 | def generatePkgDepTreeData(self, pkgs_to_build, task): | 432 | def append_package(self, taskdata, depend_tree_package, package): |
433 | if package not in depend_tree_package: | ||
434 | targetid = taskdata.getrun_id(package) | ||
435 | if targetid in taskdata.run_targets and taskdata.run_targets[targetid]: | ||
436 | fnid = taskdata.run_targets[targetid][0] | ||
437 | fn = taskdata.fn_index[fnid] | ||
438 | pn = self.status.pkg_fn[fn] | ||
439 | version = "%s:%s-%s" % self.status.pkg_pepvpr[fn] | ||
440 | depend_tree_package[package] = {} | ||
441 | depend_tree_package[package]["pn"] = pn | ||
442 | depend_tree_package[package]["filename"] = fn | ||
443 | depend_tree_package[package]["version"] = version | ||
444 | |||
445 | def generatePkgDepTreeData(self, pkgs_to_build, task, resolve=False): | ||
433 | """ | 446 | """ |
434 | Create a dependency tree of pkgs_to_build, returning the data. | 447 | Create a dependency tree of pkgs_to_build, returning the data. |
435 | """ | 448 | """ |
@@ -446,6 +459,7 @@ class BBCooker: | |||
446 | depend_tree["rdepends-pn"] = {} | 459 | depend_tree["rdepends-pn"] = {} |
447 | depend_tree["packages"] = {} | 460 | depend_tree["packages"] = {} |
448 | depend_tree["rdepends-pkg"] = {} | 461 | depend_tree["rdepends-pkg"] = {} |
462 | depend_tree["rrecs-pkg"] = {} | ||
449 | 463 | ||
450 | for task in xrange(len(tasks_fnid)): | 464 | for task in xrange(len(tasks_fnid)): |
451 | fnid = tasks_fnid[task] | 465 | fnid = tasks_fnid[task] |
@@ -456,6 +470,8 @@ class BBCooker: | |||
456 | lic = self.status.license[fn] | 470 | lic = self.status.license[fn] |
457 | section = self.status.section[fn] | 471 | section = self.status.section[fn] |
458 | description = self.status.description[fn] | 472 | description = self.status.description[fn] |
473 | rdepends = self.status.rundeps[fn] | ||
474 | rrecs = self.status.runrecs[fn] | ||
459 | if pn not in depend_tree["pn"]: | 475 | if pn not in depend_tree["pn"]: |
460 | depend_tree["pn"][pn] = {} | 476 | depend_tree["pn"][pn] = {} |
461 | depend_tree["pn"][pn]["filename"] = fn | 477 | depend_tree["pn"][pn]["filename"] = fn |
@@ -464,6 +480,7 @@ class BBCooker: | |||
464 | depend_tree["pn"][pn]["license"] = lic | 480 | depend_tree["pn"][pn]["license"] = lic |
465 | depend_tree["pn"][pn]["section"] = section | 481 | depend_tree["pn"][pn]["section"] = section |
466 | depend_tree["pn"][pn]["description"] = description | 482 | depend_tree["pn"][pn]["description"] = description |
483 | depend_tree["pn"][pn]["packages"] = rdepends.keys() | ||
467 | 484 | ||
468 | if fnid not in seen_fnids: | 485 | if fnid not in seen_fnids: |
469 | seen_fnids.append(fnid) | 486 | seen_fnids.append(fnid) |
@@ -471,25 +488,44 @@ class BBCooker: | |||
471 | 488 | ||
472 | depend_tree["depends"][pn] = [] | 489 | depend_tree["depends"][pn] = [] |
473 | for dep in taskdata.depids[fnid]: | 490 | for dep in taskdata.depids[fnid]: |
474 | depend_tree["depends"][pn].append(taskdata.build_names_index[dep]) | 491 | if resolve: |
492 | item = taskdata.build_names_index[dep] | ||
493 | pn_provider = "" | ||
494 | targetid = taskdata.getbuild_id(item) | ||
495 | if targetid in taskdata.build_targets and taskdata.build_targets[targetid]: | ||
496 | fnid = taskdata.build_targets[targetid][0] | ||
497 | fn_provider = taskdata.fn_index[fnid] | ||
498 | pn_provider = self.status.pkg_fn[fn_provider] | ||
499 | else: | ||
500 | pn_provider = item | ||
501 | depend_tree["depends"][pn].append(pn_provider) | ||
502 | else: | ||
503 | depend_tree["depends"][pn].append(taskdata.build_names_index[dep]) | ||
475 | 504 | ||
476 | depend_tree["rdepends-pn"][pn] = [] | 505 | depend_tree["rdepends-pn"][pn] = [] |
477 | for rdep in taskdata.rdepids[fnid]: | 506 | for rdep in taskdata.rdepids[fnid]: |
478 | depend_tree["rdepends-pn"][pn].append(taskdata.run_names_index[rdep]) | 507 | depend_tree["rdepends-pn"][pn].append(taskdata.run_names_index[rdep]) |
479 | 508 | ||
480 | rdepends = self.status.rundeps[fn] | ||
481 | for package in rdepends: | 509 | for package in rdepends: |
482 | depend_tree["rdepends-pkg"][package] = [] | 510 | depend_tree["rdepends-pkg"][package] = [] |
483 | for rdepend in rdepends[package]: | 511 | for rdepend in rdepends[package]: |
484 | depend_tree["rdepends-pkg"][package].append(rdepend) | 512 | depend_tree["rdepends-pkg"][package].append(rdepend) |
485 | packages.append(package) | 513 | if resolve: |
514 | self.append_package(taskdata, depend_tree["packages"], rdepend) | ||
515 | if not package in packages: | ||
516 | packages.append(package) | ||
517 | |||
518 | for package in rrecs: | ||
519 | depend_tree["rrecs-pkg"][package] = [] | ||
520 | for rrec in rrecs[package]: | ||
521 | depend_tree["rrecs-pkg"][package].append(rrec) | ||
522 | if resolve: | ||
523 | self.append_package(taskdata, depend_tree["packages"], rrec) | ||
524 | if not package in packages: | ||
525 | packages.append(package) | ||
486 | 526 | ||
487 | for package in packages: | 527 | for package in packages: |
488 | if package not in depend_tree["packages"]: | 528 | self.append_package(taskdata, depend_tree["packages"], package) |
489 | depend_tree["packages"][package] = {} | ||
490 | depend_tree["packages"][package]["pn"] = pn | ||
491 | depend_tree["packages"][package]["filename"] = fn | ||
492 | depend_tree["packages"][package]["version"] = version | ||
493 | 529 | ||
494 | return depend_tree | 530 | return depend_tree |
495 | 531 | ||
@@ -735,7 +771,7 @@ class BBCooker: | |||
735 | 771 | ||
736 | return pkg_list | 772 | return pkg_list |
737 | 773 | ||
738 | def generateTargetsTree(self, klass=None, pkgs=[]): | 774 | def generateTargetsTree(self, klass=None, pkgs=[], resolve=False): |
739 | """ | 775 | """ |
740 | Generate a dependency tree of buildable targets | 776 | Generate a dependency tree of buildable targets |
741 | Generate an event with the result | 777 | Generate an event with the result |
@@ -750,7 +786,7 @@ class BBCooker: | |||
750 | pkgs = pkgs + extra_pkgs | 786 | pkgs = pkgs + extra_pkgs |
751 | 787 | ||
752 | # generate a dependency tree for all our packages | 788 | # generate a dependency tree for all our packages |
753 | tree = self.generatePkgDepTreeData(pkgs, 'build') | 789 | tree = self.generatePkgDepTreeData(pkgs, 'build', resolve) |
754 | bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) | 790 | bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) |
755 | 791 | ||
756 | def buildWorldTargetList(self): | 792 | def buildWorldTargetList(self): |