summaryrefslogtreecommitdiffstats
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)
downloadpoky-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:
237 if data.getVarFlag( e, 'python', envdata ): 237 if data.getVarFlag( e, 'python', envdata ):
238 logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1)) 238 logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1))
239 239
240 def generateDepTreeData(self, pkgs_to_build, task): 240 def prepareTreeData(self, pkgs_to_build, task):
241 """ 241 """
242 Create a dependency tree of pkgs_to_build, returning the data. 242 Prepare a runqueue and taskdata object for iteration over pkgs_to_build
243 """ 243 """
244
245 # Need files parsed 244 # Need files parsed
246 self.updateCache() 245 self.updateCache()
247 246
@@ -265,6 +264,14 @@ class BBCooker:
265 rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist) 264 rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist)
266 rq.rqdata.prepare() 265 rq.rqdata.prepare()
267 266
267 return taskdata, rq
268
269 def generateDepTreeData(self, pkgs_to_build, task):
270 """
271 Create a dependency tree of pkgs_to_build, returning the data.
272 """
273 taskdata, rq = self.prepareTreeData(pkgs_to_build, task)
274
268 seen_fnids = [] 275 seen_fnids = []
269 depend_tree = {} 276 depend_tree = {}
270 depend_tree["depends"] = {} 277 depend_tree["depends"] = {}
@@ -470,29 +477,7 @@ class BBCooker:
470 """ 477 """
471 Create a tree of pkgs_to_build metadata, returning the data. 478 Create a tree of pkgs_to_build metadata, returning the data.
472 """ 479 """
473 480 taskdata, rq = self.prepareTreeData(pkgs_to_build, task)
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 481
497 seen_fnids = [] 482 seen_fnids = []
498 target_tree = {} 483 target_tree = {}