aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>2011-04-03 19:28:58 +0200
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>2011-04-03 19:28:58 +0200
commitee4f544d839722c92e83ff96f5c3c38749b3af8e (patch)
treed3e0d8b20b5b95004745cc218e4ba63f402a1981 /bin
parentDisplay: fix fetch restrict msg for RO_DISTDIRS (diff)
downloadportage-ee4f544d839722c92e83ff96f5c3c38749b3af8e.tar.gz
portage-ee4f544d839722c92e83ff96f5c3c38749b3af8e.tar.bz2
portage-ee4f544d839722c92e83ff96f5c3c38749b3af8e.zip
Support PORTAGE_GPG_SIGNING_COMMAND variable.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/repoman27
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/repoman b/bin/repoman
index 8f363722d..946275319 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -2419,23 +2419,26 @@ else:
# Setup the GPG commands
def gpgsign(filename):
- if "PORTAGE_GPG_KEY" not in repoman_settings:
+ 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:
+ if "PORTAGE_GPG_DIR" not in repoman_settings and "${PORTAGE_GPG_DIR}" in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]:
repoman_settings["PORTAGE_GPG_DIR"] = os.path.expanduser("~/.gnupg")
logging.info("Automatically setting PORTAGE_GPG_DIR to '%s'" % repoman_settings["PORTAGE_GPG_DIR"])
- repoman_settings["PORTAGE_GPG_DIR"] = 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='%s'" % \
- repoman_settings["PORTAGE_GPG_DIR"])
- gpgcmd = "gpg --sign --clearsign --yes"
- gpgcmd += " --default-key " + repoman_settings["PORTAGE_GPG_KEY"]
- gpgcmd += " --homedir " + repoman_settings["PORTAGE_GPG_DIR"]
+ if "${PORTAGE_GPG_DIR}" in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]:
+ repoman_settings["PORTAGE_GPG_DIR"] = 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='%s'" % \
+ repoman_settings["PORTAGE_GPG_DIR"])
+ gpgvars = {"FILE": filename}
+ for var in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
+ if "${%s}" % var in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]:
+ gpgvars[var] = repoman_settings[var]
+ gpgcmd = portage.util.varexpand(repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"], mydict=gpgvars)
if options.pretend:
- print("("+gpgcmd+" "+filename+")")
+ print("("+gpgcmd+")")
else:
- rValue = os.system(gpgcmd+" "+filename)
+ rValue = os.system(gpgcmd)
if rValue == os.EX_OK:
os.rename(filename+".asc", filename)
else: