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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 737 |
738 # Mark this package as non-optional | 738 # Mark this package as non-optional |
739 deps_info[pkg]["optional"] = False | 739 deps_info[pkg]["optional"] = False |
740 this_pkg[merge_type] = True | 740 this_pkg[merge_type] = True |
741 for w in this_pkg["provides"]: | 741 for w in this_pkg["provides"]: |
742 MergeChildren(w, merge_type) | 742 MergeChildren(w, merge_type) |
743 | 743 |
744 if this_pkg["action"] == "nomerge": | 744 if this_pkg["action"] == "nomerge": |
745 this_pkg["action"] = "merge" | 745 this_pkg["action"] = "merge" |
746 | 746 |
747 def RemotePackageDatabase(): | 747 def RemotePackageDatabase(binhost_url): |
748 """Grab the latest binary package database from the prebuilt server. | 748 """Grab the latest binary package database from the prebuilt server. |
749 | 749 |
750 We need to know the modification times of the prebuilt packages so that we | 750 We need to know the modification times of the prebuilt packages so that we |
751 know when it is OK to use these packages and when we should rebuild them | 751 know when it is OK to use these packages and when we should rebuild them |
752 instead. | 752 instead. |
753 | 753 |
| 754 Args: |
| 755 binhost_url: Base URL of remote packages (PORTAGE_BINHOST). |
| 756 |
754 Returns: | 757 Returns: |
755 A dict mapping package identifiers to modification times. | 758 A dict mapping package identifiers to modification times. |
756 """ | 759 """ |
757 url = self.emerge.settings["PORTAGE_BINHOST"] + "/Packages" | 760 |
| 761 if not binhost_url: |
| 762 return {} |
| 763 |
| 764 url = binhost_url + "/Packages" |
758 | 765 |
759 prebuilt_pkgs = {} | 766 prebuilt_pkgs = {} |
760 f = urllib2.urlopen(url) | 767 f = urllib2.urlopen(url) |
761 for line in f: | 768 for line in f: |
762 if line.startswith("CPV: "): | 769 if line.startswith("CPV: "): |
763 pkg = line.replace("CPV: ", "").rstrip() | 770 pkg = line.replace("CPV: ", "").rstrip() |
764 elif line.startswith("MTIME: "): | 771 elif line.startswith("MTIME: "): |
765 prebuilt_pkgs[pkg] = int(line[:-1].replace("MTIME: ", "")) | 772 prebuilt_pkgs[pkg] = int(line[:-1].replace("MTIME: ", "")) |
766 f.close() | 773 f.close() |
767 | 774 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 for db_pkg in final_db.match_pkgs(pkg): | 953 for db_pkg in final_db.match_pkgs(pkg): |
947 deps_map[str(db_pkg.cpv)]["mandatory_source"] = True | 954 deps_map[str(db_pkg.cpv)]["mandatory_source"] = True |
948 else: | 955 else: |
949 for pkg in self.mandatory_source.copy(): | 956 for pkg in self.mandatory_source.copy(): |
950 for db_pkg in final_db.match_pkgs(pkg): | 957 for db_pkg in final_db.match_pkgs(pkg): |
951 MergeChildren(str(db_pkg.cpv), "mandatory_source") | 958 MergeChildren(str(db_pkg.cpv), "mandatory_source") |
952 | 959 |
953 cycles = FindCycles() | 960 cycles = FindCycles() |
954 if self.rebuild: | 961 if self.rebuild: |
955 local_pkgs = LocalPackageDatabase() | 962 local_pkgs = LocalPackageDatabase() |
956 remote_pkgs = RemotePackageDatabase() | 963 remote_pkgs = RemotePackageDatabase(emerge.settings["PORTAGE_BINHOST"]) |
957 AutoRebuildDeps(local_pkgs, remote_pkgs, cycles) | 964 AutoRebuildDeps(local_pkgs, remote_pkgs, cycles) |
958 | 965 |
959 # We need to remove installed packages so that we can use the dependency | 966 # We need to remove installed packages so that we can use the dependency |
960 # ordering of the install process to show us what cycles to crack. Once | 967 # ordering of the install process to show us what cycles to crack. Once |
961 # we've done that, we also need to recalculate our list of cycles so that | 968 # we've done that, we also need to recalculate our list of cycles so that |
962 # we don't include the installed packages in our cycles. | 969 # we don't include the installed packages in our cycles. |
963 RemoveInstalledPackages() | 970 RemoveInstalledPackages() |
964 cycles = FindCycles() | 971 cycles = FindCycles() |
965 SanitizeTree(cycles) | 972 SanitizeTree(cycles) |
966 if deps_map: | 973 if deps_map: |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 for db_pkg in final_db.match_pkgs(pkg): | 1268 for db_pkg in final_db.match_pkgs(pkg): |
1262 print "Adding %s to world" % db_pkg.cp | 1269 print "Adding %s to world" % db_pkg.cp |
1263 new_world_pkgs.append(db_pkg.cp) | 1270 new_world_pkgs.append(db_pkg.cp) |
1264 if new_world_pkgs: | 1271 if new_world_pkgs: |
1265 world_set.update(new_world_pkgs) | 1272 world_set.update(new_world_pkgs) |
1266 | 1273 |
1267 print "Done" | 1274 print "Done" |
1268 | 1275 |
1269 if __name__ == "__main__": | 1276 if __name__ == "__main__": |
1270 main() | 1277 main() |
OLD | NEW |