Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: parallel_emerge

Issue 2825076: Actually disable collision-protect in parallel_emerge. (Closed) Base URL: ssh://git@chromiumos-git/crosutils.git
Patch Set: NO TYPOS! Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 # reuse here. 308 # reuse here.
309 if "--debug" in opts: 309 if "--debug" in opts:
310 os.environ["PORTAGE_DEBUG"] = "1" 310 os.environ["PORTAGE_DEBUG"] = "1"
311 if "--config-root" in opts: 311 if "--config-root" in opts:
312 os.environ["PORTAGE_CONFIGROOT"] = opts["--config-root"] 312 os.environ["PORTAGE_CONFIGROOT"] = opts["--config-root"]
313 if "--root" in opts: 313 if "--root" in opts:
314 os.environ["ROOT"] = opts["--root"] 314 os.environ["ROOT"] = opts["--root"]
315 if "--accept-properties" in opts: 315 if "--accept-properties" in opts:
316 os.environ["ACCEPT_PROPERTIES"] = opts["--accept-properties"] 316 os.environ["ACCEPT_PROPERTIES"] = opts["--accept-properties"]
317 317
318 # Portage has two flags for doing collision protection: collision-protect
319 # and protect-owned. The protect-owned feature is enabled by default and
320 # is quite useful: it checks to make sure that we don't have multiple
321 # packages that own the same file. The collision-protect feature is more
322 # strict, and less useful: it fails if it finds a conflicting file, even
323 # if that file was created by an earlier ebuild that failed to install.
324 #
325 # We want to disable collision-protect here because we don't handle
326 # failures during the merge step very well. Sometimes we leave old files
327 # lying around and they cause problems, so for now we disable the flag.
328 # TODO(davidjames): Look for a better solution.
329 features = os.environ.get("FEATURES", "") + " -collision-protect"
330 os.environ["FEATURES"] = features
331
318 # Now that we've setup the necessary environment variables, we can load the 332 # Now that we've setup the necessary environment variables, we can load the
319 # emerge config from disk. 333 # emerge config from disk.
320 settings, trees, mtimedb = load_emerge_config() 334 settings, trees, mtimedb = load_emerge_config()
321 335
322 # Check whether our portage tree is out of date. Typically, this happens 336 # Check whether our portage tree is out of date. Typically, this happens
323 # when you're setting up a new portage tree, such as in setup_board and 337 # when you're setting up a new portage tree, such as in setup_board and
324 # make_chroot. In that case, portage applies a bunch of global updates 338 # make_chroot. In that case, portage applies a bunch of global updates
325 # here. Once the updates are finished, we need to commit any changes 339 # here. Once the updates are finished, we need to commit any changes
326 # that the global update made to our mtimedb, and reload the config. 340 # that the global update made to our mtimedb, and reload the config.
327 # 341 #
(...skipping 21 matching lines...) Expand all
349 opts.setdefault("--resume", True) 363 opts.setdefault("--resume", True)
350 if "--buildpkgonly" in opts: 364 if "--buildpkgonly" in opts:
351 # --buildpkgonly will not merge anything, so it overrides all binary 365 # --buildpkgonly will not merge anything, so it overrides all binary
352 # package options. 366 # package options.
353 for opt in ("--getbinpkg", "--getbinpkgonly", 367 for opt in ("--getbinpkg", "--getbinpkgonly",
354 "--usepkg", "--usepkgonly"): 368 "--usepkg", "--usepkgonly"):
355 opts.pop(opt, None) 369 opts.pop(opt, None)
356 if (settings.get("PORTAGE_DEBUG", "") == "1" and 370 if (settings.get("PORTAGE_DEBUG", "") == "1" and
357 "python-trace" in settings.features): 371 "python-trace" in settings.features):
358 portage.debug.set_trace(True) 372 portage.debug.set_trace(True)
359 # Since we don't have locking around merges, the collision-protect
360 # feature doesn't make sense.
361 settings.features.discard("collision-protect")
362 373
363 # Complain about unsupported options 374 # Complain about unsupported options
364 for opt in ("--ask", "--ask-enter-invalid", "--complete-graph", 375 for opt in ("--ask", "--ask-enter-invalid", "--complete-graph",
365 "--resume", "--skipfirst"): 376 "--resume", "--skipfirst"):
366 if opt in opts: 377 if opt in opts:
367 print "%s is not supported by parallel_emerge" % opt 378 print "%s is not supported by parallel_emerge" % opt
368 sys.exit(1) 379 sys.exit(1)
369 380
370 # Make emerge specific adjustments to the config (e.g. colors!) 381 # Make emerge specific adjustments to the config (e.g. colors!)
371 adjust_configs(opts, trees) 382 adjust_configs(opts, trees)
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 for db_pkg in final_db.match_pkgs(pkg): 1282 for db_pkg in final_db.match_pkgs(pkg):
1272 print "Adding %s to world" % db_pkg.cp 1283 print "Adding %s to world" % db_pkg.cp
1273 new_world_pkgs.append(db_pkg.cp) 1284 new_world_pkgs.append(db_pkg.cp)
1274 if new_world_pkgs: 1285 if new_world_pkgs:
1275 world_set.update(new_world_pkgs) 1286 world_set.update(new_world_pkgs)
1276 1287
1277 print "Done" 1288 print "Done"
1278 1289
1279 if __name__ == "__main__": 1290 if __name__ == "__main__":
1280 main() 1291 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698