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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 board_no_variant = self.board.split('_')[0] | 303 board_no_variant = self.board.split('_')[0] |
304 f = open(toolchain_path % (scripts_dir, board_no_variant)) | 304 f = open(toolchain_path % (scripts_dir, board_no_variant)) |
305 os.environ["CHOST"] = f.readline().strip() | 305 os.environ["CHOST"] = f.readline().strip() |
306 f.close() | 306 f.close() |
307 | 307 |
308 # Although CHROMEOS_ROOT isn't specific to boards, it's normally setup | 308 # Although CHROMEOS_ROOT isn't specific to boards, it's normally setup |
309 # inside emerge-${BOARD}, so we set it up here for compatibility. It | 309 # inside emerge-${BOARD}, so we set it up here for compatibility. It |
310 # will be going away soon as we migrate to CROS_WORKON_SRCROOT. | 310 # will be going away soon as we migrate to CROS_WORKON_SRCROOT. |
311 os.environ.setdefault("CHROMEOS_ROOT", os.environ["HOME"] + "/trunk") | 311 os.environ.setdefault("CHROMEOS_ROOT", os.environ["HOME"] + "/trunk") |
312 | 312 |
313 # Modify the environment to disable locking by default. | |
314 # TODO(davidjames): This option can cause problems if packages muck | |
315 # with each other during the post-install step. There are a few host | |
316 # packages that do this, so we only do this environment modification for | |
317 # board builds. | |
318 os.environ.setdefault("PORTAGE_LOCKS", "false") | |
319 | |
320 # Turn off interactive delays | 313 # Turn off interactive delays |
321 os.environ["EBEEP_IGNORE"] = "1" | 314 os.environ["EBEEP_IGNORE"] = "1" |
322 os.environ["EPAUSE_IGNORE"] = "1" | 315 os.environ["EPAUSE_IGNORE"] = "1" |
323 os.environ["UNMERGE_DELAY"] = "0" | 316 os.environ["UNMERGE_DELAY"] = "0" |
324 | 317 |
325 # Parse the emerge options. | 318 # Parse the emerge options. |
326 action, opts, cmdline_packages = parse_opts(emerge_args) | 319 action, opts, cmdline_packages = parse_opts(emerge_args) |
327 | 320 |
328 # If we're installing to the board, we want the --root-deps option so that | 321 # If we're installing to the board, we want the --root-deps option so that |
329 # portage will install the build dependencies to that location as well. | 322 # portage will install the build dependencies to that location as well. |
(...skipping 20 matching lines...) Expand all Loading... |
350 # packages that own the same file. The collision-protect feature is more | 343 # packages that own the same file. The collision-protect feature is more |
351 # strict, and less useful: it fails if it finds a conflicting file, even | 344 # strict, and less useful: it fails if it finds a conflicting file, even |
352 # if that file was created by an earlier ebuild that failed to install. | 345 # if that file was created by an earlier ebuild that failed to install. |
353 # | 346 # |
354 # We want to disable collision-protect here because we don't handle | 347 # We want to disable collision-protect here because we don't handle |
355 # failures during the merge step very well. Sometimes we leave old files | 348 # failures during the merge step very well. Sometimes we leave old files |
356 # lying around and they cause problems, so for now we disable the flag. | 349 # lying around and they cause problems, so for now we disable the flag. |
357 # TODO(davidjames): Look for a better solution. | 350 # TODO(davidjames): Look for a better solution. |
358 features = os.environ.get("FEATURES", "") + " -collision-protect" | 351 features = os.environ.get("FEATURES", "") + " -collision-protect" |
359 | 352 |
360 # If we're cross-compiling, updating the environment every time we install | 353 # If we're installing packages to the board, and we're not using the |
361 # a package isn't necessary, and leads to race conditions when | 354 # official flag, we can enable the following optimizations: |
362 # PORTAGE_LOCKS is false. In this case, do environment updates at the end, | 355 # 1) Don't lock during install step. This allows multiple packages to be |
363 # instead. | 356 # installed at once. This is safe because our board packages do not |
364 if self.board and os.environ.get("PORTAGE_LOCKS") == "false": | 357 # muck with each other during the post-install step. |
| 358 # 2) Don't update the environment until the end of the build. This is |
| 359 # safe because board packages don't need to run during the build -- |
| 360 # they're cross-compiled, so our CPU architecture doesn't support them |
| 361 # anyway. |
| 362 if self.board and os.environ.get("CHROMEOS_OFFICIAL") != "1": |
| 363 os.environ.setdefault("PORTAGE_LOCKS", "false") |
365 features = features + " no-env-update" | 364 features = features + " no-env-update" |
366 | 365 |
367 os.environ["FEATURES"] = features | 366 os.environ["FEATURES"] = features |
368 | 367 |
369 # Now that we've setup the necessary environment variables, we can load the | 368 # Now that we've setup the necessary environment variables, we can load the |
370 # emerge config from disk. | 369 # emerge config from disk. |
371 settings, trees, mtimedb = load_emerge_config() | 370 settings, trees, mtimedb = load_emerge_config() |
372 | 371 |
373 # Check whether our portage tree is out of date. Typically, this happens | 372 # Check whether our portage tree is out of date. Typically, this happens |
374 # when you're setting up a new portage tree, such as in setup_board and | 373 # when you're setting up a new portage tree, such as in setup_board and |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 # need to upgrade the rest of the packages. So we'll go ahead and do that. | 1835 # need to upgrade the rest of the packages. So we'll go ahead and do that. |
1837 if portage_upgrade: | 1836 if portage_upgrade: |
1838 args = sys.argv[1:] + ["--nomerge=sys-apps/portage"] | 1837 args = sys.argv[1:] + ["--nomerge=sys-apps/portage"] |
1839 os.execvp(os.path.realpath(sys.argv[0]), args) | 1838 os.execvp(os.path.realpath(sys.argv[0]), args) |
1840 | 1839 |
1841 print "Done" | 1840 print "Done" |
1842 sys.exit(0) | 1841 sys.exit(0) |
1843 | 1842 |
1844 if __name__ == "__main__": | 1843 if __name__ == "__main__": |
1845 main() | 1844 main() |
OLD | NEW |