~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

[PATCH] community/rspamd [PATCH v2] update to 2.2

Duncan Bellamy <dunk@denkimushi.com>
Details
Message ID
<20200127081013.25167-1-dunk@denkimushi.com>
DKIM signature
missing
Download raw message
Patch: +41 -260
Update rspamd to version 2.2, update the dependencies and change
luajit to lua for better arm compabtility (2.x builds but segfaults on
arm if built with luajit).
Build in a seperate folder as this is the preferred way of building it.
Remove cmake options that are defaults now.
Update APKBUILD to use amove.
Seperate libs so rspamc install uses just libs and rspamc.
Remove controller and fuzzy etc sub packages as these should be controlled
in local.d and override.d and do not contain executables.
Remove cmakelists.patch as it says its a hack for solaris.
Remove conf-split-workers.patch as controller, fuzzy etc subpackages removed.
Remove lua patch as the patched file is no longer in rspamd contrib.
Remove rspamd.post-upgrade as it is for upgrading from 1.7.8 which was released
in July 2018.
---
 community/rspamd/APKBUILD                     | 114 +++++++-----------
 community/rspamd/cmakelists.patch             |  10 --
 community/rspamd/conf-split-workers.patch     |  88 --------------
 .../rspamd/lua-torch-fix-simd-detection.patch |  77 ------------
 community/rspamd/rspamd.post-upgrade          |  12 --
 5 files changed, 41 insertions(+), 260 deletions(-)
 delete mode 100644 community/rspamd/cmakelists.patch
 delete mode 100644 community/rspamd/conf-split-workers.patch
 delete mode 100644 community/rspamd/lua-torch-fix-simd-detection.patch
 delete mode 100644 community/rspamd/rspamd.post-upgrade

diff --git a/community/rspamd/APKBUILD b/community/rspamd/APKBUILD
index fede7b5315..5c9a539293 100644
--- a/community/rspamd/APKBUILD
+++ b/community/rspamd/APKBUILD
@@ -3,8 +3,9 @@
# Contributor: Nathan Angelacos <nangel@alpinelinux.org>
# Contributor: TBK <alpine@jjtc.eu>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=rspamd
pkgver=1.9.4
# Contributor: Duncan Bellamy <dunk@denkimushi.com>
pkgname="rspamd"
pkgver="2.2"
pkgrel=1
pkgdesc="Fast, free and open-source spam filtering system"
url="https://rspamd.com/"
@@ -13,73 +14,67 @@ license="Apache-2.0 BSD-1-Clause BSD-2-Clause BSD-3-Clause CC0 LGPL-2.1-or-later
	LGPL-3.0-only MIT Zlib"
pkgusers="rspamd"
pkggroups="rspamd"
makedepends="
	cmake
	curl-dev
	file-dev
	gd-dev
makedepends="cmake
	glib-dev
	icu-dev
	libevent-dev
	libmagic
	openssl-dev
	luajit-dev
	lua5.1-dev
	pcre2-dev
	perl
	libsodium-dev
	ragel
	sqlite-dev
	"
"
checkdepends="luarocks"
install="$pkgname.pre-install $pkgname.post-upgrade"
install="$pkgname.pre-install"
subpackages="
	$pkgname-doc
	$pkgname-client
	$pkgname-utils::noarch
	$pkgname-controller::noarch
	$pkgname-fuzzy::noarch
	$pkgname-proxy::noarch
	$pkgname-libs
	$pkgname-www::noarch
	$pkgname-openrc
	$pkgname-dbg
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/vstakhov/$pkgname/archive/$pkgver.tar.gz
"

source="$pkgname-$pkgver.tar.gz::https://github.com/vstakhov/rspamd/archive/$pkgver.tar.gz
	$pkgname.logrotated
	$pkgname.initd
	$pkgname.confd
	cmakelists.patch
	conf-split-workers.patch
	default-configs.patch
	lua-torch-fix-simd-detection.patch
	"
"

_cmakedir="$srcdir"/$pkgname.build

build() {
	cmake . \
	mkdir -p $_cmakedir
	cd $_cmakedir

	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCONFDIR=/etc/$pkgname \
		-DRUNDIR=/run/$pkgname \
		-DRSPAMD_USER=$pkgusers \
		-DRSPAMD_GROUP=$pkggroups \
		-DENABLE_DB=ON \
		-DENABLE_SQLITE=ON \
		-DENABLE_HIREDIS=ON \
		-DENABLE_REDIRECTOR=ON \
		-DENABLE_URL_INCLUDE=ON \
		-DENABLE_PCRE2=ON \
		-DINSTALL_EXAMPLES=OFF
		"$builddir"
	make
}

