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 1QIpXq-0007CC-Rp for garchives@archives.gentoo.org; Sat, 07 May 2011 22:00:15 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 875951C007; Sat, 7 May 2011 22:00:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4FEA81C007 for ; Sat, 7 May 2011 22:00:07 +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 D88751B4016 for ; Sat, 7 May 2011 22:00:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1F56D80504 for ; Sat, 7 May 2011 22:00:06 +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: <8601ea2b80208491b471f37710b35813fd341c28.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild.sh pym/portage/package/ebuild/doebuild.py X-VCS-Directories: pym/portage/package/ebuild/ bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 8601ea2b80208491b471f37710b35813fd341c28 Date: Sat, 7 May 2011 22:00:06 +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: b6ac72c91e8f23ce5d82bdc2a530e9e1 commit: 8601ea2b80208491b471f37710b35813fd341c28 Author: Zac Medico gentoo org> AuthorDate: Sat May 7 21:59:54 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat May 7 21:59:54 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D8601ea2b doebuild: use EbuildBuildDir for locking EbuildBuildDir also performs safe removal of the category when it is empty, so ebuild.sh/dyn_clean doesn't need to do it anymore. This fixes a race condition if one process is trying to remove the category directory while another one is trying to create it for PORTAGE_BUILDDIR. --- bin/ebuild.sh | 2 +- pym/portage/package/ebuild/doebuild.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index f3349ae..c3cf181 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -812,7 +812,7 @@ dyn_clean() { # Some kernels, such as Solaris, return EINVAL when an attempt # is made to remove the current working directory. cd "$PORTAGE_BUILDDIR"/../.. - rmdir "$PORTAGE_BUILDDIR" "${PORTAGE_BUILDDIR%/*}" 2>/dev/null + rmdir "$PORTAGE_BUILDDIR" 2>/dev/null =20 true } diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package= /ebuild/doebuild.py index 1c04822..f83a1e3 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -566,8 +566,19 @@ def doebuild(myebuild, mydo, myroot, mysettings, deb= ug=3D0, listonly=3D0, use_cache, mydbapi) =20 if mydo in clean_phases: - return _spawn_phase(mydo, mysettings, - fd_pipes=3Dfd_pipes, returnpid=3Dreturnpid) + builddir_lock =3D None + if not returnpid and \ + 'PORTAGE_BUILDIR_LOCKED' not in mysettings: + builddir_lock =3D EbuildBuildDir( + scheduler=3DPollScheduler().sched_iface, + settings=3Dmysettings) + builddir_lock.lock() + try: + return _spawn_phase(mydo, mysettings, + fd_pipes=3Dfd_pipes, returnpid=3Dreturnpid) + finally: + if builddir_lock is not None: + builddir_lock.unlock() =20 restrict =3D set(mysettings.get('PORTAGE_RESTRICT', '').split()) # get possible slot information from the deps file