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 1R1L0u-00067R-3I for garchives@archives.gentoo.org; Wed, 07 Sep 2011 16:30:12 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4C97F21C0D3; Wed, 7 Sep 2011 16:30:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 21AD221C0D3 for ; Wed, 7 Sep 2011 16:30:04 +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 76FC71B400D for ; Wed, 7 Sep 2011 16:30:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 70DE080042 for ; Wed, 7 Sep 2011 16:30:02 +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: 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: d3aebd49c1a6b893b078f5593677f295a8e77903 Date: Wed, 7 Sep 2011 16:30:02 +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: 52e4345cb9391d0684fa07c797b5b0fb commit: d3aebd49c1a6b893b078f5593677f295a8e77903 Author: Zac Medico gentoo org> AuthorDate: Wed Sep 7 16:29:48 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Sep 7 16:29:48 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dd3aebd49 egencache: validate cache dir more --- bin/egencache | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/egencache b/bin/egencache index bf29474..66854e1 100755 --- a/bin/egencache +++ b/bin/egencache @@ -163,9 +163,13 @@ def parse_args(args): parser.error("Not a directory: --config-root=3D'%s'" % \ (options.config_root,)) =20 - if options.cache_dir is not None and not os.path.isdir(options.cache_di= r): - parser.error("Not a directory: --cache-dir=3D'%s'" % \ - (options.cache_dir,)) + if options.cache_dir is not None: + if not os.path.isdir(options.cache_dir): + parser.error("Not a directory: --cache-dir=3D'%s'" % \ + (options.cache_dir,)) + if not os.access(options.cache_dir, os.W_OK): + parser.error("Write access denied: --cache-dir=3D'%s'" % \ + (options.cache_dir,)) =20 if options.portdir_overlay is not None and \ options.repo is None: @@ -817,6 +821,18 @@ def egencache_main(args): level=3Dlogging.WARNING, noiselevel=3D-1) settings.features.add('metadata-transfer') =20 + 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): + writemsg_level("ecachegen: error: " + \ + "write access denied: %s\n" % (settings["PORTAGE_DEPCACHEDIR"],), + level=3Dlogging.ERROR, noiselevel=3D-1) + return 1 + settings.lock() =20 portdb =3D portage.portdbapi(mysettings=3Dsettings)