From 8532def19ab0426b14b6fdd80f026d9afb94499f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 14 Sep 2010 09:00:42 -0700 Subject: [PATCH] Make EbuildBuildDir.unlock() use an asynchronous lock when locking the category directory for removal. --- pym/_emerge/EbuildBuildDir.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/pym/_emerge/EbuildBuildDir.py b/pym/_emerge/EbuildBuildDir.py index 921cf807f..de3f56dfb 100644 --- a/pym/_emerge/EbuildBuildDir.py +++ b/pym/_emerge/EbuildBuildDir.py @@ -74,21 +74,17 @@ class EbuildBuildDir(SlotObject): self._lock_obj = None self.locked = False self.settings.pop('PORTAGE_BUILDIR_LOCKED', None) - - catdir = self._catdir - catdir_lock = None + catdir_lock = AsynchronousLock(path=self._catdir, scheduler=self.scheduler) + catdir_lock.start() + catdir_lock.wait() try: - catdir_lock = portage.locks.lockdir(catdir) + os.rmdir(self._catdir) + except OSError as e: + if e.errno not in (errno.ENOENT, + errno.ENOTEMPTY, errno.EEXIST): + raise finally: - if catdir_lock: - try: - os.rmdir(catdir) - except OSError as e: - if e.errno not in (errno.ENOENT, - errno.ENOTEMPTY, errno.EEXIST): - raise - del e - portage.locks.unlockdir(catdir_lock) + catdir_lock.unlock() class AlreadyLocked(portage.exception.PortageException): pass -- 2.26.2