diff options
author | Liping Ke <liping.ke@intel.com> | 2011-07-21 12:08:58 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-07-21 22:46:37 +0100 |
commit | c97f136a944b234d3fa8b3d804f7c88863890133 (patch) | |
tree | fa8d42ae43566545a1ea2bc67ef1bf4dffb388e1 | |
parent | 97fb1fea9b334942cb662484161255474da4abf7 (diff) | |
download | poky-c97f136a944b234d3fa8b3d804f7c88863890133.tar.gz |
Remove unused target tree data for Hob
Since Hob only needes package dependency information, we can
create a new version of package information retrieving methods,
remove task dependency information, so that we can greatly
reduce data loading time for Hob
(Bitbake rev: df55199209ef042e5b1ca04c4df75c7d639b51eb)
Signed-off-by: Liping Ke <liping.ke@intel.com>
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 89 |
1 files changed, 68 insertions, 21 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 8badd2d7c0..7cf43a04ae 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -302,7 +302,6 @@ class BBCooker: | |||
302 | """ | 302 | """ |
303 | # Need files parsed | 303 | # Need files parsed |
304 | self.updateCache() | 304 | self.updateCache() |
305 | |||
306 | # If we are told to do the None task then query the default task | 305 | # If we are told to do the None task then query the default task |
307 | if (task == None): | 306 | if (task == None): |
308 | task = self.configuration.cmd | 307 | task = self.configuration.cmd |
@@ -322,18 +321,16 @@ class BBCooker: | |||
322 | runlist.append([k, "do_%s" % task]) | 321 | runlist.append([k, "do_%s" % task]) |
323 | taskdata.add_unresolved(localdata, self.status) | 322 | taskdata.add_unresolved(localdata, self.status) |
324 | 323 | ||
325 | rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist) | 324 | return runlist, taskdata |
326 | rq.rqdata.prepare() | ||
327 | |||
328 | return taskdata, rq | ||
329 | 325 | ||
330 | def generateDepTreeData(self, pkgs_to_build, task, more_meta=False): | 326 | def generateTaskDepTreeData(self, pkgs_to_build, task): |
331 | """ | 327 | """ |
332 | Create a dependency tree of pkgs_to_build, returning the data. | 328 | Create a dependency graph of pkgs_to_build including reverse dependency |
333 | When more_meta is set to True include summary, license and group | 329 | information. |
334 | information in the returned tree. | ||
335 | """ | 330 | """ |
336 | taskdata, rq = self.prepareTreeData(pkgs_to_build, task) | 331 | runlist, taskdata = self.prepareTreeData(pkgs_to_build, task) |
332 | rq = bb.runqueue.RunQueue(self, self.configuration.data, self.status, taskdata, runlist) | ||
333 | rq.rqdata.prepare() | ||
337 | 334 | ||
338 | seen_fnids = [] | 335 | seen_fnids = [] |
339 | depend_tree = {} | 336 | depend_tree = {} |
@@ -351,18 +348,10 @@ class BBCooker: | |||
351 | fn = taskdata.fn_index[fnid] | 348 | fn = taskdata.fn_index[fnid] |
352 | pn = self.status.pkg_fn[fn] | 349 | pn = self.status.pkg_fn[fn] |
353 | version = "%s:%s-%s" % self.status.pkg_pepvpr[fn] | 350 | version = "%s:%s-%s" % self.status.pkg_pepvpr[fn] |
354 | if more_meta: | ||
355 | summary = self.status.summary[fn] | ||
356 | lic = self.status.license[fn] | ||
357 | section = self.status.section[fn] | ||
358 | if pn not in depend_tree["pn"]: | 351 | if pn not in depend_tree["pn"]: |
359 | depend_tree["pn"][pn] = {} | 352 | depend_tree["pn"][pn] = {} |
360 | depend_tree["pn"][pn]["filename"] = fn | 353 | depend_tree["pn"][pn]["filename"] = fn |
361 | depend_tree["pn"][pn]["version"] = version | 354 | depend_tree["pn"][pn]["version"] = version |
362 | if more_meta: | ||
363 | depend_tree["pn"][pn]["summary"] = summary | ||
364 | depend_tree["pn"][pn]["license"] = lic | ||
365 | depend_tree["pn"][pn]["section"] = section | ||
366 | for dep in rq.rqdata.runq_depends[task]: | 355 | for dep in rq.rqdata.runq_depends[task]: |
367 | depfn = taskdata.fn_index[rq.rqdata.runq_fnid[dep]] | 356 | depfn = taskdata.fn_index[rq.rqdata.runq_fnid[dep]] |
368 | deppn = self.status.pkg_fn[depfn] | 357 | deppn = self.status.pkg_fn[depfn] |
@@ -406,13 +395,71 @@ class BBCooker: | |||
406 | 395 | ||
407 | return depend_tree | 396 | return depend_tree |
408 | 397 | ||
398 | def generatePkgDepTreeData(self, pkgs_to_build, task): | ||
399 | """ | ||
400 | Create a dependency tree of pkgs_to_build, returning the data. | ||
401 | """ | ||
402 | _, taskdata = self.prepareTreeData(pkgs_to_build, task) | ||
403 | tasks_fnid = [] | ||
404 | if len(taskdata.tasks_name) != 0: | ||
405 | for task in xrange(len(taskdata.tasks_name)): | ||
406 | tasks_fnid.append(taskdata.tasks_fnid[task]) | ||
407 | |||
408 | seen_fnids = [] | ||
409 | depend_tree = {} | ||
410 | depend_tree["depends"] = {} | ||
411 | depend_tree["pn"] = {} | ||
412 | depend_tree["rdepends-pn"] = {} | ||
413 | depend_tree["packages"] = {} | ||
414 | depend_tree["rdepends-pkg"] = {} | ||
415 | |||
416 | for task in xrange(len(tasks_fnid)): | ||
417 | fnid = tasks_fnid[task] | ||
418 | fn = taskdata.fn_index[fnid] | ||
419 | pn = self.status.pkg_fn[fn] | ||
420 | version = "%s:%s-%s" % self.status.pkg_pepvpr[fn] | ||
421 | summary = self.status.summary[fn] | ||
422 | lic = self.status.license[fn] | ||
423 | section = self.status.section[fn] | ||
424 | if pn not in depend_tree["pn"]: | ||
425 | depend_tree["pn"][pn] = {} | ||
426 | depend_tree["pn"][pn]["filename"] = fn | ||
427 | depend_tree["pn"][pn]["version"] = version | ||
428 | depend_tree["pn"][pn]["summary"] = summary | ||
429 | depend_tree["pn"][pn]["license"] = lic | ||
430 | depend_tree["pn"][pn]["section"] = section | ||
431 | |||
432 | if fnid not in seen_fnids: | ||
433 | seen_fnids.append(fnid) | ||
434 | packages = [] | ||
435 | |||
436 | depend_tree["depends"][pn] = [] | ||
437 | for dep in taskdata.depids[fnid]: | ||
438 | depend_tree["depends"][pn].append(taskdata.build_names_index[dep]) | ||
439 | |||
440 | depend_tree["rdepends-pn"][pn] = [] | ||
441 | for rdep in taskdata.rdepids[fnid]: | ||
442 | depend_tree["rdepends-pn"][pn].append(taskdata.run_names_index[rdep]) | ||
443 | |||
444 | rdepends = self.status.rundeps[fn] | ||
445 | for package in rdepends: | ||
446 | packages.append(package) | ||
447 | |||
448 | for package in packages: | ||
449 | if package not in depend_tree["packages"]: | ||
450 | depend_tree["packages"][package] = {} | ||
451 | depend_tree["packages"][package]["pn"] = pn | ||
452 | depend_tree["packages"][package]["filename"] = fn | ||
453 | depend_tree["packages"][package]["version"] = version | ||
454 | |||
455 | return depend_tree | ||
409 | 456 | ||
410 | def generateDepTreeEvent(self, pkgs_to_build, task): | 457 | def generateDepTreeEvent(self, pkgs_to_build, task): |
411 | """ | 458 | """ |
412 | Create a task dependency graph of pkgs_to_build. | 459 | Create a task dependency graph of pkgs_to_build. |
413 | Generate an event with the result | 460 | Generate an event with the result |
414 | """ | 461 | """ |
415 | depgraph = self.generateDepTreeData(pkgs_to_build, task) | 462 | depgraph = self.generateTaskDepTreeData(pkgs_to_build, task) |
416 | bb.event.fire(bb.event.DepTreeGenerated(depgraph), self.configuration.data) | 463 | bb.event.fire(bb.event.DepTreeGenerated(depgraph), self.configuration.data) |
417 | 464 | ||
418 | def generateDotGraphFiles(self, pkgs_to_build, task): | 465 | def generateDotGraphFiles(self, pkgs_to_build, task): |
@@ -421,7 +468,7 @@ class BBCooker: | |||
421 | Save the result to a set of .dot files. | 468 | Save the result to a set of .dot files. |
422 | """ | 469 | """ |
423 | 470 | ||
424 | depgraph = self.generateDepTreeData(pkgs_to_build, task) | 471 | depgraph = self.generateTaskDepTreeData(pkgs_to_build, task) |
425 | 472 | ||
426 | # Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn | 473 | # Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn |
427 | depends_file = file('pn-depends.dot', 'w' ) | 474 | depends_file = file('pn-depends.dot', 'w' ) |
@@ -628,7 +675,7 @@ class BBCooker: | |||
628 | pkgs = pkgs + extra_pkgs | 675 | pkgs = pkgs + extra_pkgs |
629 | 676 | ||
630 | # generate a dependency tree for all our packages | 677 | # generate a dependency tree for all our packages |
631 | tree = self.generateDepTreeData(pkgs, 'build', more_meta=True) | 678 | tree = self.generatePkgDepTreeData(pkgs, 'build') |
632 | bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) | 679 | bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.configuration.data) |
633 | 680 | ||
634 | def buildWorldTargetList(self): | 681 | def buildWorldTargetList(self): |