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-335986-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QABmC-0003ga-Ld
	for garchives@archives.gentoo.org; Thu, 14 Apr 2011 01:55:20 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 46B401C002;
	Thu, 14 Apr 2011 01:55:13 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id F2BB11C002
	for <gentoo-commits@lists.gentoo.org>; Thu, 14 Apr 2011 01:55:12 +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 670FE654CD
	for <gentoo-commits@lists.gentoo.org>; Thu, 14 Apr 2011 01:55:12 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 841F980065
	for <gentoo-commits@lists.gentoo.org>; Thu, 14 Apr 2011 01:55: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: <505bd589ef19454119f6ed3e5d2440b562ff5ec2.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/repoman
X-VCS-Directories: bin/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 505bd589ef19454119f6ed3e5d2440b562ff5ec2
Date: Thu, 14 Apr 2011 01:55: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: 
X-Archives-Hash: 7cec45faa16bc9d465a8f17b03f704b3

commit:     505bd589ef19454119f6ed3e5d2440b562ff5ec2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 14 01:54:30 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Apr 14 01:54:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3D505bd589

repoman: cleanup gpgsign

---
 bin/repoman |   35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index 654943c..f3956d6 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -66,7 +66,8 @@ import portage.checksum
 import portage.const
 from portage import cvstree, normalize_path
 from portage import util
-from portage.exception import FileNotFound, ParseError, PermissionDenied
+from portage.exception import (FileNotFound, MissingParameter,
+	ParseError, PermissionDenied)
 from portage.manifest import Manifest
 from portage.process import find_binary, spawn
 from portage.output import bold, create_color_func, \
@@ -2419,22 +2420,32 @@ else:
=20
 	# Setup the GPG commands
 	def gpgsign(filename):
-		if "PORTAGE_GPG_KEY" not in repoman_settings and "${PORTAGE_GPG_KEY}" =
in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]:
-			raise portage.exception.MissingParameter("PORTAGE_GPG_KEY is unset!")
-		if "PORTAGE_GPG_DIR" not in repoman_settings and "${PORTAGE_GPG_DIR}" =
in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]:
-			repoman_settings["PORTAGE_GPG_DIR"] =3D os.path.expanduser("~/.gnupg"=
)
-			logging.info("Automatically setting PORTAGE_GPG_DIR to '%s'" % repoma=
n_settings["PORTAGE_GPG_DIR"])
-		if "${PORTAGE_GPG_DIR}" in repoman_settings["PORTAGE_GPG_SIGNING_COMMA=
ND"]:
-			repoman_settings["PORTAGE_GPG_DIR"] =3D os.path.expanduser(repoman_se=
ttings["PORTAGE_GPG_DIR"])
+		gpgcmd =3D repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
+		if gpgcmd is None:
+			raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!" + \
+				" Is make.globals missing?")
+		if "${PORTAGE_GPG_KEY}" in gpgcmd and \
+			"PORTAGE_GPG_KEY" not in repoman_settings:
+			raise MissingParameter("PORTAGE_GPG_KEY is unset!")
+		if "${PORTAGE_GPG_DIR}" in gpgcmd:
+			if "PORTAGE_GPG_DIR" not in repoman_settings:
+				repoman_settings["PORTAGE_GPG_DIR"] =3D \
+					os.path.expanduser("~/.gnupg")
+				logging.info("Automatically setting PORTAGE_GPG_DIR to '%s'" \
+					% repoman_settings["PORTAGE_GPG_DIR"])
+			else:
+				repoman_settings["PORTAGE_GPG_DIR"] =3D \
+					os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
 			if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
 				raise portage.exception.InvalidLocation(
 					"Unable to access directory: PORTAGE_GPG_DIR=3D'%s'" % \
 					repoman_settings["PORTAGE_GPG_DIR"])
 		gpgvars =3D {"FILE": filename}
-		for var in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
-			if "${%s}" % var in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]:
-				gpgvars[var] =3D repoman_settings[var]
-		gpgcmd =3D portage.util.varexpand(repoman_settings["PORTAGE_GPG_SIGNIN=
G_COMMAND"], mydict=3Dgpgvars)
+		for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
+			v =3D repoman_settings.get(k)
+			if v is not None:
+				gpgvars[k] =3D v
+		gpgcmd =3D portage.util.varexpand(gpgcmd, mydict=3Dgpgvars)
 		if options.pretend:
 			print("("+gpgcmd+")")
 		else: