summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <mjo@gentoo.org>2017-08-13 18:08:00 -0400
committerMichael Orlitzky <mjo@gentoo.org>2017-08-20 10:32:43 -0400
commit52480637e8a4cd42cb671c02fdf1c122e387a3fe (patch)
treed67420604c8a38808eeb659e0e400ce4e0e497e1 /mail-filter
parentwww-servers/tomcat: bumped for slot 8 (diff)
downloadgentoo-52480637e8a4cd42cb671c02fdf1c122e387a3fe.tar.gz
gentoo-52480637e8a4cd42cb671c02fdf1c122e387a3fe.tar.bz2
gentoo-52480637e8a4cd42cb671c02fdf1c122e387a3fe.zip
mail-filter/spamassassin: new revision to fix tests and improve init script.
This commit adds an upstream patch to fix a test suite crash with newer versions of perl. It also largely rewrites the init script: * Don't conditionally "use mysql" or "use postgres" in the OpenRC init script. Even if SpamAssassin is installed without e.g. MySQL support, if MySQL is present on the system, a user might store his SpamAssassin data in it. * Use a declarative style and drop the custom start() and stop() functions. * Run the spamd daemon as the "spamd" user. * Use /run/spamd.pid for the PID file to avoid a "checkpath". Some updates were made to the ebuild to facilitate those changes: * Don't modify the init script for USE=mysql or USE=postgres. * Create a "spamd" user in pkg_preinst(). Package-Manager: Portage-2.3.6, Repoman-2.3.1
Diffstat (limited to 'mail-filter')
-rwxr-xr-xmail-filter/spamassassin/files/3.4.1-spamd.init-r134
-rw-r--r--mail-filter/spamassassin/files/spamassassin-3.4.1-bug_7404.patch23
-rw-r--r--mail-filter/spamassassin/spamassassin-3.4.1-r13.ebuild (renamed from mail-filter/spamassassin/spamassassin-3.4.1-r12.ebuild)32
3 files changed, 68 insertions, 21 deletions
diff --git a/mail-filter/spamassassin/files/3.4.1-spamd.init-r1 b/mail-filter/spamassassin/files/3.4.1-spamd.init-r1
new file mode 100755
index 000000000000..5f981d8e2c3d
--- /dev/null
+++ b/mail-filter/spamassassin/files/3.4.1-spamd.init-r1
@@ -0,0 +1,34 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/sbin/spamd"
+pidfile="/run/spamd.pid"
+command_args="--username=spamd
+ --groupname=spamd
+ --pidfile=${pidfile}
+ ${SPAMD_OPTS}"
+command_args_background="--daemonize"
+
+: ${SPAMD_NICELEVEL:=0}
+start_stop_daemon_args="--nicelevel ${SPAMD_NICELEVEL}"
+
+# Retry after SPAMD_TIMEOUT seconds because spamd can take a
+# while to kill off all of its children. This was bug 322025.
+: ${SPAMD_TIMEOUT:=15}
+retry="${SPAMD_TIMEOUT}"
+
+extra_started_commands="reload"
+
+depend() {
+ before mta
+ use logger mysql postgres
+}
+
+reload() {
+ ebegin "Reloading configuration"
+ # Warning: reload causes the PID of the spamd process to
+ # change, but spamd does update its PID file afterwards.
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend $?
+}
diff --git a/mail-filter/spamassassin/files/spamassassin-3.4.1-bug_7404.patch b/mail-filter/spamassassin/files/spamassassin-3.4.1-bug_7404.patch
new file mode 100644
index 000000000000..563110fcb1f3
--- /dev/null
+++ b/mail-filter/spamassassin/files/spamassassin-3.4.1-bug_7404.patch
@@ -0,0 +1,23 @@
+--- a/lib/Mail/SpamAssassin/PerMsgStatus.pm (revision 1790817)
++++ b/lib/Mail/SpamAssassin/PerMsgStatus.pm (working copy)
+@@ -896,16 +896,16 @@
+ $str .= shift @{$ary};
+ }
+ undef $ary;
+- chomp ($str); $str .= " [...]\n";
+
+ # in case the last line was huge, trim it back to around 200 chars
+ local $1;
+- $str =~ s/^(.{,200}).*$/$1/gs;
++ $str =~ s/^(.{200}).+$/$1 [...]/gm;
++ chomp ($str); $str .= "\n";
+
+ # now, some tidy-ups that make things look a bit prettier
+- $str =~ s/-----Original Message-----.*$//gs;
++ $str =~ s/-----Original Message-----.*$//gm;
+ $str =~ s/This is a multi-part message in MIME format\.//gs;
+- $str =~ s/[-_\*\.]{10,}//gs;
++ $str =~ s/[-_*.]{10,}//gs;
+ $str =~ s/\s+/ /gs;
+
+ # add "Content preview:" ourselves, so that the text aligns
diff --git a/mail-filter/spamassassin/spamassassin-3.4.1-r12.ebuild b/mail-filter/spamassassin/spamassassin-3.4.1-r13.ebuild
index 02a2cce2c7e1..dc35e32ce580 100644
--- a/mail-filter/spamassassin/spamassassin-3.4.1-r12.ebuild
+++ b/mail-filter/spamassassin/spamassassin-3.4.1-r13.ebuild
@@ -3,7 +3,7 @@
EAPI=6
-inherit perl-functions systemd toolchain-funcs
+inherit perl-functions systemd toolchain-funcs user
MY_P="Mail-SpamAssassin-${PV//_/-}"
S="${WORKDIR}/${MY_P}"
@@ -83,6 +83,7 @@ PATCHES=(
"${FILESDIR}/spamassassin-3.4.1-bug_7231.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7265.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231-extra.patch"
+ "${FILESDIR}/spamassassin-3.4.1-bug_7404.patch"
"${FILESDIR}/spamassassin-3.4.1-perl526.patch"
)
@@ -153,31 +154,14 @@ src_install () {
|| die "failed to disable plugins by default"
# Add the init and config scripts.
- newinitd "${FILESDIR}/3.4.1-spamd.init" spamd
+ newinitd "${FILESDIR}/3.4.1-spamd.init-r1" spamd
newconfd "${FILESDIR}/3.4.1-spamd.conf" spamd
systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service"
systemd_install_serviced "${FILESDIR}/${PN}.service.conf"
- # The sed statements in the following conditionals alter the init
- # script to depend (or not) on the database being running before
- # spamd is started. The sed commands either enable the dependency,
- # or delete the line entirely.
- if use postgres; then
- sed -i -e 's:@USEPOSTGRES@::' "${ED}/etc/init.d/spamd" || die
-
- dodoc sql/*_pg.sql
- else
- sed -i -e '/@USEPOSTGRES@/d' "${ED}/etc/init.d/spamd" || die
- fi
-
- if use mysql; then
- sed -i -e 's:@USEMYSQL@::' "${ED}/etc/init.d/spamd" || die
-
- dodoc sql/*_mysql.sql
- else
- sed -i -e '/@USEMYSQL@/d' "${ED}/etc/init.d/spamd" || die
- fi
+ use postgres && dodoc sql/*_pg.sql
+ use mysql && dodoc sql/*_mysql.sql
dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
sql/README.awl procmailrc.example sample-nonspam.txt \
@@ -232,6 +216,12 @@ src_test() {
default
}
+pkg_preinst() {
+ # The spamd daemon runs as this user. Use a real home directory so
+ # that it can hold SA configuration.
+ enewuser spamd -1 -1 /home/spamd
+}
+
pkg_postinst() {
elog
elog 'No rules are installed by default. You will need to run sa-update'