From: Zac Medico Date: Tue, 14 Sep 2010 16:00:42 +0000 (-0700) Subject: Make EbuildBuildDir.unlock() use an asynchronous lock when locking the X-Git-Tag: v2.2_rc82~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8532def19ab0426b14b6fdd80f026d9afb94499f;p=portage.git Make EbuildBuildDir.unlock() use an asynchronous lock when locking the category directory for removal. --- 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