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/, mail-filter/spamassassin/files/
Date: Tue, 05 Dec 2017 18:48:11
Message-Id: 1512499562.c01a2a0ed33b456d068b436b5d9e185f936455f9.mjo@gentoo
1 commit: c01a2a0ed33b456d068b436b5d9e185f936455f9
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 5 18:25:11 2017 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 5 18:46:02 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c01a2a0e
7
8 mail-filter/spamassassin: fix "postgres" -> "postgresql" in init script.
9
10 In commit 5248063, I accidentally changed the name of the PostgreSQL
11 dependency in the OpenRC service script from "postgresql" (correct) to
12 "postgres" (not so much). This commit changes it back to the correct
13 name in a new revision. Thanks to Aaron W. Swenson for noticing the
14 mistake.
15
16 Closes: https://bugs.gentoo.org/639916
17 Package-Manager: Portage-2.3.13, Repoman-2.3.3
18
19 mail-filter/spamassassin/Manifest | 2 +-
20 mail-filter/spamassassin/files/3.4.1-spamd.init-r3 | 38 ++++
21 .../spamassassin/spamassassin-3.4.1-r20.ebuild | 251 +++++++++++++++++++++
22 3 files changed, 290 insertions(+), 1 deletion(-)
23
24 diff --git a/mail-filter/spamassassin/Manifest b/mail-filter/spamassassin/Manifest
25 index 24589b7b03b..d2d417e002f 100644
26 --- a/mail-filter/spamassassin/Manifest
27 +++ b/mail-filter/spamassassin/Manifest
28 @@ -1 +1 @@
29 -DIST Mail-SpamAssassin-3.4.1.tar.bz2 2710985 SHA256 a0c1c9808f0684b389594eb8b2ccbace6486546593493f9308c9554563d14651 SHA512 91d50e2ce6520e3e1c7bc66da133a0815be34ced15e26b6e6c17af5a03d5c62f41d8086f25f65084d6634497148cf5439977d7d4a44d7c3e307535beac6629af WHIRLPOOL 1465fcbc0456c9a671087d395c2a9998e3852a47153a0f6770158a2a311196490274c620aab89e2a6ff163defa72b8e785032f9450e7903df355544d957e8908
30 +DIST Mail-SpamAssassin-3.4.1.tar.bz2 2710985 BLAKE2B f85b0ed2bae783bc6dfa39df36589a6cb90e6c657efcff1fa094f952847e4bcb24aa232b6689804bb1170204ae1d33216ed9bde207d7a7a6863410d8f847c391 SHA512 91d50e2ce6520e3e1c7bc66da133a0815be34ced15e26b6e6c17af5a03d5c62f41d8086f25f65084d6634497148cf5439977d7d4a44d7c3e307535beac6629af
31
32 diff --git a/mail-filter/spamassassin/files/3.4.1-spamd.init-r3 b/mail-filter/spamassassin/files/3.4.1-spamd.init-r3
33 new file mode 100644
34 index 00000000000..0133d793625
35 --- /dev/null
36 +++ b/mail-filter/spamassassin/files/3.4.1-spamd.init-r3
37 @@ -0,0 +1,38 @@
38 +#!/sbin/openrc-run
39 +# Copyright 1999-2017 Gentoo Foundation
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +command="/usr/sbin/spamd"
43 +pidfile="/run/spamd.pid"
44 +command_args="--pidfile=${pidfile} ${SPAMD_OPTS}"
45 +command_args_background="--daemonize"
46 +
47 +if ! [ "${SPAMD_RUN_AS_ROOT}" = "true" ]; then
48 + # Passing --username=root to spamd kills it, so if SPAMD_RUN_AS_ROOT
49 + # is true, then we want to pass no user/group command args at all.
50 + # Any value other than "true" gets the default user/group of "spamd".
51 + command_args="${command_args} --username=spamd --groupname=spamd"
52 +fi
53 +
54 +: ${SPAMD_NICELEVEL:=0}
55 +start_stop_daemon_args="--nicelevel ${SPAMD_NICELEVEL}"
56 +
57 +# Retry after SPAMD_TIMEOUT seconds because spamd can take a
58 +# while to kill off all of its children. This was bug 322025.
59 +: ${SPAMD_TIMEOUT:=15}
60 +retry="${SPAMD_TIMEOUT}"
61 +
62 +extra_started_commands="reload"
63 +
64 +depend() {
65 + before mta
66 + use logger mysql postgresql
67 +}
68 +
69 +reload() {
70 + ebegin "Reloading configuration"
71 + # Warning: reload causes the PID of the spamd process to
72 + # change, but spamd does update its PID file afterwards.
73 + start-stop-daemon --signal HUP --pidfile "${pidfile}"
74 + eend $?
75 +}
76
77 diff --git a/mail-filter/spamassassin/spamassassin-3.4.1-r20.ebuild b/mail-filter/spamassassin/spamassassin-3.4.1-r20.ebuild
78 new file mode 100644
79 index 00000000000..18b2b73452a
80 --- /dev/null
81 +++ b/mail-filter/spamassassin/spamassassin-3.4.1-r20.ebuild
82 @@ -0,0 +1,251 @@
83 +# Copyright 1999-2017 Gentoo Foundation
84 +# Distributed under the terms of the GNU General Public License v2
85 +
86 +EAPI=6
87 +
88 +inherit perl-functions systemd toolchain-funcs user
89 +
90 +MY_P="Mail-SpamAssassin-${PV//_/-}"
91 +S="${WORKDIR}/${MY_P}"
92 +DESCRIPTION="An extensible mail filter which can identify and tag spam"
93 +HOMEPAGE="https://spamassassin.apache.org/"
94 +SRC_URI="mirror://apache/spamassassin/source/${MY_P}.tar.bz2"
95 +
96 +LICENSE="Apache-2.0 GPL-2"
97 +SLOT="0"
98 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
99 +IUSE="berkdb cron ipv6 ldap libressl mysql postgres qmail sqlite ssl test"
100 +
101 +# The Makefile.PL script checks for dependencies, but only fails if a
102 +# required (i.e. not optional) dependency is missing. We therefore
103 +# require most of the optional modules only at runtime.
104 +REQDEPEND="dev-lang/perl:=
105 + dev-perl/HTML-Parser
106 + dev-perl/Net-DNS
107 + dev-perl/NetAddr-IP
108 + virtual/perl-Archive-Tar
109 + virtual/perl-Digest-SHA
110 + virtual/perl-IO-Zlib
111 + virtual/perl-Time-HiRes
112 + ssl? (
113 + !libressl? ( dev-libs/openssl:0 )
114 + libressl? ( dev-libs/libressl )
115 + )"
116 +
117 +# SpamAssassin doesn't use libwww-perl except as a fallback for when
118 +# curl/wget are missing, so we depend on one of those instead. Some
119 +# mirrors use https, so we need those utilities to support SSL.
120 +#
121 +# re2c is needed to compile the rules (sa-compile).
122 +#
123 +# We still need the old Digest-SHA1 because razor2 has not been ported
124 +# to Digest-SHA.
125 +OPTDEPEND="app-crypt/gnupg
126 + dev-perl/Digest-SHA1
127 + dev-perl/Encode-Detect
128 + dev-perl/Geo-IP
129 + dev-perl/HTTP-Date
130 + dev-perl/Mail-DKIM
131 + dev-perl/Mail-SPF
132 + dev-perl/Net-Patricia
133 + dev-perl/Net-CIDR-Lite
134 + dev-util/re2c
135 + || ( net-misc/wget[ssl] net-misc/curl[ssl] )
136 + virtual/perl-MIME-Base64
137 + virtual/perl-Pod-Parser
138 + berkdb? ( virtual/perl-DB_File )
139 + ipv6? ( dev-perl/IO-Socket-INET6 )
140 + ldap? ( dev-perl/perl-ldap )
141 + mysql? (
142 + dev-perl/DBI
143 + dev-perl/DBD-mysql
144 + )
145 + postgres? (
146 + dev-perl/DBI
147 + dev-perl/DBD-Pg
148 + )
149 + sqlite? (
150 + dev-perl/DBI
151 + dev-perl/DBD-SQLite
152 + )
153 + ssl? ( dev-perl/IO-Socket-SSL )"
154 +
155 +DEPEND="${REQDEPEND}
156 + test? (
157 + ${OPTDEPEND}
158 + virtual/perl-Test-Harness
159 + )"
160 +RDEPEND="${REQDEPEND} ${OPTDEPEND}"
161 +
162 +PATCHES=(
163 + "${FILESDIR}/spamassassin-3.4.1-bug_7199.patch"
164 + "${FILESDIR}/spamassassin-3.4.1-bug_7223.patch"
165 + "${FILESDIR}/spamassassin-3.4.1-bug_7231.patch"
166 + "${FILESDIR}/spamassassin-3.4.1-bug_7265.patch"
167 + "${FILESDIR}/spamassassin-3.4.1-bug_7231-extra.patch"
168 + "${FILESDIR}/spamassassin-3.4.1-bug_7404.patch"
169 + "${FILESDIR}/spamassassin-3.4.1-bug_7462.patch"
170 + "${FILESDIR}/spamassassin-3.4.1-perl526.patch"
171 + "${FILESDIR}/spamassassin-3.4.1-bug_7361.patch"
172 +)
173 +
174 +src_prepare() {
175 + default
176 +
177 + # The sa_compile test does some weird stuff like hopping around in
178 + # the directory tree and calling "make" to create a dist tarball
179 + # from ${S}. It fails, and is more trouble than it's worth...
180 + perl_rm_files t/sa_compile.t || die 'failed to remove sa_compile test'
181 +
182 + # The spamc tests (which need the networked spamd daemon) fail for
183 + # irrelevant reasons. It's too hard to disable them (unlike the
184 + # spamd tests themselves -- see src_test), so use a crude
185 + # workaround.
186 + perl_rm_files t/spamc_*.t || die 'failed to remove spamc tests'
187 +}
188 +
189 +src_configure() {
190 + # This is how and where the perl-module eclass disables the
191 + # MakeMaker interactive prompt.
192 + export PERL_MM_USE_DEFAULT=1
193 +
194 + # Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again
195 + # (just to be sure, nobody knows how it could happen in the first place).
196 + #
197 + # We also set the path to the perl executable explictly. This will be
198 + # used to create the initial shebang line in the scripts (bug 62276).
199 + perl Makefile.PL \
200 + PREFIX="${EPREFIX}/usr" \
201 + INSTALLDIRS=vendor \
202 + SYSCONFDIR="${EPREFIX}/etc" \
203 + DATADIR="${EPREFIX}/usr/share/spamassassin" \
204 + PERL_BIN="${EPREFIX}/usr/bin/perl" \
205 + ENABLE_SSL="$(usex ssl)" \
206 + DESTDIR="${D}" \
207 + || die 'failed to create a Makefile using Makefile.PL'
208 +
209 + # Now configure spamc.
210 + emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" spamc/Makefile
211 +}
212 +
213 +src_compile() {
214 + emake
215 + use qmail && emake spamc/qmail-spamc
216 +}
217 +
218 +src_install () {
219 + emake install
220 + einstalldocs
221 +
222 + # Create the stub dir used by sa-update and friends
223 + keepdir /var/lib/spamassassin
224 +
225 + # Move spamd to sbin where it belongs.
226 + dodir /usr/sbin
227 + mv "${ED}"/usr/bin/spamd "${ED}"/usr/sbin/spamd || die "move spamd failed"
228 +
229 + if use qmail; then
230 + dobin spamc/qmail-spamc
231 + fi
232 +
233 + ln -s mail/spamassassin "${ED}"/etc/spamassassin || die
234 +
235 + # Disable plugin by default
236 + sed -i -e 's/^loadplugin/\#loadplugin/g' \
237 + "${ED}/etc/mail/spamassassin/init.pre" \
238 + || die "failed to disable plugins by default"
239 +
240 + # Add the init and config scripts.
241 + newinitd "${FILESDIR}/3.4.1-spamd.init-r3" spamd
242 + newconfd "${FILESDIR}/3.4.1-spamd.conf-r1" spamd
243 +
244 + systemd_newunit "${FILESDIR}/${PN}.service-r4" "${PN}.service"
245 + systemd_install_serviced "${FILESDIR}/${PN}.service.conf-r2" \
246 + "${PN}.service"
247 +
248 + use postgres && dodoc sql/*_pg.sql
249 + use mysql && dodoc sql/*_mysql.sql
250 +
251 + dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
252 + sql/README.awl procmailrc.example sample-nonspam.txt \
253 + sample-spam.txt spamd/PROTOCOL spamd/README.vpopmail \
254 + spamd-apache2/README.apache
255 +
256 + # Rename some files so that they don't clash with others.
257 + newdoc spamd/README README.spamd
258 + newdoc sql/README README.sql
259 + newdoc ldap/README README.ldap
260 +
261 + if use qmail; then
262 + dodoc spamc/README.qmail
263 + fi
264 +
265 + insinto /etc/mail/spamassassin/
266 + insopts -m0400
267 + newins "${FILESDIR}"/secrets.cf secrets.cf.example
268 +
269 + # Create the directory where sa-update stores its GPG key (if you
270 + # choose to import one). If this directory does not exist, the
271 + # import will fail. This is bug 396307. We expect that the import
272 + # will be performed as root, and making the directory accessible
273 + # only to root prevents a warning on the command-line.
274 + diropts -m0700
275 + dodir /etc/mail/spamassassin/sa-update-keys
276 +
277 + if use cron; then
278 + # Install the cron job if they want it.
279 + exeinto /etc/cron.daily
280 + newexe "${FILESDIR}/update-spamassassin-rules.cron" \
281 + update-spamassassin-rules
282 + fi
283 +
284 + # Remove perllocal.pod to avoid file collisions (bug #603338).
285 + perl_delete_localpod || die "failed to remove perllocal.pod"
286 +
287 + # The perl-module eclass calls three other functions to clean
288 + # up in src_install. The first fixes references to ${D} in the
289 + # packlist, and is useful to us, too. The other two functions,
290 + # perl_delete_emptybsdir and perl_remove_temppath, don't seem
291 + # to be needed: there are no empty directories, *.bs files, or
292 + # ${D} paths remaining in our installed image.
293 + perl_fix_packlist || die "failed to fix paths in packlist"
294 +}
295 +
296 +src_test() {
297 + # Trick the test suite into skipping the spamd tests. Setting
298 + # SPAMD_HOST to a non-localhost value causes SKIP_SPAMD_TESTS to be
299 + # set in SATest.pm.
300 + export SPAMD_HOST=disabled
301 + default
302 +}
303 +
304 +pkg_preinst() {
305 + # The spamd daemon runs as this user. Use a real home directory so
306 + # that it can hold SA configuration.
307 + enewuser spamd -1 -1 /home/spamd
308 +}
309 +
310 +pkg_postinst() {
311 + elog
312 + elog 'No rules are installed by default. You will need to run sa-update'
313 + elog 'at least once, and most likely configure SpamAssassin before it'
314 + elog 'will work.'
315 +
316 + if ! use cron; then
317 + elog
318 + elog 'You should consider a cron job for sa-update. One is provided'
319 + elog 'for daily updates if you enable the "cron" USE flag.'
320 + fi
321 + elog
322 + elog 'Configuration and update help can be found on the wiki:'
323 + elog
324 + elog ' https://wiki.gentoo.org/wiki/SpamAssassin'
325 + elog
326 +
327 + ewarn 'If this version of SpamAssassin causes permissions issues'
328 + ewarn 'with your user configurations or bayes databases, then you'
329 + ewarn 'may need to set SPAMD_RUN_AS_ROOT=true in your OpenRC service'
330 + ewarn 'configuration file, or remove the --username and --groupname'
331 + ewarn 'flags from the SPAMD_OPTS variable in your systemd service'
332 + ewarn 'configuration file.'
333 +}