Support PORTAGE_GPG_SIGNING_COMMAND variable.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sun, 3 Apr 2011 17:28:58 +0000 (19:28 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 13 Apr 2011 07:49:30 +0000 (00:49 -0700)
bin/repoman
cnf/make.globals
man/make.conf.5

index 0c6f6552ad771e27199f316098e1806d5d80ecd9..56c4bf7dfaf4298cf992ad37bcfe5cbd64848686 100755 (executable)
@@ -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:
index 89c81f544102939fc2c04608cdfb1efcd3e6bf43..975b6b38b0ee1cdd5b58f39706e882d1fcb2f944 100644 (file)
@@ -123,6 +123,9 @@ PORTAGE_ELOG_MAILURI="root"
 PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}"
 PORTAGE_ELOG_MAILFROM="portage@localhost"
 
+# Signing command used by repoman
+PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --clearsign --yes --default-key \"\${PORTAGE_GPG_KEY}\" --homedir \"\${PORTAGE_GPG_DIR}\" \"\${FILE}\""
+
 #            *****************************
 #            **  DO NOT EDIT THIS FILE  **
 # ***************************************************
index 6a1fdd357d17e3365d564484f787fb582cd7f107..a99d537d068a860538124bd345f5d8e6c327ae2c 100644 (file)
@@ -666,6 +666,10 @@ Defaults to $HOME/.gnupg.
 The \fBgpg\fR(1) key used by \fBrepoman\fR(1) to sign manifests
 when \fBsign\fR is in \fBFEATURES\fR.
 .TP
+.B PORTAGE_GPG_SIGNING_COMMAND
+The command used by \fBrepoman\fR(1) to sign manifests when \fBsign\fR is
+in \fBFEATURES\fR.
+.TP
 \fBPORTAGE_IONICE_COMMAND\fR = \fI[ionice command string]\fR
 This variable should contain a command for portage to call in order
 to adjust the io priority of portage and it's subprocesses. The command