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:
parent
dcfc5ae7b1
commit
3c1a3b0724
|
@ -237,11 +237,10 @@ class BBCooker:
|
||||||
if data.getVarFlag( e, 'python', envdata ):
|
if data.getVarFlag( e, 'python', envdata ):
|
||||||
logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1))
|
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
|
# Need files parsed
|
||||||
self.updateCache()
|
self.updateCache()
|
||||||
|
|
||||||
|
@ -265,6 +264,14 @@ class BBCooker:
|
||||||
rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist)
|
rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist)
|
||||||
rq.rqdata.prepare()
|
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 = []
|
seen_fnids = []
|
||||||
depend_tree = {}
|
depend_tree = {}
|
||||||
depend_tree["depends"] = {}
|
depend_tree["depends"] = {}
|
||||||
|
@ -470,29 +477,7 @@ class BBCooker:
|
||||||
"""
|
"""
|
||||||
Create a tree of pkgs_to_build metadata, returning the data.
|
Create a tree of pkgs_to_build metadata, returning the data.
|
||||||
"""
|
"""
|
||||||
|
taskdata, rq = self.prepareTreeData(pkgs_to_build, task)
|
||||||
# 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 = []
|
seen_fnids = []
|
||||||
target_tree = {}
|
target_tree = {}
|
||||||
|
|
Loading…
Reference in New Issue