summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 03:27:27 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 03:27:27 +0000
commit9dac64d8db6bc89acebeb2ff7e2d8a19f378d924 (patch)
tree6f0717927ad25c1344421c9ecf4fe2e8be4ff113 /pym
parentf8dc250a08d8d6843a32c087ea0e6563b62f68b0 (diff)
downloadportage-9dac64d8db6bc89acebeb2ff7e2d8a19f378d924.tar.gz
portage-9dac64d8db6bc89acebeb2ff7e2d8a19f378d924.tar.bz2
portage-9dac64d8db6bc89acebeb2ff7e2d8a19f378d924.zip
When scheduling builds in parallel for --jobs, avoid potential build dir
collisions in cases when the same exact cpv needs to be merged to multiple $ROOTs (like when building stages). Thanks for Daniel Robbins for reporting this issue and troubleshooting it. (trunk r12557) svn path=/main/branches/2.1.6/; revision=12843
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 7636e3cdc..160e32901 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -9921,6 +9921,7 @@ class Scheduler(PollScheduler):
self._digraph = digraph
self._prune_digraph()
+ self._prevent_builddir_collisions()
def _prune_digraph(self):
"""
@@ -9943,6 +9944,26 @@ class Scheduler(PollScheduler):
break
removed_nodes.clear()
+ def _prevent_builddir_collisions(self):
+ """
+ When building stages, sometimes the same exact cpv needs to be merged
+ to both $ROOTs. Add edges to the digraph in order to avoid collisions
+ in the builddir. Currently, normal file locks would be inappropriate
+ for this purpose since emerge holds all of it's build dir locks from
+ the main process.
+ """
+ cpv_map = {}
+ for pkg in self._mergelist:
+ if pkg.installed:
+ continue
+ if pkg.cpv not in cpv_map:
+ cpv_map[pkg.cpv] = [pkg]
+ continue
+ for earlier_pkg in cpv_map[pkg.cpv]:
+ self._digraph.add(earlier_pkg, pkg,
+ priority=DepPriority(buildtime=True))
+ cpv_map[pkg.cpv].append(pkg)
+
class _pkg_failure(portage.exception.PortageException):
"""
An instance of this class is raised by unmerge() when