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 /bitbake | |
parent | 3939a216a53f58831e640e85ed95f7edff3ca76f (diff) | |
download | openembedded-core-contrib-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>
Diffstat (limited to 'bitbake')
-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: bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data) - def checkInheritsClass(self, klass): + def findInheritsClass(self, klass): + """ + Find all recipes which inherit the specified class + """ pkg_list = [] for pfn in self.status.pkg_fn: @@ -463,6 +466,64 @@ class BBCooker: return pkg_list + def generateTargetsTreeData(self, pkgs_to_build, task): + """ + Create a tree of pkgs_to_build metadata, returning the data. + """ + + # Need files parsed + self.updateCache() + + # If we are told to do the None task then query the default task + if (task == None): + task = self.configuration.cmd + + pkgs_to_build = self.checkPackages(pkgs_to_build) + + localdata = data.createCopy(self.configuration.data) + bb.data.update_data(localdata) + bb.data.expandKeys(localdata) + taskdata = bb.taskdata.TaskData(self.configuration.abort) + + runlist = [] + for k in pkgs_to_build: + taskdata.add_provider(localdata, self.status, k) + runlist.append([k, "do_%s" % task]) + taskdata.add_unresolved(localdata, self.status) + + rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist) + rq.rqdata.prepare() + + seen_fnids = [] + target_tree = {} + target_tree["depends"] = {} + target_tree["pn"] = {} + target_tree["rdepends-pn"] = {} + + for task in xrange(len(rq.rqdata.runq_fnid)): + taskname = rq.rqdata.runq_task[task] + fnid = rq.rqdata.runq_fnid[task] + fn = taskdata.fn_index[fnid] + pn = self.status.pkg_fn[fn] + version = "%s:%s-%s" % self.status.pkg_pepvpr[fn] + if pn not in target_tree["pn"]: + target_tree["pn"][pn] = {} + target_tree["pn"][pn]["filename"] = fn + target_tree["pn"][pn]["version"] = version + if fnid not in seen_fnids: + seen_fnids.append(fnid) + packages = [] + + target_tree["depends"][pn] = [] + for dep in taskdata.depids[fnid]: + target_tree["depends"][pn].append(taskdata.build_names_index[dep]) + + target_tree["rdepends-pn"][pn] = [] + for rdep in taskdata.rdepids[fnid]: + target_tree["rdepends-pn"][pn].append(taskdata.run_names_index[rdep]) + + return target_tree + def generateTargetsTree(self, klass): """ Generate a dependency tree of buildable targets @@ -472,11 +533,11 @@ class BBCooker: # if inherited_class passed ensure all recipes which inherit the # specified class are included in pkgs if klass: - extra_pkgs = self.checkInheritsClass(klass) + extra_pkgs = self.findInheritsClass(klass) pkgs = pkgs + extra_pkgs # generate a dependency tree for all our packages - tree = self.generateDepTreeData(pkgs, 'build') + tree = self.generateTargetsTreeData(pkgs, 'build') bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) def buildWorldTargetList(self): |