aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValery Kartel <valery.kartel@gmail.com>2016-01-20 15:44:42 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2016-02-04 09:37:43 +0000
commit1dfcbc6c8e2372345f6181b06acd94f0c184bb5e (patch)
tree3383e5ccc2ae4926621d15b6eb484ef9970d206e
parentdb824002e838087bd1acaf9ba5ef6e29edcc57a0 (diff)
downloadaports-1dfcbc6c8e2372345f6181b06acd94f0c184bb5e.tar.bz2
aports-1dfcbc6c8e2372345f6181b06acd94f0c184bb5e.tar.xz
main/spamassassin: [V2] APKBUILD recreated with apkbuild-cpan. obsolete init-script replaced with new one, some parts are moved to subpackages
- added ssl support for spamd & spamc - perl libraries and configuration data are moved to perl-mail-spamassasin subpackage - spamc client binary have own dependencies and moved to -client subpackage - sa-compile needs development packages to run, so moved to -compiler subpackage - init-script rewritten from scratch and supports legacy conf.d syntax - periodic rules update added to cron TODO: some optional perl-modules still in testing (or still not accepted). When they moved to main, need to add them to cpan-dependency. optional module missing: Geo::IP --- testing/perl-geo-ip optional module missing: Net::CIDR::Lite --- testing/perl-net-cidr-lite && main/perl-net-cidr-lite is present too ... optional module missing: IO::Socket::INET6 --- testing/perl-io-socket-inet6 optional module missing: Encode::Detect::Detector --- not in git optional module missing: Net::Patricia --- testing/perl-net-patricia
-rw-r--r--main/spamassassin/APKBUILD98
-rw-r--r--main/spamassassin/spamd.conf46
-rw-r--r--main/spamassassin/spamd.confd2
-rw-r--r--main/spamassassin/spamd.crond3
-rw-r--r--main/spamassassin/spamd.init39
-rw-r--r--main/spamassassin/spamd.initd34
6 files changed, 107 insertions, 115 deletions
diff --git a/main/spamassassin/APKBUILD b/main/spamassassin/APKBUILD
index c307d245d9..9119c031be 100644
--- a/main/spamassassin/APKBUILD
+++ b/main/spamassassin/APKBUILD
@@ -1,49 +1,87 @@
+# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=spamassassin
-_realname=Mail-SpamAssassin
+_pkgreal=Mail-SpamAssassin
pkgver=3.4.1
-pkgrel=1
+pkgrel=2
pkgdesc="The Powerful #1 Open-Source Spam Filter"
-url="http://spamassassin.apache.org"
-arch="all"
-license="Apache"
-depends="gnupg perl perl-digest-sha1 perl-io-compress perl-time-hires
- perl-netaddr-ip perl-mail-dkim perl-html-parser perl-net-dns
- perl-db_file perl-libwww perl-uri"
-makedepends="perl-dev zlib-dev"
-install=
-subpackages="$pkgname-doc"
-source="http://www.apache.org/dist/spamassassin/source/$_realname-$pkgver.tar.gz
+url="http://search.cpan.org/dist/Mail-SpamAssassin/"
+arch="noarch"
+license="apache_2_0"
+cpandepends="perl-html-parser perl-digest-sha1 perl-netaddr-ip perl-net-dns perl-mail-dkim
+ perl-mime-base64 perl-db_file perl-time-hires perl-libwww"
+cpanmakedepends="$cpandepends"
+depends="perl-mail-$pkgname"
+makedepends="perl-dev $cpanmakedepends"
+subpackages="$pkgname-doc $pkgname-client $pkgname-compiler perl-mail-$pkgname:cpan"
+source="http://search.cpan.org/CPAN/authors/id/K/KM/KMCGRAIL/${_pkgreal#*-}/$_pkgreal-$pkgver.tar.gz
+ spamd.initd
+ spamd.confd
+ spamd.crond
"
-_builddir="$srcdir/$_realname-$pkgver"
+_builddir="$srcdir"/$_pkgreal-$pkgver
prepare() {
cd "$_builddir"
- for i in $source; do
- case $i in
- *.patch) msg "Applying $i"; patch -p1 -i "$srcdir"/$i || return 1
- esac
- done
+ export CFLAGS=`perl -MConfig -E 'say $Config{ccflags}'`
+ PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
+ rm t/dnsbl_subtests.t
}
build() {
cd "$_builddir"
- PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1
- make
+ export CFLAGS=`perl -MConfig -E 'say $Config{ccflags}'`
+ make && make test || return 1
}
package() {
cd "$_builddir"
- make DESTDIR="$pkgdir" install
- install -m755 -D ../../spamd.init $pkgdir/etc/init.d/spamd
- install -m644 -D ../../spamd.conf $pkgdir/etc/conf.d/spamd
- mkdir $pkgdir/usr/sbin
- mv $pkgdir/usr/bin/spamd $pkgdir/usr/sbin/spamd
- # creates file collision among perl modules
- find "$pkgdir" -name perllocal.pod -delete
+ make DESTDIR="$pkgdir" install || return 1
+ find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
+ install -Dm755 "$srcdir"/spamd.crond "$pkgdir"/etc/periodic/daily/$pkgname-update
+ install -Dm755 "$srcdir"/spamd.initd "$pkgdir"/etc/init.d/spamd
+ install -Dm644 "$srcdir"/spamd.confd "$pkgdir"/etc/conf.d/spamd
+ mkdir -p "$pkgdir"/usr/sbin
+ mv "$pkgdir"/usr/bin/spamd "$pkgdir"/usr/sbin/spamd
}
-md5sums="76eca1f38c11635d319e62c26d5b034b Mail-SpamAssassin-3.4.1.tar.gz"
-sha256sums="9b7a95a594cdca4f265707364478b57813b82a0ec7e520d9bc818bfbcafdd726 Mail-SpamAssassin-3.4.1.tar.gz"
-sha512sums="6a074f1a4177e1969cef575fe3b1b844d27c813d48fe1e07a46f56ffa728fc780897597d00f11acb269317a6308f284f0dee544d504da874d93b0549d094a6a3 Mail-SpamAssassin-3.4.1.tar.gz"
+client() {
+ arch="all"
+ depends=""
+ pkgdesc="SpamAssassin client"
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/spamc "$subpkgdir"/usr/bin
+}
+
+compiler() {
+ pkgdesc="SpamAssassin rules compiler"
+ depends="re2c gcc perl-dev perl-mail-$pkgname"
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/sa-compile "$subpkgdir"/usr/bin/
+}
+
+cpan() {
+ pkgdesc="SpamAssassin perl library"
+ depends="perl gnupg $cpandepends"
+ mkdir -p "$subpkgdir"/usr "$subpkgdir"/etc "$subpkgdir"/var/lib/$pkgname
+ mv "$pkgdir"/etc/mail "$subpkgdir"/etc
+ mv "$pkgdir"/usr/lib "$pkgdir"/usr/share "$subpkgdir"/usr
+ find "$subpkgdir" -name *.pod -delete
+ mv "$subpkgdir"/usr/share/$pkgname/user_prefs.template \
+ "$subpkgdir"/etc/mail/$pkgname/user_prefs
+ sed -i '/^#\*/d' "$subpkgdir"/etc/mail/$pkgname/user_prefs
+}
+
+md5sums="76eca1f38c11635d319e62c26d5b034b Mail-SpamAssassin-3.4.1.tar.gz
+634f38c843ffac3f1d6e68663a4d68bb spamd.initd
+d72f889cdbcd1289b773db3c00651a9c spamd.confd
+d11273ff56e329842174cc1f68e91555 spamd.crond"
+sha256sums="9b7a95a594cdca4f265707364478b57813b82a0ec7e520d9bc818bfbcafdd726 Mail-SpamAssassin-3.4.1.tar.gz
+c7e6be7b4943b23830252f8ea0e580007930a32b9d956e96843fb797cc3834ed spamd.initd
+6533298faf4b0f50f9d7fcf32d60366c02ecc27deeb2725265035fe3267277f5 spamd.confd
+39487360aa9ee536e6f04f8fb86ed755f0536143b792f134667e5cd2a0e0846b spamd.crond"
+sha512sums="6a074f1a4177e1969cef575fe3b1b844d27c813d48fe1e07a46f56ffa728fc780897597d00f11acb269317a6308f284f0dee544d504da874d93b0549d094a6a3 Mail-SpamAssassin-3.4.1.tar.gz
+a8bac239b69660944bde2e10ec5bb712ce9e3c734ca574e50915474faf5643fc6ca1eb64a375bd42fdeb0f83f1affd6f064d4c388607dcf5b8a5723191a54119 spamd.initd
+274d3aa0d9aab05e83c8d5ad3e93a457649360021a67c8cb19088365bed681ebe26889cfa86f8c46a6044c7ee969231f2a71e3227adf8ad9e38d0286b9caf48d spamd.confd
+c8c00e4281cefd5e5e15507c8890264a25aa59663c57ccdf7a77905e2550999cfbbfa7271189a9491b0a0e98dff432361f13becdb99e1b583cd9d45d68022a47 spamd.crond"
diff --git a/main/spamassassin/spamd.conf b/main/spamassassin/spamd.conf
deleted file mode 100644
index b6fca036f2..0000000000
--- a/main/spamassassin/spamd.conf
+++ /dev/null
@@ -1,46 +0,0 @@
-# Config file for /etc/init.d/spamd
-
-
-# ***WARNING***
-# spamd was not designed to listed to an untrusted network. spamd
-# is vulnerable to DoS attacks (and eternal doom) if used to listen
-# to an untrusted network.
-#
-
-
-# Some options:
-#
-# -c to create a per user configuration file
-# -H [dir] to switch home dirs for helper apps, dir optional
-# -i [ip] to listen on the specified IP,
-# 127.0.0.1 if omitted,
-# 0.0.0.0 (ie. all) if given without value;
-# must be used in combination with -A to actually allow
-# connections from anybody but localhost
-# -m limit to set the number of children, default 5
-# -u user the user to run spamd as
-# -L if you want to run no net tests
-#
-# for more help look in man spamd
-#
-# Note: if you plan on using the -u flag to spamd you will need to
-# make sure the location of the PID file is writable by that user.
-# This can be done by making the directory /var/run/spamd and
-# changing the owner to the UID that runs spamd. You will then
-# need to edit $pidfile in /etc/init.d/spamd. This should fix the
-# problem with stop/restart in the init scripts.
-#
-# See http://bugs.gentoo.org/show_bug.cgi?id=70124 for a full
-# explanation.
-
-SPAMD_OPTS="-m 5 -c -H"
-
-# spamd stores its pid in this file. If you use the -u option to
-# run spamd under another user, you might need to adjust it.
-
-PIDFILE="/var/run/spamd.pid"
-
-# SPAMD_NICELEVEL lets you set the 'nice'ness of the running
-# spamd process
-
-# SPAMD_NICELEVEL=5
diff --git a/main/spamassassin/spamd.confd b/main/spamassassin/spamd.confd
new file mode 100644
index 0000000000..61bc8ec016
--- /dev/null
+++ b/main/spamassassin/spamd.confd
@@ -0,0 +1,2 @@
+#pidfile=/run/spamd.pid
+#command_args="-m 5 -c -H"
diff --git a/main/spamassassin/spamd.crond b/main/spamassassin/spamd.crond
new file mode 100644
index 0000000000..c9ccce550e
--- /dev/null
+++ b/main/spamassassin/spamd.crond
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/usr/bin/sa-update
diff --git a/main/spamassassin/spamd.init b/main/spamassassin/spamd.init
deleted file mode 100644
index 89723889f4..0000000000
--- a/main/spamassassin/spamd.init
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/mail-filter/spamassassin/files/3.0.0-spamd.init,v 1.8 2008/05/14 21:25:56 sbriesen Exp $
-
-# NB: Config is in /etc/conf.d/spamd
-
-# Provide a default location if they haven't in /etc/conf.d/spamd
-PIDFILE=${PIDFILE:-/var/run/spamd.pid}
-
-opts="reload"
-
-depend() {
- need net
- before mta
- use logger
-}
-
-start() {
- ebegin "Starting spamd"
- start-stop-daemon --start --quiet \
- --name spamd \
- --nicelevel ${SPAMD_NICELEVEL:-0} \
- --exec /usr/sbin/spamd -- -d -r ${PIDFILE} \
- ${SPAMD_OPTS}
- eend $? "Failed to start spamd"
-}
-
-stop() {
- ebegin "Stopping spamd"
- start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
- eend $? "Failed to stop spamd"
-}
-
-reload() {
- ebegin "Reloading configuration"
- kill -HUP $(< ${PIDFILE})
- eend $?
-}
diff --git a/main/spamassassin/spamd.initd b/main/spamassassin/spamd.initd
new file mode 100644
index 0000000000..a016f49074
--- /dev/null
+++ b/main/spamassassin/spamd.initd
@@ -0,0 +1,34 @@
+#!/sbin/openrc-run
+
+pidfile=${pidfile:-/run/spamd.pid}
+command=/usr/sbin/spamd
+command_args="$command_args:--m 5 -c -H}"
+extra_started_commands="reload"
+
+depend() {
+ need net
+ before mta
+ use logger
+}
+
+_legacy() {
+ [ -n "$PIDFILE ] && pidfile=$PIDFILE
+ [ -n "$SPAMD_OPTS" ] && command_args=$SPAMD_OPTS
+}
+
+start_pre() {
+ _legacy
+ required_dirs="/var/lib/spamassassin/3.004001"
+ if [ ! -d $required_dirs ]; then
+ ebegin "Downloading rules"
+ /usr/bin/sa-update
+ eend $?
+ fi
+ command_args="-d -r $pidfile $command_args"
+}
+
+reload() {
+ ebegin "Reloading $SVCNAME"
+ start-stop-daemon --signal=HUP --pidfile $pidfile
+ eend
+}