1 |
commit: ee4f544d839722c92e83ff96f5c3c38749b3af8e |
2 |
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org> |
3 |
AuthorDate: Sun Apr 3 17:28:58 2011 +0000 |
4 |
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 3 17:28:58 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ee4f544d |
7 |
|
8 |
Support PORTAGE_GPG_SIGNING_COMMAND variable. |
9 |
|
10 |
--- |
11 |
bin/repoman | 27 +++++++++++++++------------ |
12 |
cnf/make.globals | 3 +++ |
13 |
man/make.conf.5 | 4 ++++ |
14 |
3 files changed, 22 insertions(+), 12 deletions(-) |
15 |
|
16 |
diff --git a/bin/repoman b/bin/repoman |
17 |
index 8f36372..9462753 100755 |
18 |
--- a/bin/repoman |
19 |
+++ b/bin/repoman |
20 |
@@ -2419,23 +2419,26 @@ else: |
21 |
|
22 |
# Setup the GPG commands |
23 |
def gpgsign(filename): |
24 |
- if "PORTAGE_GPG_KEY" not in repoman_settings: |
25 |
+ if "PORTAGE_GPG_KEY" not in repoman_settings and "${PORTAGE_GPG_KEY}" in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]: |
26 |
raise portage.exception.MissingParameter("PORTAGE_GPG_KEY is unset!") |
27 |
- if "PORTAGE_GPG_DIR" not in repoman_settings: |
28 |
+ if "PORTAGE_GPG_DIR" not in repoman_settings and "${PORTAGE_GPG_DIR}" in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]: |
29 |
repoman_settings["PORTAGE_GPG_DIR"] = os.path.expanduser("~/.gnupg") |
30 |
logging.info("Automatically setting PORTAGE_GPG_DIR to '%s'" % repoman_settings["PORTAGE_GPG_DIR"]) |
31 |
- repoman_settings["PORTAGE_GPG_DIR"] = os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"]) |
32 |
- if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK): |
33 |
- raise portage.exception.InvalidLocation( |
34 |
- "Unable to access directory: PORTAGE_GPG_DIR='%s'" % \ |
35 |
- repoman_settings["PORTAGE_GPG_DIR"]) |
36 |
- gpgcmd = "gpg --sign --clearsign --yes" |
37 |
- gpgcmd += " --default-key " + repoman_settings["PORTAGE_GPG_KEY"] |
38 |
- gpgcmd += " --homedir " + repoman_settings["PORTAGE_GPG_DIR"] |
39 |
+ if "${PORTAGE_GPG_DIR}" in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]: |
40 |
+ repoman_settings["PORTAGE_GPG_DIR"] = os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"]) |
41 |
+ if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK): |
42 |
+ raise portage.exception.InvalidLocation( |
43 |
+ "Unable to access directory: PORTAGE_GPG_DIR='%s'" % \ |
44 |
+ repoman_settings["PORTAGE_GPG_DIR"]) |
45 |
+ gpgvars = {"FILE": filename} |
46 |
+ for var in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"): |
47 |
+ if "${%s}" % var in repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"]: |
48 |
+ gpgvars[var] = repoman_settings[var] |
49 |
+ gpgcmd = portage.util.varexpand(repoman_settings["PORTAGE_GPG_SIGNING_COMMAND"], mydict=gpgvars) |
50 |
if options.pretend: |
51 |
- print("("+gpgcmd+" "+filename+")") |
52 |
+ print("("+gpgcmd+")") |
53 |
else: |
54 |
- rValue = os.system(gpgcmd+" "+filename) |
55 |
+ rValue = os.system(gpgcmd) |
56 |
if rValue == os.EX_OK: |
57 |
os.rename(filename+".asc", filename) |
58 |
else: |
59 |
|
60 |
diff --git a/cnf/make.globals b/cnf/make.globals |
61 |
index 542d6aa..95afb56 100644 |
62 |
--- a/cnf/make.globals |
63 |
+++ b/cnf/make.globals |
64 |
@@ -123,6 +123,9 @@ PORTAGE_ELOG_MAILURI="root" |
65 |
PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}" |
66 |
PORTAGE_ELOG_MAILFROM="portage@localhost" |
67 |
|
68 |
+# Signing command used by repoman |
69 |
+PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --clearsign --yes --default-key \"\${PORTAGE_GPG_KEY}\" --homedir \"\${PORTAGE_GPG_DIR}\" \"\${FILE}\"" |
70 |
+ |
71 |
# ***************************** |
72 |
# ** DO NOT EDIT THIS FILE ** |
73 |
# *************************************************** |
74 |
|
75 |
diff --git a/man/make.conf.5 b/man/make.conf.5 |
76 |
index eca82c9..a86f257 100644 |
77 |
--- a/man/make.conf.5 |
78 |
+++ b/man/make.conf.5 |
79 |
@@ -670,6 +670,10 @@ Defaults to $HOME/.gnupg. |
80 |
The \fBgpg\fR(1) key used by \fBrepoman\fR(1) to sign manifests |
81 |
when \fBsign\fR is in \fBFEATURES\fR. |
82 |
.TP |
83 |
+.B PORTAGE_GPG_SIGNING_COMMAND |
84 |
+The command used by \fBrepoman\fR(1) to sign manifests when \fBsign\fR is |
85 |
+in \fBFEATURES\fR. |
86 |
+.TP |
87 |
\fBPORTAGE_IONICE_COMMAND\fR = \fI[ionice command string]\fR |
88 |
This variable should contain a command for portage to call in order |
89 |
to adjust the io priority of portage and it's subprocesses. The command |