check() {
	make rspamd-test
	cd $_cmakedir
	make check
}

package() {
	cd $_cmakedir
	make DESTDIR="$pkgdir" install

	cd "$pkgdir"
	cd "$pkgdir"/usr/bin
	find -type l -delete
	for x in rspamd rspamc rspamadm; do mv $x-$pkgver $x; done
	mv "$pkgname"_stats "$pkgname"-stats

	find usr/bin -type l -delete
	mkdir -p ./usr/sbin
	mv ./usr/bin/rspamd-$pkgver ./usr/sbin/rspamd
	mv ./usr/bin/rspamadm-$pkgver ./usr/bin/rspamadm
	cd "$pkgdir"

	mkdir -p ./usr/share/doc/$pkgname
	mv ./usr/share/$pkgname/www/README.md \
@@ -104,8 +99,7 @@ client() {
	pkgdesc="$pkgdesc (console client)"

	cd "$pkgdir"
	mkdir -p "$subpkgdir"/usr/bin
	mv ./usr/bin/rspamc-$pkgver "$subpkgdir"/usr/bin/rspamc
	amove usr/bin/rspamc
}

utils() {
@@ -113,51 +107,25 @@ utils() {
	depends="perl"

	cd "$pkgdir"
	mkdir -p "$subpkgdir"/usr/bin
	mv ./usr/bin/${pkgname}_stats "$subpkgdir"/usr/bin/${pkgname}-stats
	_mv ./usr/bin/${pkgname}-redirector "$subpkgdir"/usr/bin/
	amove usr/bin/"$pkgname"-redirector usr/bin/"$pkgname"-stats
}

fuzzy() {
	pkgdesc="$pkgdesc (local fuzzy storage)"
	license="Apache-2.0"
	depends="$pkgname"
libs() {
	pkgdesc="$pkgdesc (libraries)"

	cd "$pkgdir"
	_mv ./etc/$pkgname/worker-fuzzy.* "$subpkgdir"/etc/$pkgname/
	_mv ./etc/$pkgname/modules.d/fuzzy_* "$subpkgdir"/etc/$pkgname/modules.d/
	amove usr/lib/$pkgname/*.so
}

controller() {
	pkgdesc="$pkgdesc (controller web interface)"
	license="MIT"
	depends="$pkgname"
www() {
	pkgdesc="$pkgdesc (server web interface files)"

	cd "$pkgdir"
	_mv ./usr/share/$pkgname/www "$subpkgdir"/usr/share/$pkgname/
	_mv ./etc/$pkgname/worker-controller.* "$subpkgdir"/etc/$pkgname/
}

proxy() {
	pkgdesc="$pkgdesc (milter support)"
	license="Apache-2.0"
	depends="$pkgname"

	cd "$pkgdir"
	_mv ./etc/$pkgname/worker-proxy.* "$subpkgdir"/etc/$pkgname/
}

_mv() {
	local dest; for dest; do true; done  # get last argument
	mkdir -p "$dest"
	mv "$@"
	amove usr/share/$pkgname/www
}

sha512sums="3acecec6adb91580ac2ad96419fdc9588b120ec5a3b4a44135fc5a3e7c15f2dbc99963a8337f9effb9423846489545a55d89d1849c5ba62d8cd91dc67c32d8dc  rspamd-1.9.4.tar.gz
sha512sums="e62367b9d663a005686e3eef216a7913c6050125e96582e2a58ef459e14512c1bcf09108050ff8ef524ba5e7a3c78559805353a25510654d8764f985757b32fe  rspamd-2.2.tar.gz
2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb  rspamd.logrotated
7add88e4bf3508d2a148241cd8db97851a33a7128be75f2a072a029b32b565e9de0299ad614fbda7f70ed54d1b6e2faa305eff3e443e90451abf59dedc1af576  rspamd.initd
141c845cee32384b3ca02e066f133211612c4c36740cbd7d658245a070223366325f5890d45d28bbd2fcfa3712ec460bf4de779bad2183ab8e0cf635d25e985f  rspamd.initd
a2003ef0c9d64a44480f59302864a2dfedcbe3a0047fcbb655408bc8aae9014b6ad0ddc6b64d4abeeb21bea0f86678afd30589ac8eed83e07ad7f87710e93702  rspamd.confd
accbe762e542df65e28301048672d4a0cf3a1c7e9a04c38ab3010f0ed9df9ad1122129727580408a69939f25c4dbea3b2b7aa0d452722125fac9eb0043bb2579  cmakelists.patch
a8aefee649bf6630339d1d3f2bb20c25ca70b21a8eaa92951e926d0fd4525f1d4ac4cc7ea66ac2b15323cf02c93c759ddf7181502f0d71b21384ced9d88c008e  conf-split-workers.patch
bca1b1361524e1c582f2d6f9d754766c63f60a856b9f0d858e17dfebb40f2046db3a759eb3dffc5075460c3d3b64224092e043f07bcd8331daa97babc61ea973  default-configs.patch
2987f122653680207b97a9f93978192384804f93a8fa040085e53a801c77364e8bd7ceb0fabca62a9c7316ff32bcf3dee8f0d1b8cd2c29459c6272a19e8e293b  lua-torch-fix-simd-detection.patch"
bca1b1361524e1c582f2d6f9d754766c63f60a856b9f0d858e17dfebb40f2046db3a759eb3dffc5075460c3d3b64224092e043f07bcd8331daa97babc61ea973  default-configs.patch"
diff --git a/community/rspamd/cmakelists.patch b/community/rspamd/cmakelists.patch
deleted file mode 100644
index 8b9c7fe84d..0000000000
--- a/community/rspamd/cmakelists.patch
@@ -1,10 +0,0 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -589,7 +589,6 @@
 	LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt)
 	LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl)
 	LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv)
-	LIST(APPEND CMAKE_REQUIRED_LIBRARIES nsl)
 	LIST(APPEND CMAKE_REQUIRED_LIBRARIES socket)
 	LIST(APPEND CMAKE_REQUIRED_LIBRARIES umem)
 	# Ugly hack, but FindOpenSSL on Solaris does not link with libcrypto
diff --git a/community/rspamd/conf-split-workers.patch b/community/rspamd/conf-split-workers.patch
deleted file mode 100644
index 505d2c72e0..0000000000
--- a/community/rspamd/conf-split-workers.patch
@@ -1,88 +0,0 @@
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/lua-torch-fix-simd-detection.patch b/community/rspamd/lua-torch-fix-simd-detection.patch
deleted file mode 100644
index f3df6f87de..0000000000
--- a/community/rspamd/lua-torch-fix-simd-detection.patch
@@ -1,77 +0,0 @@
--- a/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
+++ b/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
@@ -45,7 +45,7 @@
   SIMDExtension_NEON    = 0x1,
 #elif defined(__PPC64__)
   SIMDExtension_VSX     = 0x1,
-#else
+#elif defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   SIMDExtension_AVX2    = 0x1,
   SIMDExtension_AVX     = 0x2,
   SIMDExtension_SSE     = 0x4,
@@ -53,31 +53,17 @@
   SIMDExtension_DEFAULT = 0x0
 };
 
+#if (defined(__arm__) || defined(__aarch64__)) && defined(__NEON__)
 
-#if defined(__arm__) || defined(__aarch64__) // incl. armel, armhf, arm64
--
- #if defined(__NEON__)
--
 static inline uint32_t detectHostSIMDExtensions()
 {
   return SIMDExtension_NEON;
 }
 
- #else //ARM without NEON
+#elif defined(__PPC64__) && defined(__VSX__)
 
 static inline uint32_t detectHostSIMDExtensions()
 {
-  return SIMDExtension_DEFAULT;
-}
--
- #endif
--
-#elif defined(__PPC64__)
--
- #if defined(__VSX__)
--
-static inline uint32_t detectHostSIMDExtensions()
-{
   uint32_t hostSimdExts = SIMDExtension_DEFAULT;
   char *evar;
 
@@ -87,16 +73,8 @@
   return hostSimdExts;
 }
 
- #else //PPC64 without VSX
+#elif defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
 
-static inline uint32_t detectHostSIMDExtensions()
-{
-  return SIMDExtension_DEFAULT;
-}
--
- #endif
--
-#else   // x86
 static inline void cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
 {
 #if defined(_MSC_VER)
@@ -158,6 +136,13 @@
   }
 
   return hostSimdExts;
+}
+
+#else
+
+static inline uint32_t detectHostSIMDExtensions()
+{
+  return SIMDExtension_DEFAULT;
 }
 
 #endif // end SIMD extension detection code
diff --git a/community/rspamd/rspamd.post-upgrade b/community/rspamd/rspamd.post-upgrade
deleted file mode 100644
index cf3e277ddf..0000000000
--- a/community/rspamd/rspamd.post-upgrade
@@ -1,12 +0,0 @@
#!/bin/sh

ver_new="$1"
ver_old="$2"

if [ "$(apk version -t "$ver_old" '1.7.8-r1')" = '<' ]; then
	if [ "$(stat -c %U:%G /var/log/rspamd)" = 'root:rspamd' ]; then
		chown rspamd:rspamd /var/log/rspamd
	fi
fi

exit 0
-- 
2.24.1
Reply to thread Export thread (mbox)