diff options
author | Joshua Lock <josh@linux.intel.com> | 2011-01-07 11:45:00 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-24 15:54:51 +0000 |
commit | dcfc5ae7b1f5925587b0675e1cba6c60f098267c (patch) | |
tree | 77317e46f6c24d16ea63cd13df4eff30c8d6beb1 | |
parent | 3939a216a53f58831e640e85ed95f7edff3ca76f (diff) | |
download | poky-dcfc5ae7b1f5925587b0675e1cba6c60f098267c.tar.gz |
bitbake/cooker: add generateTargetsTree method
The generateTargetsTree() command needs to return a model which includes more
metadata than the one generated by generateDepTree().
This patch adds a new method generateTargetsTreeData() to the cooker, based
on generateDepData(), and switches generateTargetsTree() to use it.
Signed-off-by: Joshua Lock <josh@linux.intel.com>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 23388d8c97..4a8e50678f 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -453,7 +453,10 @@ class BBCooker: | |||
453 | 453 | ||
454 | bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data) | 454 | bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data) |
455 | 455 | ||
456 | def checkInheritsClass(self, klass): | 456 | def findInheritsClass(self, klass): |
457 | """ | ||
458 | Find all recipes which inherit the specified class | ||
459 | """ | ||
457 | pkg_list = [] | 460 | pkg_list = [] |
458 | 461 | ||
459 | for pfn in self.status.pkg_fn: | 462 | for pfn in self.status.pkg_fn: |
@@ -463,6 +466,64 @@ class BBCooker: | |||
463 | 466 | ||
464 | return pkg_list | 467 | return pkg_list |
465 | 468 | ||
469 | def generateTargetsTreeData(self, pkgs_to_build, task): | ||
470 | """ | ||
471 | Create a tree of pkgs_to_build metadata, returning the data. | ||
472 | """ | ||
473 | |||
474 | # Need files parsed | ||
475 | self.updateCache() | ||
476 | |||
477 | # If we are told to do the None task then query the default task | ||
478 | if (task == None): | ||
479 | task = self.configuration.cmd | ||
480 | |||
481 | pkgs_to_build = self.checkPackages(pkgs_to_build) | ||
482 | |||
483 | localdata = data.createCopy(self.configuration.data) | ||
484 | bb.data.update_data(localdata) | ||
485 | bb.data.expandKeys(localdata) | ||
486 | taskdata = bb.taskdata.TaskData(self.configuration.abort) | ||
487 | |||
488 | runlist = [] | ||
489 | for k in pkgs_to_build: | ||
490 | taskdata.add_provider(localdata, self.status, k) | ||
491 | runlist.append([k, "do_%s" % task]) | ||
492 | taskdata.add_unresolved(localdata, self.status) | ||
493 | |||
494 | rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist) | ||
495 | rq.rqdata.prepare() | ||
496 | |||
497 | seen_fnids = [] | ||
498 | target_tree = {} | ||
499 | target_tree["depends"] = {} | ||
500 | target_tree["pn"] = {} | ||
501 | target_tree["rdepends-pn"] = {} | ||
502 | |||
503 | for task in xrange(len(rq.rqdata.runq_fnid)): | ||
504 | taskname = rq.rqdata.runq_task[task] | ||
505 | fnid = rq.rqdata.runq_fnid[task] | ||
506 | fn = taskdata.fn_index[fnid] | ||
507 | pn = self.status.pkg_fn[fn] | ||
508 | version = "%s:%s-%s" % self.status.pkg_pepvpr[fn] | ||
509 | if pn not in target_tree["pn"]: | ||
510 | target_tree["pn"][pn] = {} | ||
511 | target_tree["pn"][pn]["filename"] = fn | ||
512 | target_tree["pn"][pn]["version"] = version | ||
513 | if fnid not in seen_fnids: | ||
514 | seen_fnids.append(fnid) | ||
515 | packages = [] | ||
516 | |||
517 | target_tree["depends"][pn] = [] | ||
518 | for dep in taskdata.depids[fnid]: | ||
519 | target_tree["depends"][pn].append(taskdata.build_names_index[dep]) | ||
520 | |||
521 | target_tree["rdepends-pn"][pn] = [] | ||
522 | for rdep in taskdata.rdepids[fnid]: | ||
523 | target_tree["rdepends-pn"][pn].append(taskdata.run_names_index[rdep]) | ||
524 | |||
525 | return target_tree | ||
526 | |||
466 | def generateTargetsTree(self, klass): | 527 | def generateTargetsTree(self, klass): |
467 | """ | 528 | """ |
468 | Generate a dependency tree of buildable targets | 529 | Generate a dependency tree of buildable targets |
@@ -472,11 +533,11 @@ class BBCooker: | |||
472 | # if inherited_class passed ensure all recipes which inherit the | 533 | # if inherited_class passed ensure all recipes which inherit the |
473 | # specified class are included in pkgs | 534 | # specified class are included in pkgs |
474 | if klass: | 535 | if klass: |
475 | extra_pkgs = self.checkInheritsClass(klass) | 536 | extra_pkgs = self.findInheritsClass(klass) |
476 | pkgs = pkgs + extra_pkgs | 537 | pkgs = pkgs + extra_pkgs |
477 | 538 | ||
478 | # generate a dependency tree for all our packages | 539 | # generate a dependency tree for all our packages |
479 | tree = self.generateDepTreeData(pkgs, 'build') | 540 | tree = self.generateTargetsTreeData(pkgs, 'build') |
480 | bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) | 541 | bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) |
481 | 542 | ||
482 | def buildWorldTargetList(self): | 543 | def buildWorldTargetList(self): |