Subject: [alpine-aports] [PATCH] testing/rspamd: upgrade to 1.5.0

From: Valery Kartel <[email-masked]>
Date: Thu, 2 Mar 2017 12:57:21 +0200

---
 testing/rspamd/APKBUILD       | 94 +++++++++++++++++++++++++++----------------
 testing/rspamd/config.patch   | 56 --------------------------
 testing/rspamd/worker.conf.in |  6 +++
 3 files changed, 66 insertions(+), 90 deletions(-)
 delete mode 100644 testing/rspamd/config.patch
 create mode 100644 testing/rspamd/worker.conf.in

diff --git a/testing/rspamd/APKBUILD b/testing/rspamd/APKBUILD
index 78437d599f..64ad812cc4 100644
--- a/testing/rspamd/APKBUILD
+++ b/testing/rspamd/APKBUILD
@@ -2,7 +2,7 @@
 # Contributor: Valery Kartel <[email-masked]>
 # Contributor: Nathan Angelacos <[email-masked]>
 pkgname=rspamd
-pkgver=1.4.4
+pkgver=1.5.0
 pkgrel=0
 pkgdesc="Fast, free and open-source spam filtering system"
 url="https://rspamd.com"
@@ -11,20 +11,38 @@ license="BSD"
 pkgusers="rspamd"
 pkggroups="rspamd"
 depends=""
-makedepends="cmake ragel perl lua-dev glib-dev pcre-dev gmime-dev
-	libevent-dev sqlite-dev libressl-dev file-dev curl-dev"
+makedepends="cmake ragel perl lua-dev glib-dev pcre-dev icu-dev
+	libevent-dev sqlite-dev libressl-dev file-dev curl-dev
+	gd-dev fann-dev"
 install="$pkgname.pre-install"
-subpackages="$pkgname-doc $pkgname-controller::noarch $pkgname-client
-	$pkgname-fuzzy::noarch $pkgname-utils::noarch"
+subpackages="$pkgname-doc $pkgname-client $pkgname-utils::noarch
+	$pkgname-controller::noarch
+	$pkgname-fuzzy::noarch
+	"
 source="https://rspamd.com/downloads/$pkgname-$pkgver.tar.xz
 	$pkgname.logrotated
 	$pkgname.initd
 	$pkgname.confd
-	config.patch
 	cmakelists.patch
+	worker.conf.in
 	"
 builddir="$srcdir/$pkgname-$pkgver"
 
