Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-filter/spamassassin/files/, mail-filter/spamassassin/
Date: Sat, 02 Mar 2019 05:01:48
Message-Id: 1551502836.5225641c114c95e5524d3794af84170ded43aada.mjo@gentoo
1 commit: 5225641c114c95e5524d3794af84170ded43aada
2 Author: Marcin Mirosław <bug <AT> mejor <DOT> pl>
3 AuthorDate: Mon Feb 18 12:09:48 2019 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Sat Mar 2 05:00:36 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5225641c
7
8 mail-filter/spamassassin: restore support for paths in rules mirror URL's
9
10 sa-update couldn't fetch rules from mirror if files were in paths
11
12 Bug: https://bugs.gentoo.org/677250
13 Bug: https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7623
14 Signed-off-by: Marcin Mirosław <bug <AT> mejor.pl>
15 Package-Manager: Portage-2.3.51, Repoman-2.3.11
16 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
17
18 .../files/spamassassin-3.4.2-bug_7623_p1.patch | 13 +
19 .../files/spamassassin-3.4.2-bug_7623_p2.patch | 15 ++
20 .../spamassassin/spamassassin-3.4.2-r5.ebuild | 286 +++++++++++++++++++++
21 3 files changed, 314 insertions(+)
22
23 diff --git a/mail-filter/spamassassin/files/spamassassin-3.4.2-bug_7623_p1.patch b/mail-filter/spamassassin/files/spamassassin-3.4.2-bug_7623_p1.patch
24 new file mode 100644
25 index 00000000000..d0fe21bf9ef
26 --- /dev/null
27 +++ b/mail-filter/spamassassin/files/spamassassin-3.4.2-bug_7623_p1.patch
28 @@ -0,0 +1,13 @@
29 +Bug: https://bugs.gentoo.org/677250
30 +Bug: https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7623
31 +
32 +--- a/sa-update.raw 2018/09/29 09:33:52 1842302
33 ++++ b/sa-update.raw 2018/09/29 09:41:24 1842303
34 +@@ -1659,6 +1659,7 @@
35 + my($a_rr, $aaaa_rr);
36 + # RFC 3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
37 + $mirror =~ s{^[a-z][a-z0-9.+-]*://}{}si; # strip scheme like http://
38 ++ $mirror =~ s{[:/].*}{}s; # strip all starting from :port or /path
39 + return 1 if $have_inet4 && do_dns_query($mirror, "A");
40 + return 1 if $have_inet6 && do_dns_query($mirror, "AAAA");
41 + return 0;
42
43 diff --git a/mail-filter/spamassassin/files/spamassassin-3.4.2-bug_7623_p2.patch b/mail-filter/spamassassin/files/spamassassin-3.4.2-bug_7623_p2.patch
44 new file mode 100644
45 index 00000000000..26d921a6e67
46 --- /dev/null
47 +++ b/mail-filter/spamassassin/files/spamassassin-3.4.2-bug_7623_p2.patch
48 @@ -0,0 +1,15 @@
49 +Bug: https://bugs.gentoo.org/677250
50 +Bug: https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7623
51 +
52 +--- a/sa-update.raw 2018/09/29 10:16:29 1842320
53 ++++ b/sa-update.raw 2018/09/29 10:20:26 1842321
54 +@@ -1659,6 +1659,9 @@
55 + my($a_rr, $aaaa_rr);
56 + # RFC 3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
57 + $mirror =~ s{^[a-z][a-z0-9.+-]*://}{}si; # strip scheme like http://
58 ++ # No DNS check needed for IPv4 or IPv6 address literal
59 ++ return 1 if $mirror =~ m{^\d+\.\d+\.\d+\.\d+(?:[:/]|$)};
60 ++ return 1 if $mirror =~ m{^\[};
61 + $mirror =~ s{[:/].*}{}s; # strip all starting from :port or /path
62 + return 1 if $have_inet4 && do_dns_query($mirror, "A");
63 + return 1 if $have_inet6 && do_dns_query($mirror, "AAAA");
64
65 diff --git a/mail-filter/spamassassin/spamassassin-3.4.2-r5.ebuild b/mail-filter/spamassassin/spamassassin-3.4.2-r5.ebuild
66 new file mode 100644
67 index 00000000000..2162b9ce2b6
68 --- /dev/null
69 +++ b/mail-filter/spamassassin/spamassassin-3.4.2-r5.ebuild
70 @@ -0,0 +1,286 @@
71 +# Copyright 1999-2019 Gentoo Authors
72 +# Distributed under the terms of the GNU General Public License v2
73 +
74 +EAPI=6
75 +
76 +inherit perl-functions systemd toolchain-funcs user eapi7-ver
77 +
78 +MY_P="Mail-SpamAssassin-${PV//_/-}"
79 +S="${WORKDIR}/${MY_P}"
80 +DESCRIPTION="An extensible mail filter which can identify and tag spam"
81 +HOMEPAGE="https://spamassassin.apache.org/"
82 +SRC_URI="mirror://apache/spamassassin/source/${MY_P}.tar.bz2"
83 +
84 +LICENSE="Apache-2.0 GPL-2"
85 +SLOT="0"
86 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
87 +IUSE="berkdb cron ipv6 ldap libressl mysql postgres qmail sqlite ssl test"
88 +
89 +# The Makefile.PL script checks for dependencies, but only fails if a
90 +# required (i.e. not optional) dependency is missing. We therefore
91 +# require most of the optional modules only at runtime.
92 +REQDEPEND="dev-lang/perl:=
93 + dev-perl/HTML-Parser
94 + dev-perl/Net-DNS
95 + dev-perl/NetAddr-IP
96 + virtual/perl-Archive-Tar
97 + virtual/perl-Digest-SHA
98 + virtual/perl-IO-Zlib
99 + virtual/perl-Time-HiRes
100 + ssl? (
101 + !libressl? ( dev-libs/openssl:0= )
102 + libressl? ( dev-libs/libressl )
103 + )"
104 +
105 +# SpamAssassin doesn't use libwww-perl except as a fallback for when
106 +# curl/wget are missing, so we depend on one of those instead. Some
107 +# mirrors use https, so we need those utilities to support SSL.
108 +#
109 +# re2c is needed to compile the rules (sa-compile).
110 +#
111 +# We still need the old Digest-SHA1 because razor2 has not been ported
112 +# to Digest-SHA.
113 +OPTDEPEND="app-crypt/gnupg
114 + dev-perl/BSD-Resource
115 + dev-perl/Digest-SHA1
116 + dev-perl/Encode-Detect
117 + dev-perl/Geo-IP
118 + dev-perl/HTTP-Date
119 + dev-perl/Mail-DKIM
120 + dev-perl/Mail-SPF
121 + dev-perl/Net-Patricia
122 + dev-perl/Net-CIDR-Lite
123 + dev-util/re2c
124 + || ( net-misc/wget[ssl] net-misc/curl[ssl] )
125 + virtual/perl-MIME-Base64
126 + virtual/perl-Pod-Parser
127 + berkdb? ( virtual/perl-DB_File )
128 + ipv6? ( dev-perl/IO-Socket-INET6 )
129 + ldap? ( dev-perl/perl-ldap )
130 + mysql? (
131 + dev-perl/DBI
132 + dev-perl/DBD-mysql
133 + )
134 + postgres? (
135 + dev-perl/DBI
136 + dev-perl/DBD-Pg
137 + )
138 + sqlite? (
139 + dev-perl/DBI
140 + dev-perl/DBD-SQLite
141 + )
142 + ssl? ( dev-perl/IO-Socket-SSL )"
143 +
144 +DEPEND="${REQDEPEND}
145 + test? (
146 + ${OPTDEPEND}
147 + virtual/perl-Test-Harness
148 + )"
149 +RDEPEND="${REQDEPEND} ${OPTDEPEND}"
150 +
151 +PATCHES=(
152 + "${FILESDIR}/spamassassin-3.4.2-bug_7631.patch"
153 + "${FILESDIR}/spamassassin-3.4.2-bug_7632.patch"
154 + "${FILESDIR}/spamassassin-3.4.2-bug_7623_p1.patch"
155 + "${FILESDIR}/spamassassin-3.4.2-bug_7623_p2.patch"
156 +)
157 +
158 +src_prepare() {
159 + default
160 +
161 + # The sa_compile test does some weird stuff like hopping around in
162 + # the directory tree and calling "make" to create a dist tarball
163 + # from ${S}. It fails, and is more trouble than it's worth...
164 + perl_rm_files t/sa_compile.t || die 'failed to remove sa_compile test'
165 +
166 + # The spamc tests (which need the networked spamd daemon) fail for
167 + # irrelevant reasons. It's too hard to disable them (unlike the
168 + # spamd tests themselves -- see src_test), so use a crude
169 + # workaround.
170 + perl_rm_files t/spamc_*.t || die 'failed to remove spamc tests'
171 +
172 + # Upstream bug 7622: this thing needs network access but doesn't
173 + # respect the 'run_net_tests' setting.
174 + perl_rm_files t/urilocalbl_geoip.t \
175 + || die 'failed to remove urilocalbl_geoip tests'
176 +}
177 +
178 +src_configure() {
179 + # This is how and where the perl-module eclass disables the
180 + # MakeMaker interactive prompt.
181 + export PERL_MM_USE_DEFAULT=1
182 +
183 + # Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again
184 + # (just to be sure, nobody knows how it could happen in the first place).
185 + #
186 + # We also set the path to the perl executable explictly. This will be
187 + # used to create the initial shebang line in the scripts (bug 62276).
188 + perl Makefile.PL \
189 + PREFIX="${EPREFIX}/usr" \
190 + INSTALLDIRS=vendor \
191 + SYSCONFDIR="${EPREFIX}/etc" \
192 + DATADIR="${EPREFIX}/usr/share/spamassassin" \
193 + PERL_BIN="${EPREFIX}/usr/bin/perl" \
194 + ENABLE_SSL="$(usex ssl)" \
195 + DESTDIR="${D}" \
196 + || die 'failed to create a Makefile using Makefile.PL'
197 +
198 + # Now configure spamc.
199 + emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" spamc/Makefile
200 +}
201 +
202 +src_compile() {
203 + emake
204 + use qmail && emake spamc/qmail-spamc
205 +}
206 +
207 +src_install () {
208 + emake install
209 + einstalldocs
210 +
211 + # Create the stub dir used by sa-update and friends
212 + keepdir /var/lib/spamassassin
213 +
214 + # Move spamd to sbin where it belongs.
215 + dodir /usr/sbin
216 + mv "${ED}"/usr/bin/spamd "${ED}"/usr/sbin/spamd || die "move spamd failed"
217 +
218 + if use qmail; then
219 + dobin spamc/qmail-spamc
220 + fi
221 +
222 + dosym mail/spamassassin /etc/spamassassin
223 +
224 + # Disable plugin by default
225 + sed -i -e 's/^loadplugin/\#loadplugin/g' \
226 + "${ED}/etc/mail/spamassassin/init.pre" \
227 + || die "failed to disable plugins by default"
228 +
229 + # Add the init and config scripts.
230 + newinitd "${FILESDIR}/3.4.1-spamd.init-r3" spamd
231 + newconfd "${FILESDIR}/3.4.1-spamd.conf-r1" spamd
232 +
233 + systemd_newunit "${FILESDIR}/${PN}.service-r4" "${PN}.service"
234 + systemd_install_serviced "${FILESDIR}/${PN}.service.conf-r2" \
235 + "${PN}.service"
236 +
237 + use postgres && dodoc sql/*_pg.sql
238 + use mysql && dodoc sql/*_mysql.sql
239 +
240 + dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
241 + sql/README.awl procmailrc.example sample-nonspam.txt \
242 + sample-spam.txt spamd/PROTOCOL spamd/README.vpopmail \
243 + spamd-apache2/README.apache
244 +
245 + # Rename some files so that they don't clash with others.
246 + newdoc spamd/README README.spamd
247 + newdoc sql/README README.sql
248 + newdoc ldap/README README.ldap
249 +
250 + if use qmail; then
251 + dodoc spamc/README.qmail
252 + fi
253 +
254 + insinto /etc/mail/spamassassin/
255 + insopts -m0400
256 + newins "${FILESDIR}"/secrets.cf secrets.cf.example
257 +
258 + # Create the directory where sa-update stores its GPG key (if you
259 + # choose to import one). If this directory does not exist, the
260 + # import will fail. This is bug 396307. We expect that the import
261 + # will be performed as root, and making the directory accessible
262 + # only to root prevents a warning on the command-line.
263 + diropts -m0700
264 + dodir /etc/mail/spamassassin/sa-update-keys
265 +
266 + if use cron; then
267 + # Install the cron job if they want it.
268 + exeinto /etc/cron.daily
269 + newexe "${FILESDIR}/update-spamassassin-rules.cron" \
270 + update-spamassassin-rules
271 + fi
272 +
273 + # Remove perllocal.pod to avoid file collisions (bug #603338).
274 + perl_delete_localpod || die "failed to remove perllocal.pod"
275 +
276 + # The perl-module eclass calls three other functions to clean
277 + # up in src_install. The first fixes references to ${D} in the
278 + # packlist, and is useful to us, too. The other two functions,
279 + # perl_delete_emptybsdir and perl_remove_temppath, don't seem
280 + # to be needed: there are no empty directories, *.bs files, or
281 + # ${D} paths remaining in our installed image.
282 + perl_fix_packlist || die "failed to fix paths in packlist"
283 +}
284 +
285 +src_test() {
286 + # Trick the test suite into skipping the spamd tests. Setting
287 + # SPAMD_HOST to a non-localhost value causes SKIP_SPAMD_TESTS to be
288 + # set in SATest.pm.
289 + export SPAMD_HOST=disabled
290 + default
291 +}
292 +
293 +pkg_preinst() {
294 + # The spamd daemon runs as this user. Use a real home directory so
295 + # that it can hold SA configuration.
296 + enewuser spamd -1 -1 /home/spamd
297 +
298 + if use mysql || use postgres ; then
299 + local _awlwarn=0
300 + local _v
301 + for _v in ${REPLACING_VERSIONS}; do
302 + if ! ver_test "${_v}" -gt "3.4.2-r3"; then
303 + _awlwarn=1
304 + fi
305 + done
306 + if [[ ${_awlwarn} == 1 ]] ; then
307 + ewarn 'If you used AWL before 3.4.2, the SQL schema has changed.'
308 + ewarn 'You will need to manually ALTER your tables for them to'
309 + ewarn 'continue working. See the UPGRADE documentation for'
310 + ewarn 'details.'
311 + ewarn
312 + fi
313 + fi
314 +}
315 +
316 +pkg_postinst() {
317 + elog
318 + elog 'No rules are installed by default. You will need to run sa-update'
319 + elog 'at least once, and most likely configure SpamAssassin before it'
320 + elog 'will work.'
321 +
322 + if ! use cron; then
323 + elog
324 + elog 'You should consider a cron job for sa-update. One is provided'
325 + elog 'for daily updates if you enable the "cron" USE flag.'
326 + fi
327 + elog
328 + elog 'Configuration and update help can be found on the wiki:'
329 + elog
330 + elog ' https://wiki.gentoo.org/wiki/SpamAssassin'
331 + elog
332 +
333 + if use mysql || use postgres ; then
334 + local _v
335 + for _v in ${REPLACING_VERSIONS}; do
336 + if ver_test "${_v}" -lt "3.4.2-r3"; then
337 + ewarn
338 + ewarn 'If you used AWL before 3.4.2, the SQL schema has changed.'
339 + ewarn 'You will need to manually ALTER your tables for them to'
340 + ewarn 'continue working. See the UPGRADE documentation for'
341 + ewarn 'details.'
342 + ewarn
343 +
344 + # show this only once
345 + break
346 + fi
347 + done
348 + fi
349 +
350 + ewarn 'If this version of SpamAssassin causes permissions issues'
351 + ewarn 'with your user configurations or bayes databases, then you'
352 + ewarn 'may need to set SPAMD_RUN_AS_ROOT=true in your OpenRC service'
353 + ewarn 'configuration file, or remove the --username and --groupname'
354 + ewarn 'flags from the SPAMD_OPTS variable in your systemd service'
355 + ewarn 'configuration file.'
356 +}