diff options
Diffstat (limited to 'pym/_emerge/EbuildPhase.py')
-rw-r--r-- | pym/_emerge/EbuildPhase.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py index 07fb69ca7..77b3a4d88 100644 --- a/pym/_emerge/EbuildPhase.py +++ b/pym/_emerge/EbuildPhase.py @@ -10,6 +10,8 @@ from _emerge.MiscFunctionsProcess import MiscFunctionsProcess from _emerge.EbuildProcess import EbuildProcess from _emerge.CompositeTask import CompositeTask from portage.util import writemsg +from portage.locks import lockdir +from portage.locks import unlockdir from portage.xml.metadata import MetaDataXML import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -28,7 +30,7 @@ from portage import _unicode_encode class EbuildPhase(CompositeTask): - __slots__ = ("actionmap", "phase", "settings") + __slots__ = ("actionmap", "ebuild_lock", "phase", "settings") # FEATURES displayed prior to setup phase _features_display = ("ccache", "distcc", "fakeroot", @@ -37,6 +39,9 @@ class EbuildPhase(CompositeTask): "splitdebug", "suidctl", "test", "userpriv", "usersandbox") + # Locked phases + _locked_phases = ("setup", "preinst", "postinst", "prerm", "postrm") + def _start(self): need_builddir = self.phase not in EbuildProcess._phases_without_builddir @@ -138,10 +143,18 @@ class EbuildPhase(CompositeTask): phase=self.phase, scheduler=self.scheduler, settings=self.settings) + if (self.phase in self._locked_phases and + "no-ebuild-locks" not in self.settings.features): + root = self.settings["ROOT"] + lock_path = os.path.join(root, portage.VDB_PATH + "-ebuild") + self.ebuild_lock = lockdir(lock_path) self._start_task(ebuild_process, self._ebuild_exit) def _ebuild_exit(self, ebuild_process): + if self.ebuild_lock: + unlockdir(self.ebuild_lock) + fail = False if self._default_exit(ebuild_process) != os.EX_OK: if self.phase == "test" and \ |