From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QPTyY-0003Xf-Vf for garchives@archives.gentoo.org; Thu, 26 May 2011 06:23:19 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0CC101C4F1; Thu, 26 May 2011 06:18:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CF2901C4F1 for ; Thu, 26 May 2011 06:18:29 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 906521B400D for ; Thu, 26 May 2011 06:18:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 01E8180505 for ; Thu, 26 May 2011 06:18:29 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <7e8cf234141ea5c1c86032b82e81c3c9640908ed.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/EbuildBuildDir.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 7e8cf234141ea5c1c86032b82e81c3c9640908ed Date: Thu, 26 May 2011 06:18:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 89d6c7c26140dfd656a0f525bdb6a832 commit: 7e8cf234141ea5c1c86032b82e81c3c9640908ed Author: Zac Medico gentoo org> AuthorDate: Mon May 16 07:10:07 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu May 26 03:04:27 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D7e8cf234 EbuildBuildDir: handle AsynchronousLock failure --- pym/_emerge/EbuildBuildDir.py | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pym/_emerge/EbuildBuildDir.py b/pym/_emerge/EbuildBuildDir.p= y index 1da3c93..3e0aefb 100644 --- a/pym/_emerge/EbuildBuildDir.py +++ b/pym/_emerge/EbuildBuildDir.py @@ -43,6 +43,8 @@ class EbuildBuildDir(SlotObject): catdir_lock =3D AsynchronousLock(path=3Dcatdir, scheduler=3Dself.sched= uler) catdir_lock.start() catdir_lock.wait() + self._assert_lock(catdir_lock) + try: try: portage.util.ensure_dirs(catdir, @@ -55,12 +57,19 @@ class EbuildBuildDir(SlotObject): scheduler=3Dself.scheduler) builddir_lock.start() builddir_lock.wait() + self._assert_lock(builddir_lock) self._lock_obj =3D builddir_lock self.settings['PORTAGE_BUILDIR_LOCKED'] =3D '1' finally: self.locked =3D self._lock_obj is not None catdir_lock.unlock() =20 + def _assert_lock(self, async_lock): + if async_lock.returncode !=3D os.EX_OK: + # TODO: create a better way to propagate this error to the caller + raise AssertionError("AsynchronousLock failed with returncode %s" \ + % (async_lock.returncode,)) + def clean_log(self): """Discard existing log. The log will not be be discarded in cases when it would not make sense, like when FEATURES=3Dkeepwork @@ -85,15 +94,15 @@ class EbuildBuildDir(SlotObject): self.settings.pop('PORTAGE_BUILDIR_LOCKED', None) catdir_lock =3D AsynchronousLock(path=3Dself._catdir, scheduler=3Dself= .scheduler) catdir_lock.start() - catdir_lock.wait() - try: - os.rmdir(self._catdir) - except OSError as e: - if e.errno not in (errno.ENOENT, - errno.ENOTEMPTY, errno.EEXIST, errno.EPERM): - raise - finally: - catdir_lock.unlock() + if catdir_lock.wait() =3D=3D os.EX_OK: + try: + os.rmdir(self._catdir) + except OSError as e: + if e.errno not in (errno.ENOENT, + errno.ENOTEMPTY, errno.EEXIST, errno.EPERM): + raise + finally: + catdir_lock.unlock() =20 class AlreadyLocked(portage.exception.PortageException): pass