From 57a1219ba81b8f7d9c9beecf27ed500da6239b3a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 10 Feb 2012 11:47:38 -0800 Subject: [PATCH] EbuildMerge: add exit_hook to unlock build dir This is needed since commit 7a6c34cc6bd6eb20a97e05347f87a0157f4ae58a in order to ensure that the build dir is unlocked before exit listeners are called. It fixes failures in catalyst stage 1 builds where two instances of the same package, built sequentially for separate roots, interfere with eachother's build dir lock. --- pym/_emerge/Binpkg.py | 4 ++-- pym/_emerge/EbuildBuild.py | 4 ++-- pym/_emerge/EbuildMerge.py | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py index 6c70b19f0..395a506c3 100644 --- a/pym/_emerge/Binpkg.py +++ b/pym/_emerge/Binpkg.py @@ -373,13 +373,13 @@ class Binpkg(CompositeTask): self._build_dir.unlock() def create_install_task(self): - task = EbuildMerge(find_blockers=self.find_blockers, + task = EbuildMerge(exit_hook=self._install_exit, + find_blockers=self.find_blockers, ldpath_mtimes=self.ldpath_mtimes, logger=self.logger, pkg=self.pkg, pkg_count=self.pkg_count, pkg_path=self._pkg_path, scheduler=self.scheduler, settings=self.settings, tree=self._tree, world_atom=self.world_atom) - task.addExitListener(self._install_exit) return task def _install_exit(self, task): diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py index d44dcf357..6e37cdaaa 100644 --- a/pym/_emerge/EbuildBuild.py +++ b/pym/_emerge/EbuildBuild.py @@ -360,7 +360,8 @@ class EbuildBuild(CompositeTask): ebuild_path = self._ebuild_path tree = self._tree - task = EbuildMerge(find_blockers=self.find_blockers, + task = EbuildMerge(exit_hook=self._install_exit, + find_blockers=self.find_blockers, ldpath_mtimes=ldpath_mtimes, logger=logger, pkg=pkg, pkg_count=pkg_count, pkg_path=ebuild_path, scheduler=self.scheduler, @@ -373,7 +374,6 @@ class EbuildBuild(CompositeTask): (pkg_count.curval, pkg_count.maxval, pkg.cpv) logger.log(msg, short_msg=short_msg) - task.addExitListener(self._install_exit) return task def _install_exit(self, task): diff --git a/pym/_emerge/EbuildMerge.py b/pym/_emerge/EbuildMerge.py index 9c3598821..df0778c6c 100644 --- a/pym/_emerge/EbuildMerge.py +++ b/pym/_emerge/EbuildMerge.py @@ -7,7 +7,7 @@ from portage.dbapi._MergeProcess import MergeProcess class EbuildMerge(CompositeTask): - __slots__ = ("find_blockers", "logger", "ldpath_mtimes", + __slots__ = ("exit_hook", "find_blockers", "logger", "ldpath_mtimes", "pkg", "pkg_count", "pkg_path", "pretend", "settings", "tree", "world_atom") @@ -35,6 +35,7 @@ class EbuildMerge(CompositeTask): def _merge_exit(self, merge_task): if self._final_exit(merge_task) != os.EX_OK: + self.exit_hook(self) self.wait() return @@ -53,4 +54,5 @@ class EbuildMerge(CompositeTask): logger.log(" ::: completed emerge (%s of %s) %s to %s" % \ (pkg_count.curval, pkg_count.maxval, pkg.cpv, pkg.root)) + self.exit_hook(self) self.wait() -- 2.26.2