bitbake/cooker: reduce code duplication

Move runqueua and taskdata initialisation into a new function,
prepareTreeData(), so that generateDepTreeData() and
generateTargetsTreeData() are not duplicating the same logic.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
This commit is contained in:
Joshua Lock 2011-01-07 12:00:09 +00:00 committed by Richard Purdie
parent dcfc5ae7b1
commit 3c1a3b0724
1 changed files with 11 additions and 26 deletions

View File

@ -237,11 +237,10 @@ class BBCooker:
if data.getVarFlag( e, 'python', envdata ):
logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1))
def generateDepTreeData(self, pkgs_to_build, task):
def prepareTreeData(self, pkgs_to_build, task):
"""
Create a dependency tree of pkgs_to_build, returning the data.
Prepare a runqueue and taskdata object for iteration over pkgs_to_build
"""
# Need files parsed
self.updateCache()
@ -265,6 +264,14 @@ class BBCooker:
rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist)
rq.rqdata.prepare()
return taskdata, rq
def generateDepTreeData(self, pkgs_to_build, task):
"""
Create a dependency tree of pkgs_to_build, returning the data.
"""
taskdata, rq = self.prepareTreeData(pkgs_to_build, task)
seen_fnids = []
depend_tree = {}
depend_tree["depends"] = {}
@ -470,29 +477,7 @@ class BBCooker:
"""
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()
taskdata, rq = self.prepareTreeData(pkgs_to_build, task)
seen_fnids = []
target_tree = {}