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: Fri, 23 Dec 2016 20:16:22
Message-Id: 1482523966.d44251db198a76df861aefc292a8578e89822740.mjo@gentoo
1 commit: d44251db198a76df861aefc292a8578e89822740
2 Author: Philippe Chaintreuil <gentoo_bugs_peep <AT> parallaxshift <DOT> com>
3 AuthorDate: Thu Dec 22 16:25:51 2016 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 23 20:12:46 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d44251db
7
8 mail-filter/spamassassin: call perl_delete_localpod
9
10 Call perl_delete_localpod to avoid collisions.
11
12 Gentoo-Bug: 603338
13
14 Package-Manager: portage-2.3.0
15
16 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
17
18 .../spamassassin/spamassassin-3.4.1-r9.ebuild | 244 +++++++++++++++++++++
19 1 file changed, 244 insertions(+)
20
21 diff --git a/mail-filter/spamassassin/spamassassin-3.4.1-r9.ebuild b/mail-filter/spamassassin/spamassassin-3.4.1-r9.ebuild
22 new file mode 100644
23 index 00000000..d5e7dfa
24 --- /dev/null
25 +++ b/mail-filter/spamassassin/spamassassin-3.4.1-r9.ebuild
26 @@ -0,0 +1,244 @@
27 +# Copyright 1999-2016 Gentoo Foundation
28 +# Distributed under the terms of the GNU General Public License v2
29 +# $Id$
30 +
31 +EAPI=6
32 +
33 +inherit perl-functions systemd toolchain-funcs
34 +
35 +MY_P="Mail-SpamAssassin-${PV//_/-}"
36 +S="${WORKDIR}/${MY_P}"
37 +DESCRIPTION="An extensible mail filter which can identify and tag spam"
38 +HOMEPAGE="http://spamassassin.apache.org/"
39 +SRC_URI="mirror://apache/spamassassin/source/${MY_P}.tar.bz2"
40 +
41 +LICENSE="Apache-2.0 GPL-2"
42 +SLOT="0"
43 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
44 +IUSE="+bayes berkdb cron ipv6 ldap libressl mysql postgres qmail sqlite ssl test"
45 +
46 +# You can do without a database unless you need the Bayes features.
47 +REQUIRED_USE="bayes? ( || ( berkdb mysql postgres sqlite ) )"
48 +
49 +# The Makefile.PL script checks for dependencies, but only fails if a
50 +# required (i.e. not optional) dependency is missing. We therefore
51 +# require most of the optional modules only at runtime.
52 +REQDEPEND="dev-lang/perl
53 + dev-perl/HTML-Parser
54 + dev-perl/Net-DNS
55 + dev-perl/NetAddr-IP
56 + virtual/perl-Archive-Tar
57 + virtual/perl-Digest-SHA
58 + virtual/perl-IO-Zlib
59 + virtual/perl-Time-HiRes
60 + ssl? (
61 + !libressl? ( dev-libs/openssl:0 )
62 + libressl? ( dev-libs/libressl )
63 + )"
64 +
65 +# SpamAssassin doesn't use libwww-perl except as a fallback for when
66 +# curl/wget are missing, so we depend on one of those instead. Some
67 +# mirrors use https, so we need those utilities to support SSL.
68 +#
69 +# re2c is needed to compile the rules (sa-compile).
70 +#
71 +# We still need the old Digest-SHA1 because razor2 has not been ported
72 +# to Digest-SHA.
73 +OPTDEPEND="app-crypt/gnupg
74 + dev-perl/Digest-SHA1
75 + dev-perl/Encode-Detect
76 + dev-perl/Geo-IP
77 + dev-perl/HTTP-Date
78 + dev-perl/Mail-DKIM
79 + dev-perl/Mail-SPF
80 + dev-perl/Net-Patricia
81 + dev-perl/Net-CIDR-Lite
82 + dev-util/re2c
83 + || ( net-misc/wget[ssl] net-misc/curl[ssl] )
84 + virtual/perl-MIME-Base64
85 + virtual/perl-Pod-Parser
86 + berkdb? ( virtual/perl-DB_File )
87 + ipv6? ( dev-perl/IO-Socket-INET6 )
88 + ldap? ( dev-perl/perl-ldap )
89 + mysql? (
90 + dev-perl/DBI
91 + dev-perl/DBD-mysql
92 + )
93 + postgres? (
94 + dev-perl/DBI
95 + dev-perl/DBD-Pg
96 + )
97 + sqlite? (
98 + dev-perl/DBI
99 + dev-perl/DBD-SQLite
100 + )
101 + ssl? ( dev-perl/IO-Socket-SSL )"
102 +
103 +DEPEND="${REQDEPEND}
104 + test? (
105 + ${OPTDEPEND}
106 + virtual/perl-Test-Harness
107 + )"
108 +RDEPEND="${REQDEPEND} ${OPTDEPEND}"
109 +
110 +PATCHES=(
111 + "${FILESDIR}/spamassassin-3.4.1-bug_7199.patch"
112 + "${FILESDIR}/spamassassin-3.4.1-bug_7223.patch"
113 + "${FILESDIR}/spamassassin-3.4.1-bug_7231.patch"
114 + "${FILESDIR}/spamassassin-3.4.1-bug_7265.patch"
115 +)
116 +
117 +src_prepare() {
118 + default
119 +
120 + # The sa_compile test does some weird stuff like hopping around in
121 + # the directory tree and calling "make" to create a dist tarball
122 + # from ${S}. It fails, and is more trouble than it's worth...
123 + perl_rm_files t/sa_compile.t || die 'failed to remove sa_compile test'
124 +
125 + # The spamc tests (which need the networked spamd daemon) fail for
126 + # irrelevant reasons. It's too hard to disable them (unlike the
127 + # spamd tests themselves -- see src_test), so use a crude
128 + # workaround.
129 + perl_rm_files t/spamc_*.t || die 'failed to remove spamc tests'
130 +}
131 +
132 +src_configure() {
133 + # Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again
134 + # (just to be sure, nobody knows how it could happen in the first place).
135 + #
136 + # We also set the path to the perl executable explictly. This will be
137 + # used to create the initial shebang line in the scripts (bug 62276).
138 + perl Makefile.PL \
139 + PREFIX="${EPREFIX}/usr" \
140 + INSTALLDIRS=vendor \
141 + SYSCONFDIR="${EPREFIX}/etc" \
142 + DATADIR="${EPREFIX}/usr/share/spamassassin" \
143 + PERL_BIN="${EPREFIX}/usr/bin/perl" \
144 + ENABLE_SSL="$(usex ssl)" \
145 + DESTDIR="${D}" \
146 + || die 'failed to create a Makefile using Makefile.PL'
147 +
148 + # Now configure spamc.
149 + emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" spamc/Makefile
150 +}
151 +
152 +src_compile() {
153 + PERL_MM_USE_DEFAULT=1 emake
154 +
155 + if use qmail; then
156 + emake spamc/qmail-spamc
157 + fi
158 +}
159 +
160 +src_install () {
161 + emake install
162 + einstalldocs
163 +
164 + # Create the stub dir used by sa-update and friends
165 + keepdir /var/lib/spamassassin
166 +
167 + # Move spamd to sbin where it belongs.
168 + dodir /usr/sbin
169 + mv "${ED}"/usr/bin/spamd "${ED}"/usr/sbin/spamd || die "move spamd failed"
170 +
171 + if use qmail; then
172 + dobin spamc/qmail-spamc
173 + fi
174 +
175 + ln -s mail/spamassassin "${ED}"/etc/spamassassin || die
176 +
177 + # Disable plugin by default
178 + sed -i -e 's/^loadplugin/\#loadplugin/g' \
179 + "${ED}/etc/mail/spamassassin/init.pre" \
180 + || die "failed to disable plugins by default"
181 +
182 + # Add the init and config scripts.
183 + newinitd "${FILESDIR}/3.4.1-spamd.init" spamd
184 + newconfd "${FILESDIR}/3.4.1-spamd.conf" spamd
185 +
186 + systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service"
187 + systemd_install_serviced "${FILESDIR}/${PN}.service.conf"
188 +
189 + # The sed statements in the following conditionals alter the init
190 + # script to depend (or not) on the database being running before
191 + # spamd is started. The sed commands either enable the dependency,
192 + # or delete the line entirely.
193 + if use postgres; then
194 + sed -i -e 's:@USEPOSTGRES@::' "${ED}/etc/init.d/spamd" || die
195 +
196 + dodoc sql/*_pg.sql
197 + else
198 + sed -i -e '/@USEPOSTGRES@/d' "${ED}/etc/init.d/spamd" || die
199 + fi
200 +
201 + if use mysql; then
202 + sed -i -e 's:@USEMYSQL@::' "${ED}/etc/init.d/spamd" || die
203 +
204 + dodoc sql/*_mysql.sql
205 + else
206 + sed -i -e '/@USEMYSQL@/d' "${ED}/etc/init.d/spamd" || die
207 + fi
208 +
209 + dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
210 + sql/README.awl procmailrc.example sample-nonspam.txt \
211 + sample-spam.txt spamd/PROTOCOL spamd/README.vpopmail \
212 + spamd-apache2/README.apache
213 +
214 + # Rename some files so that they don't clash with others.
215 + newdoc spamd/README README.spamd
216 + newdoc sql/README README.sql
217 + newdoc ldap/README README.ldap
218 +
219 + if use qmail; then
220 + dodoc spamc/README.qmail
221 + fi
222 +
223 + insinto /etc/mail/spamassassin/
224 + insopts -m0400
225 + newins "${FILESDIR}"/secrets.cf secrets.cf.example
226 +
227 + # Create the directory where sa-update stores its GPG key (if you
228 + # choose to import one). If this directory does not exist, the
229 + # import will fail. This is bug 396307. We expect that the import
230 + # will be performed as root, and making the directory accessible
231 + # only to root prevents a warning on the command-line.
232 + diropts -m0700
233 + dodir /etc/mail/spamassassin/sa-update-keys
234 +
235 + if use cron; then
236 + # Install the cron job if they want it.
237 + exeinto /etc/cron.daily
238 + newexe "${FILESDIR}/update-spamassassin-rules.cron" \
239 + update-spamassassin-rules
240 + fi
241 +
242 + # Remove perlocal.pod to avoid file collisions (see #603338)
243 + perl_delete_localpod || die "Failed to remove perlocal.pod"
244 +}
245 +
246 +src_test() {
247 + # Trick the test suite into skipping the spamd tests. Setting
248 + # SPAMD_HOST to a non-localhost value causes SKIP_SPAMD_TESTS to be
249 + # set in SATest.pm.
250 + export SPAMD_HOST=disabled
251 + default
252 +}
253 +
254 +pkg_postinst() {
255 + elog
256 + elog 'No rules are installed by default. You will need to run sa-update'
257 + elog 'at least once, and most likely configure SpamAssassin before it'
258 + elog 'will work.'
259 +
260 + if ! use cron; then
261 + elog
262 + elog 'You should consider a cron job for sa-update. One is provided'
263 + elog 'for daily updates if you enable the "cron" USE flag.'
264 + fi
265 + elog
266 + elog 'Configuration and update help can be found on the wiki:'
267 + elog
268 + elog ' https://wiki.gentoo.org/wiki/SpamAssassin'
269 + elog
270 +}