| OLD | NEW |
| 1 #!/usr/bin/python2.6 | 1 #!/usr/bin/python2.6 |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Program to run emerge in parallel, for significant speedup. | 6 """Program to run emerge in parallel, for significant speedup. |
| 7 | 7 |
| 8 Usage: | 8 Usage: |
| 9 ./parallel_emerge [--board=BOARD] [--workon=PKGS] [--no-workon-deps] | 9 ./parallel_emerge [--board=BOARD] [--workon=PKGS] [--no-workon-deps] |
| 10 [emerge args] package" | 10 [emerge args] package" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 # It's useful to know what packages will actually end up on the | 550 # It's useful to know what packages will actually end up on the |
| 551 # system at some point. Packages in final_db are either already | 551 # system at some point. Packages in final_db are either already |
| 552 # installed, or will be installed by the time we're done. | 552 # installed, or will be installed by the time we're done. |
| 553 final_db = emerge.depgraph._dynamic_config.mydbapi[root] | 553 final_db = emerge.depgraph._dynamic_config.mydbapi[root] |
| 554 | 554 |
| 555 # final_pkgs is a set of the packages we found in the final_db. These | 555 # final_pkgs is a set of the packages we found in the final_db. These |
| 556 # packages are either already installed, or will be installed by the time | 556 # packages are either already installed, or will be installed by the time |
| 557 # we're done. It's populated in BuildFinalPackageSet() | 557 # we're done. It's populated in BuildFinalPackageSet() |
| 558 final_pkgs = set() | 558 final_pkgs = set() |
| 559 | 559 |
| 560 # These packages take a really long time to build, so, for expediency, we |
| 561 # are blacklisting them from automatic rebuilds. Instead, these packages |
| 562 # will only be rebuilt when they are explicitly rev'd. |
| 563 rebuild_blacklist = set() |
| 564 for pkg in ("media-plugins/o3d", "dev-java/icedtea"): |
| 565 for match in final_db.match_pkgs(pkg): |
| 566 rebuild_blacklist.add(str(match.cpv)) |
| 567 |
| 560 # deps_map is the actual dependency graph. | 568 # deps_map is the actual dependency graph. |
| 561 # | 569 # |
| 562 # Each package specifies a "needs" list and a "provides" list. The "needs" | 570 # Each package specifies a "needs" list and a "provides" list. The "needs" |
| 563 # list indicates which packages we depend on. The "provides" list | 571 # list indicates which packages we depend on. The "provides" list |
| 564 # indicates the reverse dependencies -- what packages need us. | 572 # indicates the reverse dependencies -- what packages need us. |
| 565 # | 573 # |
| 566 # We also provide some other information in the dependency graph: | 574 # We also provide some other information in the dependency graph: |
| 567 # - action: What we're planning on doing with this package. Generally, | 575 # - action: What we're planning on doing with this package. Generally, |
| 568 # "merge", "nomerge", or "uninstall" | 576 # "merge", "nomerge", or "uninstall" |
| 569 # - mandatory_source: | 577 # - mandatory_source: |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 if dep.find(needed) != -1: | 747 if dep.find(needed) != -1: |
| 740 needed_pkg = dep | 748 needed_pkg = dep |
| 741 if bad_pkg and needed_pkg: | 749 if bad_pkg and needed_pkg: |
| 742 deps_map[needed_pkg]["provides"].add(bad_pkg) | 750 deps_map[needed_pkg]["provides"].add(bad_pkg) |
| 743 deps_map[bad_pkg]["needs"][needed_pkg] = "secret" | 751 deps_map[bad_pkg]["needs"][needed_pkg] = "secret" |
| 744 | 752 |
| 745 def MergeChildren(pkg, merge_type): | 753 def MergeChildren(pkg, merge_type): |
| 746 """Merge this package and all packages it provides.""" | 754 """Merge this package and all packages it provides.""" |
| 747 | 755 |
| 748 this_pkg = deps_map[pkg] | 756 this_pkg = deps_map[pkg] |
| 749 if this_pkg[merge_type] or pkg not in final_pkgs: | 757 if (this_pkg[merge_type] or pkg not in final_pkgs or |
| 750 return set() | 758 pkg in rebuild_blacklist): |
| 759 return |
| 751 | 760 |
| 752 # Mark this package as non-optional | 761 # Mark this package as non-optional |
| 753 deps_info[pkg]["optional"] = False | 762 deps_info[pkg]["optional"] = False |
| 754 this_pkg[merge_type] = True | 763 this_pkg[merge_type] = True |
| 755 for w in this_pkg["provides"]: | 764 for w in this_pkg["provides"]: |
| 756 MergeChildren(w, merge_type) | 765 MergeChildren(w, merge_type) |
| 757 | 766 |
| 758 if this_pkg["action"] == "nomerge": | 767 if this_pkg["action"] == "nomerge": |
| 759 this_pkg["action"] = "merge" | 768 this_pkg["action"] = "merge" |
| 760 | 769 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 for db_pkg in final_db.match_pkgs(pkg): | 1291 for db_pkg in final_db.match_pkgs(pkg): |
| 1283 print "Adding %s to world" % db_pkg.cp | 1292 print "Adding %s to world" % db_pkg.cp |
| 1284 new_world_pkgs.append(db_pkg.cp) | 1293 new_world_pkgs.append(db_pkg.cp) |
| 1285 if new_world_pkgs: | 1294 if new_world_pkgs: |
| 1286 world_set.update(new_world_pkgs) | 1295 world_set.update(new_world_pkgs) |
| 1287 | 1296 |
| 1288 print "Done" | 1297 print "Done" |
| 1289 | 1298 |
| 1290 if __name__ == "__main__": | 1299 if __name__ == "__main__": |
| 1291 main() | 1300 main() |
| OLD | NEW |