diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org> | 2011-04-03 19:28:58 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-04-13 00:49:30 -0700 |
commit | 48e4cad5e8b49cd58558cc8332cbe38c0c2c760f (patch) | |
tree | 7aeb677506615469e27efeda19d4aadb5549fd8a /bin | |
parent | b3d2ac7510e82a0d21ba7aa99d067f4829ef6ecf (diff) | |
download | portage-48e4cad5e8b49cd58558cc8332cbe38c0c2c760f.tar.gz portage-48e4cad5e8b49cd58558cc8332cbe38c0c2c760f.tar.bz2 portage-48e4cad5e8b49cd58558cc8332cbe38c0c2c760f.zip |
Support PORTAGE_GPG_SIGNING_COMMAND variable.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/repoman | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/repoman b/bin/repoman index 0c6f6552a..56c4bf7df 100755 --- a/bin/repoman +++ b/bin/repoman @@ -2418,23 +2418,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: |