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 <gentoo-commits+bounces-401413-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RQssi-0006s5-Nm
	for garchives@archives.gentoo.org; Thu, 17 Nov 2011 03:43:20 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id EC86021C041;
	Thu, 17 Nov 2011 03:43:12 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id BB62921C041
	for <gentoo-commits@lists.gentoo.org>; Thu, 17 Nov 2011 03:43:12 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 3414F1B4021
	for <gentoo-commits@lists.gentoo.org>; Thu, 17 Nov 2011 03:43:12 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 8B71D80042
	for <gentoo-commits@lists.gentoo.org>; Thu, 17 Nov 2011 03:43:11 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <b552912a54d0240325c1b3b8bef744ea04a513f8.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: pym/_emerge/Scheduler.py
X-VCS-Directories: pym/_emerge/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: b552912a54d0240325c1b3b8bef744ea04a513f8
Date: Thu, 17 Nov 2011 03:43:11 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: c4464cdb-4d2a-4628-8107-86eaf6043002
X-Archives-Hash: 0dd5d41011bd10c5129d407453b36471

commit:     b552912a54d0240325c1b3b8bef744ea04a513f8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 17 03:43:00 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Nov 17 03:43:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3Db552912a

pkg_pretend: tweak final cleanup logic

This ensures that the clean phase will not run if the user interrupts
emerge before the build dir is locked.

---
 pym/_emerge/Scheduler.py |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index fb8fdfb..261fa95 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -923,13 +923,12 @@ class Scheduler(PollScheduler):
 				os.path.realpath(settings["PORTAGE_TMPDIR"]),
 				"portage", x.category, x.pf)
 			existing_buildir =3D os.path.isdir(build_dir_path)
-			build_dir =3D None
+			settings["PORTAGE_BUILDDIR"] =3D build_dir_path
+			build_dir =3D EbuildBuildDir(scheduler=3Dsched_iface,
+				settings=3Dsettings)
+			build_dir.lock()
=20
 			try:
-				settings["PORTAGE_BUILDDIR"] =3D build_dir_path
-				build_dir =3D EbuildBuildDir(scheduler=3Dsched_iface,
-					settings=3Dsettings)
-				build_dir.lock()
=20
 				# Clean up the existing build dir, in case pkg_pretend
 				# checks for available space (bug #390711).
@@ -1005,12 +1004,11 @@ class Scheduler(PollScheduler):
 					failures +=3D 1
 				portage.elog.elog_process(x.cpv, settings)
 			finally:
-				if build_dir is not None:
-					clean_phase =3D EbuildPhase(background=3DFalse,
-						phase=3D'clean', scheduler=3Dsched_iface, settings=3Dsettings)
-					clean_phase.start()
-					clean_phase.wait()
-					build_dir.unlock()
+				clean_phase =3D EbuildPhase(background=3DFalse,
+					phase=3D'clean', scheduler=3Dsched_iface, settings=3Dsettings)
+				clean_phase.start()
+				clean_phase.wait()
+				build_dir.unlock()
=20
 		if failures:
 			return 1