summaryrefslogtreecommitdiff
path: root/extra/spamassassin
diff options
context:
space:
mode:
Diffstat (limited to 'extra/spamassassin')
-rw-r--r--extra/spamassassin/PKGBUILD26
-rw-r--r--extra/spamassassin/perl-5.18-fixes.patch97
-rw-r--r--extra/spamassassin/spamassassin.install39
-rw-r--r--extra/spamassassin/spamassassin.service2
4 files changed, 46 insertions, 118 deletions
diff --git a/extra/spamassassin/PKGBUILD b/extra/spamassassin/PKGBUILD
index d5699b83e..1b527bd5c 100644
--- a/extra/spamassassin/PKGBUILD
+++ b/extra/spamassassin/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 187368 2013-06-05 15:55:32Z bluewind $
+# $Id: PKGBUILD 205860 2014-02-11 21:25:20Z bluewind $
# Maintainer: Florian Pritz <bluewind@xinu.at>
# Contributor: Dale Blount <dale@archlinux.org>
# Contributor: Manolis Tzanidakis
pkgname=spamassassin
-pkgver=3.3.2
-pkgrel=9
+pkgver=3.4.0
+pkgrel=1
pkgdesc="A mail filter to identify spam."
arch=('i686' 'x86_64')
license=('APACHE')
@@ -21,18 +21,18 @@ backup=('etc/mail/spamassassin/local.cf'
'etc/mail/spamassassin/v320.pre'
'etc/mail/spamassassin/v330.pre')
install="${pkgname}.install"
-options=('!emptydirs')
-source=("http://mirrors.devlib.org/apache/${pkgname}/source/Mail-SpamAssassin-${pkgver}.tar.gz"
- 'spamassassin.service'
- 'perl-5.18-fixes.patch')
-md5sums=('d1d62cc5c6eac57e88c4006d9633b81e'
- 'b8dcea016fb73b074b941e832cfae5c9'
- '6cf63928eeeaea25967c2ffd875d106a')
+source=("http://www.us.apache.org/dist/${pkgname}/source/Mail-SpamAssassin-${pkgver}.tar.gz"{,.asc}
+ 'spamassassin.service')
+md5sums=('5d0b50cee3bfa905cca35c33296c8c2a'
+ 'SKIP'
+ 'd0ce5f8a02fd74dbc83632f4aaec6185')
prepare() {
cd "${srcdir}/Mail-SpamAssassin-${pkgver}"
- patch -p0 -d lib -i "$srcdir/perl-5.18-fixes.patch"
+ sed -i t/sa_compile.t \
+ -e 's#/foo/bin/spamassassin#/foo/bin/site_perl/spamassassin#' \
+ -e 's#/foo/bin/sa-compile#/foo/bin/site_perl/sa-compile#'
}
build() {
@@ -47,9 +47,6 @@ build() {
check() {
cd "${srcdir}/Mail-SpamAssassin-${pkgver}"
- # SSLv2 is disabled by upstream so this test would fail
- rm -rf t/spamd_ssl_v2.t
-
# parallel tests cause lots of failures; disable for now
#export HARNESS_OPTIONS="j$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/')"
@@ -61,4 +58,5 @@ package() {
make DESTDIR="${pkgdir}" install
install -D -m644 "${srcdir}/spamassassin.service" "${pkgdir}/usr/lib/systemd/system/spamassassin.service"
+ install -d -o 182 -g 182 -m 755 "$pkgdir/var/lib/spamassassin"
}
diff --git a/extra/spamassassin/perl-5.18-fixes.patch b/extra/spamassassin/perl-5.18-fixes.patch
deleted file mode 100644
index 74277fc8b..000000000
--- a/extra/spamassassin/perl-5.18-fixes.patch
+++ /dev/null
@@ -1,97 +0,0 @@
---- Mail/SpamAssassin/AsyncLoop.pm~ 2011-06-07 01:59:17.000000000 +0200
-+++ Mail/SpamAssassin/AsyncLoop.pm 2013-05-29 01:37:58.000000000 +0200
-@@ -361,5 +361,12 @@
- $now = time; # capture new timestamp, after possible sleep in 'select'
-
-- while (my($key,$ent) = each %$pending) {
-+ # A callback routine may generate another DNS query, which may insert
-+ # an entry into the %$pending hash thus invalidating the each() context.
-+ # So, make sure that callbacks are not called while the each() context
-+ # is open, or avoid using each(). [Bug 6937]
-+ #
-+ # while (my($key,$ent) = each %$pending) {
-+ foreach my $key (keys %$pending) {
-+ my $ent = $pending->{$key};
- my $id = $ent->{id};
- if (defined $ent->{poll_callback}) { # call a "poll_callback" if exists
-@@ -449,5 +456,6 @@
- my $foundcnt = 0;
- my $now = time;
-- while (my($key,$ent) = each %$pending) {
-+ foreach my $key (keys %$pending) {
-+ my $ent = $pending->{$key};
- dbg("async: aborting after %.3f s, %s: %s",
- $now - $ent->{start_time},
---- Mail/SpamAssassin/Conf/Parser.pm~ 2011-06-07 01:59:17.000000000 +0200
-+++ Mail/SpamAssassin/Conf/Parser.pm 2013-05-29 01:32:06.000000000 +0200
-@@ -1249,5 +1249,5 @@
- my $mods = '';
- local ($1,$2);
-- if ($re =~ s/^m{//) {
-+ if ($re =~ s/^m\{//) {
- $re =~ s/}([a-z]*)$//; $mods = $1;
- }
---- Mail/SpamAssassin/DnsResolver.pm~ 2011-06-07 01:59:17.000000000 +0200
-+++ Mail/SpamAssassin/DnsResolver.pm 2013-05-29 01:32:06.000000000 +0200
-@@ -441,8 +441,14 @@
- if (!defined($timeout) || $timeout > 0)
- { $timer = $self->{main}->time_method("poll_dns_idle") }
-+ $! = 0;
- ($nfound, $timeleft) = select($rout=$rin, undef, undef, $timeout);
- }
- if (!defined $nfound || $nfound < 0) {
-- warn "dns: select failed: $!";
-+ if ($!) { warn "dns: select failed: $!\n" }
-+ else { info("dns: select interrupted") }
-+ return;
-+ } elsif (!$nfound) {
-+ if (!defined $timeout) { warn("dns: select returned empty-handed\n") }
-+ elsif ($timeout > 0) { dbg("dns: select timed out %.3f s", $timeout) }
- return;
- }
---- Mail/SpamAssassin/Message.pm~ 2011-06-07 01:59:17.000000000 +0200
-+++ Mail/SpamAssassin/Message.pm 2013-05-29 01:32:06.000000000 +0200
-@@ -567,5 +567,5 @@
- # bug 5557: windows requires tmp file be closed before it can be rm'd
- if (ref $part->{'raw'} eq 'GLOB') {
-- close($part->{'raw'}) or die "error closing input file: $!";
-+ close($part->{'raw'}) or warn "error closing input file: $!";
- }
-
---- Mail/SpamAssassin/PerMsgStatus.pm~ 2011-06-07 01:59:17.000000000 +0200
-+++ Mail/SpamAssassin/PerMsgStatus.pm 2013-05-29 01:32:06.000000000 +0200
-@@ -421,6 +421,6 @@
- }
-
-- # ignore tests with 0 score in this scoreset
-- next if ($scores->{$test} == 0);
-+ # ignore tests with 0 score (or undefined) in this scoreset
-+ next if !$scores->{$test};
-
- # Go ahead and add points to the proper locations
-@@ -1253,11 +1253,10 @@
- my $line = '';
- foreach my $test (sort @{$self->{test_names_hit}}) {
-- if (!$line) {
-- $line .= $test . "=" . $self->{conf}->{scores}->{$test};
-- } else {
-- $line .= $arg . $test . "=" . $self->{conf}->{scores}->{$test};
-- }
-+ my $score = $self->{conf}->{scores}->{$test};
-+ $score = '0' if !defined $score;
-+ $line .= $arg if $line ne '';
-+ $line .= $test . "=" . $score;
- }
-- $line ? $line : 'none';
-+ $line ne '' ? $line : 'none';
- },
-
---- Mail/SpamAssassin/Util.pm~ 2013-05-29 01:29:59.000000000 +0200
-+++ Mail/SpamAssassin/Util.pm 2013-05-29 01:33:16.000000000 +0200
-@@ -1588,5 +1588,5 @@
- return undef; # invalid
- }
-- elsif ($re =~ s/^m{//) { # m{foo/bar}
-+ elsif ($re =~ s/^m\{//) { # m{foo/bar}
- $delim = '}';
- }
diff --git a/extra/spamassassin/spamassassin.install b/extra/spamassassin/spamassassin.install
index e43453e97..cca20782d 100644
--- a/extra/spamassassin/spamassassin.install
+++ b/extra/spamassassin/spamassassin.install
@@ -1,11 +1,38 @@
+setup_user() {
+ getent group spamd &>/dev/null || groupadd -g 182 spamd >/dev/null
+ getent passwd spamd &>/dev/null || useradd -u 182 -d /var/lib/spamassassin -g spamd -s /bin/false spamd >/dev/null
+
+ if [[ -d /var/lib/spamassassin ]]; then
+ chown spamd:spamd /var/lib/spamassassin
+ fi
+
+ true
+}
+
post_install() {
- echo "You must run 'sa-update' to install spam rules before use."
+ echo "You must run 'sa-update' to install spam rules before use."
+ setup_user
}
post_upgrade() {
- # Compile rules, if rules have previously been compiled, and it's possible
- if type re2c &>/dev/null && type sa-compile &>/dev/null && [[ -d /var/lib/spamassassin/compiled ]]; then
- echo "Detected compiled rules, running sa-compile..."
- sa-compile > /dev/null 2>&1
-fi
+ setup_user
+ if [ "$(vercmp $2 3.4)" -lt 0 ]; then
+ echo '/var/lib/spamassassin is now owned by the spamd user. spamassassin.service'
+ echo 'will also run under that user. You may need to adjust your setup.'
+ fi
+
+ # Compile rules, if rules have previously been compiled, and it's possible
+ if type re2c &>/dev/null && type sa-compile &>/dev/null && [[ -d /var/lib/spamassassin/compiled ]]; then
+ echo "Detected compiled rules, running sa-compile..."
+ sa-compile > /dev/null 2>&1
+ fi
+
+ true
+}
+
+pre_remove() {
+ getent passwd spamd &>/dev/null && userdel spamd >/dev/null
+ getent group spamd &>/dev/null && groupdel spamd >/dev/null
+ true
}
+
diff --git a/extra/spamassassin/spamassassin.service b/extra/spamassassin/spamassassin.service
index e9c9c07fd..6e6b1f35b 100644
--- a/extra/spamassassin/spamassassin.service
+++ b/extra/spamassassin/spamassassin.service
@@ -5,7 +5,7 @@ After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/spamd.pid
-ExecStart=/usr/bin/vendor_perl/spamd -d --pidfile /var/run/spamd.pid -c -c -x --virtual-config-dir=/var/lib/spamassassin -u nobody
+ExecStart=/usr/bin/vendor_perl/spamd -d --pidfile /var/run/spamd.pid -c -c -x --virtual-config-dir=/var/lib/spamassassin -u spamd -g spamd
StandardOutput=syslog
StandardError=syslog
Restart=always