Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-crypt/pius/files/, app-crypt/pius/
Date: Sun, 01 Nov 2020 08:19:41
Message-Id: 1604218699.18a61400006e1ce80ef444e462a26fdc079857a0.juippis@gentoo
1 commit: 18a61400006e1ce80ef444e462a26fdc079857a0
2 Author: Nicholas Meyer <nickaristocrates <AT> gmail <DOT> com>
3 AuthorDate: Sun Nov 1 07:35:59 2020 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 1 08:18:19 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18a61400
7
8 app-crypt/pius: pull in minor fixes from upstream
9
10 Closes: https://bugs.gentoo.org/752084
11 Signed-off-by: Nicholas Meyer <nickaristocrates <AT> gmail.com>
12 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
13
14 .../pius-3.0.0_fix_keyring_mgr_constants.diff | 40 ++++++++++++++
15 .../pius/files/pius-3.0.0_fix_pius_report.diff | 63 ++++++++++++++++++++++
16 .../pius/files/pius-3.0.0_fix_readme_typo.diff | 13 +++++
17 app-crypt/pius/files/pius-3.0.0_fix_typos.diff | 31 +++++++++++
18 .../{pius-3.0.0.ebuild => pius-3.0.0-r1.ebuild} | 7 +++
19 5 files changed, 154 insertions(+)
20
21 diff --git a/app-crypt/pius/files/pius-3.0.0_fix_keyring_mgr_constants.diff b/app-crypt/pius/files/pius-3.0.0_fix_keyring_mgr_constants.diff
22 new file mode 100644
23 index 00000000000..9871a51e6ed
24 --- /dev/null
25 +++ b/app-crypt/pius/files/pius-3.0.0_fix_keyring_mgr_constants.diff
26 @@ -0,0 +1,40 @@
27 +diff --git a/pius-keyring-mgr b/pius-keyring-mgr
28 +index 1daddeb..fb0b46a 100755
29 +--- a/pius-keyring-mgr
30 ++++ b/pius-keyring-mgr
31 +@@ -28,6 +28,8 @@ from libpius.constants import (
32 + GPG_BASE_OPTS,
33 + GPG_QUIET_OPTS,
34 + GPG_FD_OPTS,
35 ++ FP_RE,
36 ++ FIXFP_RE,
37 + )
38 +
39 + BADKEYS_RE = re.compile(r"00000000|12345678|no pgp key")
40 +@@ -143,10 +145,10 @@ class PiusParser:
41 + def parse_flatfile(self, filename):
42 + with open(filename, "r") as fd:
43 + contents = fd.read()
44 +- matches = self.FP_RE.findall(contents)
45 ++ matches = FP_RE.findall(contents)
46 + keys = []
47 + for match in matches:
48 +- flatfp = self.FIXFP_RE.sub("", match)
49 ++ flatfp = FIXFP_RE.sub("", match)
50 + keyid = flatfp[-8:]
51 + keys.append(
52 + {
53 +@@ -199,11 +201,11 @@ class PiusParser:
54 + tmp["key"] = match
55 + keys.append(tmp)
56 + continue
57 +- matches = self.FP_RE.findall(decoded)
58 ++ matches = FP_RE.findall(decoded)
59 + if matches:
60 + for match in matches:
61 + num_fps = num_fps + 1
62 +- fp = self.FIXFP_RE.sub("", match)
63 ++ fp = FIXFP_RE.sub("", match)
64 + keyid = keyid_from_fp(fp)
65 + tmp = data.copy()
66 + tmp.update({"fingerprint": fp, "keyid": keyid})
67
68 diff --git a/app-crypt/pius/files/pius-3.0.0_fix_pius_report.diff b/app-crypt/pius/files/pius-3.0.0_fix_pius_report.diff
69 new file mode 100644
70 index 00000000000..40bb969aab7
71 --- /dev/null
72 +++ b/app-crypt/pius/files/pius-3.0.0_fix_pius_report.diff
73 @@ -0,0 +1,63 @@
74 +diff --git a/libpius/mailer.py b/libpius/mailer.py
75 +index ba6b50a..f5b097f 100644
76 +--- a/libpius/mailer.py
77 ++++ b/libpius/mailer.py
78 +@@ -403,7 +403,7 @@ class PiusMailer:
79 + # BCC the user...
80 + env_to = [msg["To"], self.mail]
81 +
82 +- smtp.sendmail(self.mail, env_to, msg.as_string())
83 ++ smtp.sendmail(self.mail, env_to, msg.as_string().encode('utf-8'))
84 + smtp.quit()
85 + except smtplib.SMTPException as emsg:
86 + raise MailSendError(emsg)
87 +diff --git a/pius-keyring-mgr b/pius-keyring-mgr
88 +index fb0b46a..ec3528a 100755
89 +--- a/pius-keyring-mgr
90 ++++ b/pius-keyring-mgr
91 +@@ -1,4 +1,5 @@
92 + #!/usr/bin/env python3
93 ++
94 + """A utility to create and manage party keyrings."""
95 +
96 + # vim:tw=80:ai:tabstop=4:expandtab:shiftwidth=4
97 +@@ -446,7 +447,7 @@ class KeyringBuilder:
98 + # stolen from pius
99 + def get_all_keyids(self, sort_keyring):
100 + """Given a keyring, get all the KeyIDs from it."""
101 +- util.debug("extracting all keyids from keyring")
102 ++ util.debug("extracting all keyids from keyring, sort: %s" % sort_keyring)
103 + extra_opts = GPG_QUIET_OPTS + self.AUTO_OPTS + ["--fixed-list-mode"]
104 + cmd = self.basecmd + extra_opts + ["--fingerprint"]
105 + util.logcmd(cmd)
106 +@@ -776,6 +777,7 @@ before distributing they keyring.
107 + prune.add_option(
108 + "--no-sort-keyring",
109 + dest="sort_keyring",
110 ++ default=True,
111 + action="store_false",
112 + help="Do not sort the keyring by name.",
113 + )
114 +diff --git a/pius-report b/pius-report
115 +index 47f57b5..744da35 100755
116 +--- a/pius-report
117 ++++ b/pius-report
118 +@@ -15,7 +15,8 @@ from optparse import OptionParser
119 + from libpius import mailer as pmailer
120 + from libpius import signer as psigner
121 + from libpius.util import PiusUtil, MyOption
122 +-from libpius.constants import DEFAULT_GPG_PATH, UID_RE, GPG_MIN_OPTS
123 ++from libpius.constants import DEFAULT_GPG_PATH, UID_RE, GPG_MIN_OPTS, \
124 ++ GPG_BASE_OPTS
125 + from libpius.exceptions import MailSendError
126 + from libpius.state import SignState
127 +
128 +@@ -401,7 +402,7 @@ Generated by PIUS Report BETA (http://www.phildev.net/pius/).
129 +
130 + def refresh_keys(gpg, keys):
131 + cmd = [gpg] + GPG_MIN_OPTS + ["--refresh-keys"] + keys
132 +- PiusPiusUtil.logcmd(cmd)
133 ++ PiusUtil.logcmd(cmd)
134 + gpg = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
135 + gpg.wait()
136 +
137
138 diff --git a/app-crypt/pius/files/pius-3.0.0_fix_readme_typo.diff b/app-crypt/pius/files/pius-3.0.0_fix_readme_typo.diff
139 new file mode 100644
140 index 00000000000..c51880aed3b
141 --- /dev/null
142 +++ b/app-crypt/pius/files/pius-3.0.0_fix_readme_typo.diff
143 @@ -0,0 +1,13 @@
144 +diff --git a/README.md b/README.md
145 +index 3ead858..4cb98ce 100644
146 +--- a/README.md
147 ++++ b/README.md
148 +@@ -91,7 +91,7 @@ docs](https://support.google.com/accounts/answer/185833?hl=en).
149 + ## Other Platforms
150 +
151 + On non-UNIX platforms such as MacOS and Windows, the default gpg path will
152 +-likley be incorrect, so you'll want to use `-b` to specify the path.
153 ++likely be incorrect, so you'll want to use `-b` to specify the path.
154 +
155 +
156 + ## Config File
157
158 diff --git a/app-crypt/pius/files/pius-3.0.0_fix_typos.diff b/app-crypt/pius/files/pius-3.0.0_fix_typos.diff
159 new file mode 100644
160 index 00000000000..1620d02b8e0
161 --- /dev/null
162 +++ b/app-crypt/pius/files/pius-3.0.0_fix_typos.diff
163 @@ -0,0 +1,31 @@
164 +diff --git a/pius b/pius
165 +index 7cf09b5..cc2333b 100755
166 +--- a/pius
167 ++++ b/pius
168 +@@ -25,7 +25,7 @@ from optparse import OptionParser
169 +
170 + from libpius import mailer as pmailer
171 + from libpius import signer as psigner
172 +-from libpius.util import PiusUtil, MyOption
173 ++from libpius.util import PiusUtil, MyOption, check_email
174 + from libpius.constants import (
175 + DEFAULT_GPG_PATH,
176 + DEFAULT_KEYRING,
177 +@@ -61,7 +61,7 @@ def check_options(parser, options, args):
178 +
179 + if options.debug == True:
180 + print("Setting debug")
181 +- util.DEBUG_ON = True
182 ++ PiusUtil.DEBUG_ON = True
183 +
184 + if not os.path.exists(options.gpg_path):
185 + parser.error("GnuPG binary not found at %s." % options.gpg_path)
186 +@@ -288,7 +288,7 @@ def main():
187 + )
188 + if ans in ("y", "Y", "yes", "YES", "Yes"):
189 + ans = input("What email address should we send from? ")
190 +- util.check_email(parser, "-m", ans)
191 ++ check_email(parser, "-m", ans)
192 + options.mail = ans
193 + print()
194 +
195
196 diff --git a/app-crypt/pius/pius-3.0.0.ebuild b/app-crypt/pius/pius-3.0.0-r1.ebuild
197 similarity index 77%
198 rename from app-crypt/pius/pius-3.0.0.ebuild
199 rename to app-crypt/pius/pius-3.0.0-r1.ebuild
200 index f7f3745afd4..105bf866e5e 100644
201 --- a/app-crypt/pius/pius-3.0.0.ebuild
202 +++ b/app-crypt/pius/pius-3.0.0-r1.ebuild
203 @@ -22,6 +22,13 @@ DEPEND=">=app-crypt/gnupg-2.0.0"
204 RDEPEND="${DEPEND}
205 dev-lang/perl"
206
207 +PATCHES=(
208 + "${FILESDIR}/${P}_fix_typos.diff"
209 + "${FILESDIR}/${P}_fix_keyring_mgr_constants.diff"
210 + "${FILESDIR}/${P}_fix_readme_typo.diff"
211 + "${FILESDIR}/${P}_fix_pius_report.diff"
212 +)
213 +
214 python_test() {
215 ${EPYTHON} -m unittest discover -s test/* -v || die
216 }