aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-01-07 12:00:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-24 15:54:51 +0000
commit3c1a3b0724d5175e81ec81cce448d5b618d21958 (patch)
tree1ada3fbf0d3e11c7b0c77aee4ca691afd28bd229 /bitbake
parentdcfc5ae7b1f5925587b0675e1cba6c60f098267c (diff)
downloadopenembedded-core-contrib-3c1a3b0724d5175e81ec81cce448d5b618d21958.tar.gz
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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py37
1 files changed, 11 insertions, 26 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 4a8e50678f..f0d40a0673 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -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 = {}