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