+prepare() {
+	local worker
+	default_prepare || return 1
+
+	cd "$builddir"
+	for worker in normal:3 controller:4 fuzzy:5; do
+		sed -e "s/@name@/${worker%:*}/g" -e "s/@port@/${worker#*:}/g" \
+			"$srcdir"/worker.conf.in > conf/worker-${worker%:*}.conf
+	done
+	sed "$(grep -n -m1 'worker {' conf/rspamd.sysvinit.conf|cut -d: -f1),\$d" \
+		 -i conf/rspamd.sysvinit.conf && \
+		 echo '.include(glob=true) "$CONFDIR/worker-*.conf"' >> \
+		conf/rspamd.sysvinit.conf
+}
+
 build() {
 	cd "$builddir"
 	cmake CMakeLists.txt \
@@ -47,20 +65,21 @@ package() {
 	cd "$builddir"
 	make DESTDIR="$pkgdir" install || return 1
 
-	rm "$pkgdir"/etc/$pkgname/$pkgname.systemd.conf
+	rm "$pkgdir"/etc/$pkgname/$pkgname.systemd.conf || return 1
 	mv "$pkgdir"/etc/$pkgname/$pkgname.sysvinit.conf \
-		"$pkgdir"/etc/$pkgname/$pkgname.conf
+		"$pkgdir"/etc/$pkgname/$pkgname.conf || return 1
 	sed -ri -e 's~DBDIR(/rspamd.sock)~RUNDIR\1~' \
 		-e 's~rspamd_dynamic~dynamic~' \
-		"$pkgdir"/etc/$pkgname/options.inc
+		"$pkgdir"/etc/$pkgname/options.inc || return 1
 
-	mkdir -p "$pkgdir"/etc/$pkgname/local.d "$pkgdir"/etc/$pkgname/override.d
+	mkdir -p "$pkgdir"/etc/$pkgname/local.d \
+		"$pkgdir"/etc/$pkgname/override.d || return 1
 
 	install -Dm644 "$srcdir"/$pkgname.logrotated "$pkgdir"/etc/logrotate.d/$pkgname
 	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
 	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
 
-	install -dm750 -g $pkggroups "$pkgdir"/var/lib/$pkgname/dynamic
+	install -dm750 -o $pkgusers -g $pkggroups "$pkgdir"/var/lib/$pkgname/dynamic
 	install -dm750 -g $pkggroups "$pkgdir"/var/log/$pkgname
 	chown $pkgusers "$pkgdir"/var/lib/$pkgname
 
@@ -75,40 +94,47 @@ package() {
 		"$pkgdir"/usr/share/doc/$pkgname
 }
 
-controller() {
-	license="MIT"
-	depends="$pkgname"
-	pkgdesc="$pkgdesc (controller web interface)"
-	mkdir -p "$subpkgdir"/usr/share/$pkgname "$subpkgdir"/etc/$pkgname
-	mv "$pkgdir"/usr/share/$pkgname/www "$subpkgdir"/usr/share/$pkgname/
-	mv "$pkgdir"/etc/$pkgname/worker-controller.* "$subpkgdir"/etc/$pkgname
-}
-
 client() {
 	pkgdesc="$pkgdesc (console client)"
-	mkdir -p "$subpkgdir"/usr/bin
-	mv "$pkgdir"/usr/bin/rspamc-$pkgver "$subpkgdir"/usr/bin/rspamc
+	mkdir -p "$subpkgdir"/usr/bin || return 1
+	mv "$pkgdir"/usr/bin/rspamc-$pkgver \
+		"$subpkgdir"/usr/bin/rspamc
+}
+
+utils() {
+	depends="perl"
+	pkgdesc="$pkgdesc (utilities)"
+	mkdir -p "$subpkgdir"/usr/bin || return 1
+	mv "$pkgdir"/usr/bin/${pkgname}_stats \
+		"$subpkgdir"/usr/bin/${pkgname}-stats || return 1
+	mv "$pkgdir"/usr/bin/${pkgname}-redirector "$subpkgdir"/usr/bin
 }
 
 fuzzy() {
 	depends="$pkgname"
 	pkgdesc="$pkgdesc (local fuzzy storage)"
-	mkdir -p "$subpkgdir"/etc/$pkgname/modules.d
-	mv "$pkgdir"/etc/$pkgname/worker-fuzzy.* "$subpkgdir"/etc/$pkgname
-	mv "$pkgdir"/etc/$pkgname/modules.d/fuzzy_* "$subpkgdir"/etc/$pkgname/modules.d
+	mkdir -p "$subpkgdir"/etc/$pkgname/modules.d || return 1
+	mv "$pkgdir"/etc/$pkgname/worker-fuzzy.* \
+		"$subpkgdir"/etc/$pkgname || return 1
+	mv "$pkgdir"/etc/$pkgname/modules.d/fuzzy_* \
+		"$subpkgdir"/etc/$pkgname/modules.d
 }
 
-utils() {
-	depends="perl"
-	pkgdesc="$pkgdesc (utilities)"
-	mkdir -p "$subpkgdir"/usr/bin
-	mv "$pkgdir"/usr/bin/${pkgname}_stats "$subpkgdir"/usr/bin/${pkgname}-stats
-	mv "$pkgdir"/usr/bin/${pkgname}-redirector "$subpkgdir"/usr/bin
+controller() {
+	license="MIT"
+	depends="$pkgname"
+	pkgdesc="$pkgdesc (controller web interface)"
+	mkdir -p "$subpkgdir"/usr/share/$pkgname \
+		"$subpkgdir"/etc/$pkgname || return 1
+	mv "$pkgdir"/usr/share/$pkgname/www \
+		"$subpkgdir"/usr/share/$pkgname || return 1
+	mv "$pkgdir"/etc/$pkgname/worker-controller.* \
+		"$subpkgdir"/etc/$pkgname
 }
 
-sha512sums="df2260de6585699a5b6692aa210647270b7132372ae6a2437f8532265018fe4db8270a8989ce0c0664cad17cbc281ae92f935c4f0974dc2f8da309e54c234b14  rspamd-1.4.4.tar.xz
+sha512sums="b1a7342feb43757d9e3ac4f27c09b0145aa6a33c7517881fd618d7dfb8cac7f091405b90466fa46b4dcd9744a7f767c2fa6010a31a669f52c01a4dbb7b1249b9  rspamd-1.5.0.tar.xz
 2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb  rspamd.logrotated
 df37726d03e676b16d707854d95bafc9162da65c27bb150edbfc0cb00f1842188a1f2a8f1b82be5ae2a253b4f4db4d93dfe804a89feb988b5af858eb3f3458be  rspamd.initd
 e417dd825d1b4d03d115db037b2fdf2f48a35420ee7a9010d97167b6c31e88d6c0a15dd33b21d7d76856db0fdc5097c922fcdf1d8164d1e92ae377f7c5303947  rspamd.confd
-2089429e6f44f8204f31c87c565cdd7abcd51b3146397ba1b2fb23b1be6faf46fd8ec36718f194a3fc38ac1d38d7be9010a84ac4b49d7e1597706699538c607a  config.patch
-99593c10ffb04c71a4c83c7522b41f12465a9862283685bbc2fff464fd84fcf8b4bc4a892419d31332c01f805c69dd7730f537c60248b92fee35acdc6633a644  cmakelists.patch"
+99593c10ffb04c71a4c83c7522b41f12465a9862283685bbc2fff464fd84fcf8b4bc4a892419d31332c01f805c69dd7730f537c60248b92fee35acdc6633a644  cmakelists.patch
+2169a8c4b4af6df9f3bbf4addeac564c9485a9d6a30fd15cf167093488362791c003a0d03360049c43d827e7fa767c1ad3522de6699b0247b75aa049c0b51214  worker.conf.in"
diff --git a/testing/rspamd/config.patch b/testing/rspamd/config.patch
deleted file mode 100644
index 1c8b991298..0000000000
--- a/testing/rspamd/config.patch
+++ /dev/null
@@ -1,56 +0,0 @@
---- a/conf/rspamd.sysvinit.conf
-+++ b/conf/rspamd.sysvinit.conf
-@@ -32,25 +32,4 @@
-     .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/logging.inc"
- }
- 
--worker {
--    bind_socket = "*:11333";
--    .include "$CONFDIR/worker-normal.inc"
--    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-normal.inc"
--    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc"
--}
--
--worker {
--    bind_socket = "localhost:11334";
--    .include "$CONFDIR/worker-controller.inc"
--    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-controller.inc"
--    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc"
--}
--
--# Local fuzzy storage is disabled by default
--
--#worker {
--#    bind_socket = "*:11335";
--#    .include "$CONFDIR/worker-fuzzy.inc"
--#    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-fuzzy.inc"
--#    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-fuzzy.inc"
--#}
-+.include(glob=true) "$CONFDIR/worker-*.conf"
---- /dev/null
-+++ b/conf/worker-controller.conf
-@@ -0,0 +1,6 @@
-+worker {
-+    bind_socket = "localhost:11334";
-+    .include "$CONFDIR/worker-controller.inc"
-+    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-controller.inc"
-+    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc"
-+}
---- /dev/null
-+++ b/conf/worker-fuzzy.conf
-@@ -0,0 +1,6 @@
-+worker {
-+    bind_socket = "*:11335";
-+    .include "$CONFDIR/worker-fuzzy.inc"
-+    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-fuzzy.inc"
-+    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-fuzzy.inc"
-+}
---- /dev/null
-+++ b/conf/worker-normal.conf
-@@ -0,0 +1,6 @@
-+worker {
-+    bind_socket = "*:11333";
-+    .include "$CONFDIR/worker-normal.inc"
-+    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-normal.inc"
-+    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc"
-+}
diff --git a/testing/rspamd/worker.conf.in b/testing/rspamd/worker.conf.in
new file mode 100644
index 0000000000..d39c34976c
--- /dev/null
+++ b/testing/rspamd/worker.conf.in
@@ -0,0 +1,6 @@
+worker {
+    bind_socket = "localhost:1133@port@";
+    .include "$CONFDIR/worker-@name@.inc"
+    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-@name@.inc"
+    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-@name@.inc"
+}
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---