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 [--force-remote-binary=PKGS] [emerge args] package | 10 [--force-remote-binary=PKGS] [emerge args] package |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 url: The specified url. | 734 url: The specified url. |
735 tries: The number of times to try. | 735 tries: The number of times to try. |
736 | 736 |
737 Returns: | 737 Returns: |
738 The result of urllib2.urlopen(url). | 738 The result of urllib2.urlopen(url). |
739 """ | 739 """ |
740 for i in range(tries): | 740 for i in range(tries): |
741 try: | 741 try: |
742 return urllib2.urlopen(url) | 742 return urllib2.urlopen(url) |
743 except urllib2.HTTPError as e: | 743 except urllib2.HTTPError as e: |
744 print "Cannot GET %s: %s" % (url, str(e)) | |
744 if i + 1 >= tries or e.code < 500: | 745 if i + 1 >= tries or e.code < 500: |
745 raise | 746 raise |
746 else: | |
747 print "Cannot GET %s: %s" % (url, str(e)) | |
748 except urllib2.URLError as e: | 747 except urllib2.URLError as e: |
748 print "Cannot GET %s: %s" % (url, str(e)) | |
749 if i + 1 >= tries: | 749 if i + 1 >= tries: |
750 raise | 750 raise |
751 else: | |
752 print "Cannot GET %s: %s" % (url, str(e)) | |
753 print "Sleeping for 10 seconds before retrying..." | 751 print "Sleeping for 10 seconds before retrying..." |
754 time.sleep(10) | 752 time.sleep(10) |
755 | 753 |
756 url = os.path.join(binhost_url, "Packages") | 754 url = os.path.join(binhost_url, "Packages") |
757 try: | 755 try: |
758 f = retry_urlopen(url) | 756 f = retry_urlopen(url) |
759 except urllib2.HTTPError as e: | 757 except urllib2.HTTPError as e: |
760 if e.code == 404: | 758 if e.code == 404: |
761 return {} | 759 return {} |
762 else: | 760 else: |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1830 print "Starting fast-emerge." | 1828 print "Starting fast-emerge." |
1831 print " Building package %s on %s" % (cmdline_packages, | 1829 print " Building package %s on %s" % (cmdline_packages, |
1832 deps.board or "root") | 1830 deps.board or "root") |
1833 if nomerge_packages: | 1831 if nomerge_packages: |
1834 print " Skipping package %s on %s" % (nomerge_packages, | 1832 print " Skipping package %s on %s" % (nomerge_packages, |
1835 deps.board or "root") | 1833 deps.board or "root") |
1836 | 1834 |
1837 remote_pkgs = {} | 1835 remote_pkgs = {} |
1838 if "--getbinpkg" in emerge.opts: | 1836 if "--getbinpkg" in emerge.opts: |
1839 binhost = emerge.settings["PORTAGE_BINHOST"] | 1837 binhost = emerge.settings["PORTAGE_BINHOST"] |
1840 remote_pkgs = deps.RemotePackageDatabase(binhost) | 1838 try: |
1839 remote_pkgs = deps.RemotePackageDatabase(binhost) | |
1840 except (urllib2.HTTPError, urllib2.URLError): | |
1841 print "Cannot resolve binhost. Building from source..." | |
Nick Sanders
2010/12/21 01:32:31
Can we print like 10 lines of **********'s here an
| |
1842 del emerge.opts["--getbinpkg"] | |
1841 | 1843 |
1842 deps_tree, deps_info = deps.GenDependencyTree(remote_pkgs) | 1844 deps_tree, deps_info = deps.GenDependencyTree(remote_pkgs) |
1843 | 1845 |
1844 # You want me to be verbose? I'll give you two trees! Twice as much value. | 1846 # You want me to be verbose? I'll give you two trees! Twice as much value. |
1845 if "--tree" in emerge.opts and "--verbose" in emerge.opts: | 1847 if "--tree" in emerge.opts and "--verbose" in emerge.opts: |
1846 deps.PrintTree(deps_tree) | 1848 deps.PrintTree(deps_tree) |
1847 | 1849 |
1848 deps_graph = deps.GenDependencyGraph(deps_tree, deps_info, remote_pkgs) | 1850 deps_graph = deps.GenDependencyGraph(deps_tree, deps_info, remote_pkgs) |
1849 | 1851 |
1850 # OK, time to print out our progress so far. | 1852 # OK, time to print out our progress so far. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1894 # need to upgrade the rest of the packages. So we'll go ahead and do that. | 1896 # need to upgrade the rest of the packages. So we'll go ahead and do that. |
1895 if portage_upgrade: | 1897 if portage_upgrade: |
1896 args = sys.argv[1:] + ["--nomerge=sys-apps/portage"] | 1898 args = sys.argv[1:] + ["--nomerge=sys-apps/portage"] |
1897 os.execvp(os.path.realpath(sys.argv[0]), args) | 1899 os.execvp(os.path.realpath(sys.argv[0]), args) |
1898 | 1900 |
1899 print "Done" | 1901 print "Done" |
1900 sys.exit(0) | 1902 sys.exit(0) |
1901 | 1903 |
1902 if __name__ == "__main__": | 1904 if __name__ == "__main__": |
1903 main() | 1905 main() |
OLD | NEW |