diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-01-28 08:47:38 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-01-28 08:47:38 +0000 |
commit | 43e23f470a35215a96c646d107e3a6dc31d16216 (patch) | |
tree | efaa0c1f2d02f7f4bfdb824a43a384a7966a272f | |
parent | 5b1d653ae0f85814b3c633f2579608646ac5122e (diff) | |
download | portage-43e23f470a35215a96c646d107e3a6dc31d16216.tar.gz portage-43e23f470a35215a96c646d107e3a6dc31d16216.tar.bz2 portage-43e23f470a35215a96c646d107e3a6dc31d16216.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.
svn path=/main/trunk/; revision=12557
-rw-r--r-- | pym/_emerge/__init__.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 7f02a48d7..881ba9cc6 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -9937,6 +9937,7 @@ class Scheduler(PollScheduler): self._digraph = digraph self._prune_digraph() + self._prevent_builddir_collisions() def _prune_digraph(self): """ @@ -9959,6 +9960,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 |