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-380476-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1R1MSj-0003Mv-7O
	for garchives@archives.gentoo.org; Wed, 07 Sep 2011 18:03:01 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id CF8B721C16D;
	Wed,  7 Sep 2011 18:02:42 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id A401B21C16D
	for <gentoo-commits@lists.gentoo.org>; Wed,  7 Sep 2011 18:02:42 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 3F2621B401E
	for <gentoo-commits@lists.gentoo.org>; Wed,  7 Sep 2011 18:02:42 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 8D25D80042
	for <gentoo-commits@lists.gentoo.org>; Wed,  7 Sep 2011 18:02:41 +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: <4b8614d99da3e4d5ce46c70c944cce5d5d1d9a1f.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/egencache
X-VCS-Directories: bin/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 4b8614d99da3e4d5ce46c70c944cce5d5d1d9a1f
Date: Wed,  7 Sep 2011 18:02:41 +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: 
X-Archives-Hash: 45d2a4bbd6d9e71a6b24f1bfe1cd980e

commit:     4b8614d99da3e4d5ce46c70c944cce5d5d1d9a1f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  7 18:01:14 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep  7 18:01:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3D4b8614d9

egencache: tweak cache dir write access check

---
 bin/egencache |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 6229ed6..7766e78 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -818,21 +818,25 @@ def egencache_main(args):
 	if options.update and 'metadata-transfer' not in settings.features:
 		settings.features.add('metadata-transfer')
=20
+	settings.lock()
+
+	portdb =3D portage.portdbapi(mysettings=3Dsettings)
+
 	if options.update:
 		if options.cache_dir is not None:
 			# already validated earlier
 			pass
 		else:
-			if os.path.isdir(settings["PORTAGE_DEPCACHEDIR"]) and \
-				not os.access(settings["PORTAGE_DEPCACHEDIR"], os.W_OK):
+			# We check write access after the portdbapi constructor
+			# has had an opportunity to create it. This ensures that
+			# we don't use the cache in the "volatile" mode which is
+			# undesirable for egencache.
+			if not os.access(settings["PORTAGE_DEPCACHEDIR"], os.W_OK):
 				writemsg_level("ecachegen: error: " + \
 					"write access denied: %s\n" % (settings["PORTAGE_DEPCACHEDIR"],),
 					level=3Dlogging.ERROR, noiselevel=3D-1)
 				return 1
=20
-	settings.lock()
-
-	portdb =3D portage.portdbapi(mysettings=3Dsettings)
 	if options.repo is not None:
 		repo_path =3D portdb.getRepositoryPath(options.repo)
 		if repo_path is None: