| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 board_no_variant = self.board.split('_')[0] | 293 board_no_variant = self.board.split('_')[0] |
| 294 f = open(toolchain_path % (scripts_dir, board_no_variant)) | 294 f = open(toolchain_path % (scripts_dir, board_no_variant)) |
| 295 os.environ["CHOST"] = f.readline().strip() | 295 os.environ["CHOST"] = f.readline().strip() |
| 296 f.close() | 296 f.close() |
| 297 | 297 |
| 298 # Although CHROMEOS_ROOT isn't specific to boards, it's normally setup | 298 # Although CHROMEOS_ROOT isn't specific to boards, it's normally setup |
| 299 # inside emerge-${BOARD}, so we set it up here for compatibility. It | 299 # inside emerge-${BOARD}, so we set it up here for compatibility. It |
| 300 # will be going away soon as we migrate to CROS_WORKON_SRCROOT. | 300 # will be going away soon as we migrate to CROS_WORKON_SRCROOT. |
| 301 os.environ.setdefault("CHROMEOS_ROOT", os.environ["HOME"] + "/trunk") | 301 os.environ.setdefault("CHROMEOS_ROOT", os.environ["HOME"] + "/trunk") |
| 302 | 302 |
| 303 # Modify the environment to disable locking. | 303 # Modify the environment to disable locking by default. |
| 304 os.environ["PORTAGE_LOCKS"] = "false" | 304 # TODO(davidjames): This option can cause problems if packages muck |
| 305 # with each other during the post-install step. There are a few host |
| 306 # packages that do this, so we only do this environment modification for |
| 307 # board builds. |
| 308 os.environ.setdefault("PORTAGE_LOCKS", "false") |
| 305 | 309 |
| 306 # Turn off interactive delays | 310 # Turn off interactive delays |
| 307 os.environ["EBEEP_IGNORE"] = "1" | 311 os.environ["EBEEP_IGNORE"] = "1" |
| 308 os.environ["EPAUSE_IGNORE"] = "1" | 312 os.environ["EPAUSE_IGNORE"] = "1" |
| 309 os.environ["UNMERGE_DELAY"] = "0" | 313 os.environ["UNMERGE_DELAY"] = "0" |
| 310 | 314 |
| 311 # Parse the emerge options. | 315 # Parse the emerge options. |
| 312 action, opts, cmdline_packages = parse_opts(emerge_args) | 316 action, opts, cmdline_packages = parse_opts(emerge_args) |
| 313 | 317 |
| 314 # If we're installing to the board, we want the --root-deps option so that | 318 # If we're installing to the board, we want the --root-deps option so that |
| (...skipping 22 matching lines...) Expand all Loading... |
| 337 # strict, and less useful: it fails if it finds a conflicting file, even | 341 # strict, and less useful: it fails if it finds a conflicting file, even |
| 338 # if that file was created by an earlier ebuild that failed to install. | 342 # if that file was created by an earlier ebuild that failed to install. |
| 339 # | 343 # |
| 340 # We want to disable collision-protect here because we don't handle | 344 # We want to disable collision-protect here because we don't handle |
| 341 # failures during the merge step very well. Sometimes we leave old files | 345 # failures during the merge step very well. Sometimes we leave old files |
| 342 # lying around and they cause problems, so for now we disable the flag. | 346 # lying around and they cause problems, so for now we disable the flag. |
| 343 # TODO(davidjames): Look for a better solution. | 347 # TODO(davidjames): Look for a better solution. |
| 344 features = os.environ.get("FEATURES", "") + " -collision-protect" | 348 features = os.environ.get("FEATURES", "") + " -collision-protect" |
| 345 | 349 |
| 346 # If we're cross-compiling, updating the environment every time we install | 350 # If we're cross-compiling, updating the environment every time we install |
| 347 # a package isn't necessary, and leads to race conditions. Do environment | 351 # a package isn't necessary, and leads to race conditions when |
| 348 # updates at the end, instead. | 352 # PORTAGE_LOCKS is false. In this case, do environment updates at the end, |
| 349 if self.board: | 353 # instead. |
| 354 if self.board and os.environ.get("PORTAGE_LOCKS") == "false": |
| 350 features = features + " no-env-update" | 355 features = features + " no-env-update" |
| 351 | 356 |
| 352 os.environ["FEATURES"] = features | 357 os.environ["FEATURES"] = features |
| 353 | 358 |
| 354 # Now that we've setup the necessary environment variables, we can load the | 359 # Now that we've setup the necessary environment variables, we can load the |
| 355 # emerge config from disk. | 360 # emerge config from disk. |
| 356 settings, trees, mtimedb = load_emerge_config() | 361 settings, trees, mtimedb = load_emerge_config() |
| 357 | 362 |
| 358 # Check whether our portage tree is out of date. Typically, this happens | 363 # Check whether our portage tree is out of date. Typically, this happens |
| 359 # when you're setting up a new portage tree, such as in setup_board and | 364 # when you're setting up a new portage tree, such as in setup_board and |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 # If we already upgraded portage, we don't need to do so again. But we do | 1690 # If we already upgraded portage, we don't need to do so again. But we do |
| 1686 # need to upgrade the rest of the packages. So we'll go ahead and do that. | 1691 # need to upgrade the rest of the packages. So we'll go ahead and do that. |
| 1687 if portage_upgrade: | 1692 if portage_upgrade: |
| 1688 args = sys.argv[1:] + ["--nomerge=sys-apps/portage"] | 1693 args = sys.argv[1:] + ["--nomerge=sys-apps/portage"] |
| 1689 os.execvp(os.path.realpath(sys.argv[0]), args) | 1694 os.execvp(os.path.realpath(sys.argv[0]), args) |
| 1690 | 1695 |
| 1691 print "Done" | 1696 print "Done" |
| 1692 | 1697 |
| 1693 if __name__ == "__main__": | 1698 if __name__ == "__main__": |
| 1694 main() | 1699 main() |
| OLD | NEW |