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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 elif action == "uninstall": | 597 elif action == "uninstall": |
598 cmdline = EmergeCommand() + " --nodeps --unmerge =" + target | 598 cmdline = EmergeCommand() + " --nodeps --unmerge =" + target |
599 else: | 599 else: |
600 # This package is a dependency of something we specifically | 600 # This package is a dependency of something we specifically |
601 # requested. Therefore we should install it but not allow it | 601 # requested. Therefore we should install it but not allow it |
602 # in the "world" file, which represents explicit installs. | 602 # in the "world" file, which represents explicit installs. |
603 # --oneshot" here will prevent it from being tagged in world. | 603 # --oneshot" here will prevent it from being tagged in world. |
604 cmdline = EmergeCommand() + " --nodeps --oneshot " | 604 cmdline = EmergeCommand() + " --nodeps --oneshot " |
605 this_pkg = self._deps_map[target] | 605 this_pkg = self._deps_map[target] |
606 if this_pkg["workon"]: | 606 if this_pkg["workon"]: |
607 # --usepkg=n --getbinpkg=n: Build from source | 607 # --usepkg=n --usepkgonly=n --getbinpkg=n |
| 608 # --getbinpkgonly=n: Build from source |
608 # --selective=n: Re-emerge even if package is already installed. | 609 # --selective=n: Re-emerge even if package is already installed. |
609 cmdline += "--usepkg=n --getbinpkg=n --selective=n " | 610 cmdline += ("--usepkg=n --usepkgonly=n --getbinpkg=n " |
| 611 "--getbinpkgonly=n --selective=n ") |
610 cmdline += "=" + target | 612 cmdline += "=" + target |
611 deps_info = this_pkg["deps_info"] | 613 deps_info = this_pkg["deps_info"] |
612 if deps_info["uninstall"]: | 614 if deps_info["uninstall"]: |
613 package = "%(pkgdir)s/%(pkgname)s-%(oldversion)s" % deps_info | 615 package = "%(pkgdir)s/%(pkgname)s-%(oldversion)s" % deps_info |
614 cmdline += " && %s -C =%s" % (EmergeCommand(), package) | 616 cmdline += " && %s -C =%s" % (EmergeCommand(), package) |
615 | 617 |
616 print "+ %s" % cmdline | 618 print "+ %s" % cmdline |
617 | 619 |
618 # Store output in a temp file as it is too big for a unix pipe. | 620 # Store output in a temp file as it is too big for a unix pipe. |
619 stdout_buffer = tempfile.TemporaryFile() | 621 stdout_buffer = tempfile.TemporaryFile() |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 # Print an update. | 748 # Print an update. |
747 self._Status() | 749 self._Status() |
748 | 750 |
749 | 751 |
750 # Main control code. | 752 # Main control code. |
751 OPTS, EMERGE_ACTION, EMERGE_OPTS, EMERGE_FILES = ParseArgs(sys.argv) | 753 OPTS, EMERGE_ACTION, EMERGE_OPTS, EMERGE_FILES = ParseArgs(sys.argv) |
752 | 754 |
753 if EMERGE_ACTION is not None: | 755 if EMERGE_ACTION is not None: |
754 # Pass action arguments straight through to emerge | 756 # Pass action arguments straight through to emerge |
755 EMERGE_OPTS["--%s" % EMERGE_ACTION] = True | 757 EMERGE_OPTS["--%s" % EMERGE_ACTION] = True |
756 sys.exit(os.system(EmergeCommand())) | 758 sys.exit(os.system(EmergeCommand() + " " + " ".join(EMERGE_FILES))) |
757 elif not EMERGE_FILES: | 759 elif not EMERGE_FILES: |
758 Usage() | 760 Usage() |
759 sys.exit(1) | 761 sys.exit(1) |
760 | 762 |
761 print "Starting fast-emerge." | 763 print "Starting fast-emerge." |
762 print " Building package %s on %s" % (" ".join(EMERGE_FILES), | 764 print " Building package %s on %s" % (" ".join(EMERGE_FILES), |
763 OPTS.get("board", "root")) | 765 OPTS.get("board", "root")) |
764 | 766 |
765 # If the user supplied the --workon option, we may have to run emerge twice | 767 # If the user supplied the --workon option, we may have to run emerge twice |
766 # to generate a dependency ordering for packages that depend on the workon | 768 # to generate a dependency ordering for packages that depend on the workon |
(...skipping 21 matching lines...) Expand all Loading... |
788 | 790 |
789 if VERBOSE: | 791 if VERBOSE: |
790 PrintDepsMap(dependency_graph) | 792 PrintDepsMap(dependency_graph) |
791 | 793 |
792 # Run the queued emerges. | 794 # Run the queued emerges. |
793 scheduler = EmergeQueue(dependency_graph) | 795 scheduler = EmergeQueue(dependency_graph) |
794 scheduler.Run() | 796 scheduler.Run() |
795 | 797 |
796 print "Done" | 798 print "Done" |
797 | 799 |
OLD | NEW |