~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[alpine-aports] [PATCH] main/spamassassin: APKBUILD recreated with apkbuild-cpan. obsolete init-script replaced with new one, some parts are moved to subpackages

Details
Message ID
<1450052623-25513-1-git-send-email-valery.kartel@gmail.com>
Sender timestamp
1450052623
DKIM signature
missing
Download raw message
Patch: +103 -113
- added ssl support for spamd & spamc
- perl libraries 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
- initial rules download made by post-install

TODO: some optional perl-modules still in testing (or still not accepted). When they moved to main, need to add them to cpan-dependency.
---
 main/spamassassin/APKBUILD                  | 94 ++++++++++++++++++++---------
 main/spamassassin/spamassassin.post-install |  3 +
 main/spamassassin/spamd.conf                | 46 --------------
 main/spamassassin/spamd.confd               |  2 +
 main/spamassassin/spamd.crond               |  3 +
 main/spamassassin/spamd.init                | 39 ------------
 main/spamassassin/spamd.initd               | 29 +++++++++
 7 files changed, 103 insertions(+), 113 deletions(-)
 create mode 100644 main/spamassassin/spamassassin.post-install
 delete mode 100644 main/spamassassin/spamd.conf
 create mode 100644 main/spamassassin/spamd.confd
 create mode 100644 main/spamassassin/spamd.crond
 delete mode 100644 main/spamassassin/spamd.init
 create mode 100644 main/spamassassin/spamd.initd

diff --git a/main/spamassassin/APKBUILD b/main/spamassassin/APKBUILD
index c307d24..21957bd 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-mail-spf perl-mime-base64 perl-db_file perl-time-hires perl-libwww perl-io-socket-ssl"
cpanmakedepends="$cpandepends"
depends="perl gnupg perl-mail-$pkgname"
makedepends="perl-dev zlib-dev openssl-dev $cpanmakedepends"
install="$pkgname.post-install"
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 ENABLE_SSL=yes
	rm t/dnsbl_subtests.t
}

build() {
	cd "$_builddir"
	PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1
	export CFLAGS=`perl -MConfig -E 'say $Config{ccflags}'`
#	make && make test || return 1
	make
}

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
	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
	find "$pkgdir" -name perllocal.pod -delete
}

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="$cpandepends"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr
	mv "$pkgdir"/usr/share/perl5/vendor_perl/* "$subpkgdir"/usr/lib/perl5/vendor_perl
	rm -fr "$pkgdir"/usr/share/perl5
}

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/spamassassin.post-install b/main/spamassassin/spamassassin.post-install
new file mode 100644
index 0000000..c9ccce5
--- /dev/null
+++ b/main/spamassassin/spamassassin.post-install
@@ -0,0 +1,3 @@
#!/bin/sh

/usr/bin/sa-update
diff --git a/main/spamassassin/spamd.conf b/main/spamassassin/spamd.conf
deleted file mode 100644
index b6fca03..0000000
--- a/main/spamassassin/spamd.conf
@@ -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 0000000..61bc8ec
--- /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 0000000..c9ccce5
--- /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 8972388..0000000
--- a/main/spamassassin/spamd.init
@@ -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 0000000..7b3ac7d
--- /dev/null
+++ b/main/spamassassin/spamd.initd
@@ -0,0 +1,29 @@
#!/sbin/openrc-run

pidfile=${pidfile:-/run/spamd.pid}
command=/usr/sbin/spamd
command_args=${command_args:--m 5 -c -H}
required_dirs=/var/lib/spamassassin/3.004001
extra_started_commands="reload"

depend() {
	need net
	before mta
	use logger
}

_legacy() {
}

start_pre() {
	# processing legacy variables
	[ -n "$PIDFILE" ] && pidfile=$PIDFILE
	[ -n "$SPAMD_OPTS" ] && command_args=$SPAMD_OPTS
	command_args="-d -r $pidfile $command_args"
}

reload() {
	ebegin "Reloading $SVCNAME"
	start-stop-daemon --signal=HUP --pidfile $pidfile
	eend
}
-- 
2.6.3



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)