aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-07-24 00:10:09 +0200
committerJakub Jirutka <jakub@jirutka.cz>2018-07-24 00:26:46 +0200
commit923d74cddf80cae995cd91671868dbaaf3ce76ed (patch)
tree5302209564387b9e8b773050f7c8b989785c053a
parent96a193dd858707527d61dc551bd4c6afede370b4 (diff)
downloadaports-923d74cddf80cae995cd91671868dbaaf3ce76ed.tar.gz
aports-923d74cddf80cae995cd91671868dbaaf3ce76ed.tar.bz2
aports-923d74cddf80cae995cd91671868dbaaf3ce76ed.tar.xz
community/rspamd: fix broken rspamd.conf
This is a good example why modifications of upstream configs have to be done in explicit way using patch file instead of using sed. Upstream changed the config, sed silently "failed" (no match) and no one noticed.
-rw-r--r--community/rspamd/APKBUILD17
-rw-r--r--community/rspamd/conf-split-workers.patch88
-rw-r--r--community/rspamd/worker.conf.in6
3 files changed, 91 insertions, 20 deletions
diff --git a/community/rspamd/APKBUILD b/community/rspamd/APKBUILD
index 16f8e308ca..7f99a27deb 100644
--- a/community/rspamd/APKBUILD
+++ b/community/rspamd/APKBUILD
@@ -4,7 +4,7 @@
# Contributor: TBK <alpine@jjtc.eu>
pkgname=rspamd
pkgver=1.7.6
-pkgrel=0
+pkgrel=1
pkgdesc="Fast, free and open-source spam filtering system"
url="https://rspamd.com"
arch="x86_64 x86 armhf ppc64le"
@@ -25,24 +25,13 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/vstakhov/$pkgname/archive/$p
$pkgname.initd
$pkgname.confd
cmakelists.patch
- worker.conf.in
+ conf-split-workers.patch
"
prepare() {
- local worker
default_prepare
cd "$builddir"
- for worker in proxy:2 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 -ri -e 's/worker /&"rspamd_proxy" /' \
- conf/worker-proxy.conf
- sed "$(grep -n -m1 'worker {' conf/rspamd.conf|cut -d: -f1),\$d" \
- -i conf/rspamd.conf && \
- echo '.include(glob=true) "$CONFDIR/worker-*.conf"' >> \
- conf/rspamd.conf
sed -ri -e 's~DBDIR(/rspamd.sock)~RUNDIR\1~' \
-e 's~rspamd_dynamic~dynamic~' \
conf/options.inc
@@ -150,4 +139,4 @@ sha512sums="5177d034b6c8d73e4b2d71023ef81ee3b9517856e50839858b12c3bed71b0154abea
df37726d03e676b16d707854d95bafc9162da65c27bb150edbfc0cb00f1842188a1f2a8f1b82be5ae2a253b4f4db4d93dfe804a89feb988b5af858eb3f3458be rspamd.initd
e417dd825d1b4d03d115db037b2fdf2f48a35420ee7a9010d97167b6c31e88d6c0a15dd33b21d7d76856db0fdc5097c922fcdf1d8164d1e92ae377f7c5303947 rspamd.confd
fa0e14d507cd7421a20916506c03e6e6c95fb2f38736e69540ee3e066da883c2ee4cb779ee8787756e4a1831ff8f04150ce592d4d6df08d8a18d55f3c6de4646 cmakelists.patch
-2169a8c4b4af6df9f3bbf4addeac564c9485a9d6a30fd15cf167093488362791c003a0d03360049c43d827e7fa767c1ad3522de6699b0247b75aa049c0b51214 worker.conf.in"
+a8aefee649bf6630339d1d3f2bb20c25ca70b21a8eaa92951e926d0fd4525f1d4ac4cc7ea66ac2b15323cf02c93c759ddf7181502f0d71b21384ced9d88c008e conf-split-workers.patch"
diff --git a/community/rspamd/conf-split-workers.patch b/community/rspamd/conf-split-workers.patch
new file mode 100644
index 0000000000..505d2c72e0
--- /dev/null
+++ b/community/rspamd/conf-split-workers.patch
@@ -0,0 +1,88 @@
+Since we split workers into subpackages, we have to split the main config
+that defines workers to be loaded.
+
+NOTE: This is intentionally done in patch file instead of modifying the config
+with sed and generating the worker configs to avoid silent breakages when
+upgrading the aport!
+
+--- a/conf/rspamd.conf
++++ b/conf/rspamd.conf
+@@ -35,33 +35,4 @@
+ .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/logging.inc"
+ }
+
+-worker "normal" {
+- bind_socket = "localhost: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 "controller" {
+- 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"
+-}
+-
+-worker "rspamd_proxy" {
+- bind_socket = "localhost:11332";
+- .include "$CONFDIR/worker-proxy.inc"
+- .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-proxy.inc"
+- .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-proxy.inc"
+-}
+-
+-# Local fuzzy storage is disabled by default
+-
+-worker "fuzzy" {
+- bind_socket = "localhost:11335";
+- count = -1; # Disable by default
+- .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-normal.conf
+@@ -0,0 +1,8 @@
++# Included from top-level .conf file
++
++worker "normal" {
++ bind_socket = "localhost: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"
++}
+--- /dev/null
++++ b/conf/worker-controller.conf
+@@ -0,0 +1,8 @@
++# Included from top-level .conf file
++
++worker "controller" {
++ 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-proxy.conf
+@@ -0,0 +1,8 @@
++# Included from top-level .conf file
++
++worker "rspamd_proxy" {
++ bind_socket = "localhost:11332";
++ .include "$CONFDIR/worker-proxy.inc"
++ .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-proxy.inc"
++ .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-proxy.inc"
++}
+--- /dev/null
++++ b/conf/worker-fuzzy.conf
+@@ -0,0 +1,8 @@
++# Included from top-level .conf file
++
++worker "fuzzy" {
++ bind_socket = "localhost: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"
++}
diff --git a/community/rspamd/worker.conf.in b/community/rspamd/worker.conf.in
deleted file mode 100644
index d39c34976c..0000000000
--- a/community/rspamd/worker.conf.in
+++ /dev/null
@@ -1,6 +0,0 @@
-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"
-}