rspamd: remove dedicated EL6 package source. A common one will be used for further builds

This commit is contained in:
Raven 2024-02-28 09:54:43 +06:00
parent 6205ad8301
commit a491ba841a
6 changed files with 0 additions and 554 deletions

View File

@ -1 +0,0 @@
enable rspamd.service

View File

@ -1,34 +0,0 @@
diff -Naur a/src/rspamd.h b/src/rspamd.h
--- a/src/rspamd.h 2023-11-14 21:01:02.000000000 +0600
+++ b/src/rspamd.h 2023-11-20 21:25:47.323505357 +0600
@@ -52,6 +52,11 @@
#define CR '\r'
#define LF '\n'
+#if defined __USE_ISOC11 && !defined __cplusplus
+# undef static_assert
+# define static_assert _Static_assert
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff -Naur a/contrib/xxhash/xxhash.h b/contrib/xxhash/xxhash.h
--- a/contrib/xxhash/xxhash.h 2023-11-14 21:01:02.000000000 +0600
+++ b/contrib/xxhash/xxhash.h 2023-11-28 16:40:07.976183701 +0600
@@ -1545,14 +1545,7 @@
/* note: use after variable declarations */
#ifndef XXH_STATIC_ASSERT
-# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
-# include <assert.h>
-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
-# elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */
-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
-# else
-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0)
-# endif
+# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0)
# define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
#endif

View File

@ -1,48 +0,0 @@
diff -Naur a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
--- a/src/libmime/mime_parser.c 2023-11-14 21:01:02.000000000 +0600
+++ b/src/libmime/mime_parser.c 2023-11-20 20:58:07.268062153 +0600
@@ -172,7 +172,7 @@
if (!rspamd_multipattern_compile(lib_ctx->mp_boundary, &err)) {
msg_err("fatal error: cannot compile multipattern for mime parser boundaries: %e", err);
g_error_free(err);
- g_abort();
+ abort();
}
ottery_rand_bytes(lib_ctx->hkey, sizeof(lib_ctx->hkey));
}
diff -Naur a/src/libserver/symcache/symcache_c.cxx b/src/libserver/symcache/symcache_c.cxx
--- a/src/libserver/symcache/symcache_c.cxx 2023-11-14 21:01:02.000000000 +0600
+++ b/src/libserver/symcache/symcache_c.cxx 2023-11-20 20:58:31.247890159 +0600
@@ -625,7 +625,7 @@
"subsystem %s (%s)",
static_item->symbol.c_str(), static_item->id,
real_dyn_item->async_events, subsystem, loc);
- g_abort();
+ abort();
g_assert_not_reached();
}
diff -Naur a/src/libserver/symcache/symcache_impl.cxx b/src/libserver/symcache/symcache_impl.cxx
--- a/src/libserver/symcache/symcache_impl.cxx 2023-11-14 21:01:02.000000000 +0600
+++ b/src/libserver/symcache/symcache_impl.cxx 2023-11-20 20:58:50.097754960 +0600
@@ -193,7 +193,7 @@
msg_err_cache(
"cannot register delayed condition for %s: virtual parent; qed",
delayed_cond.sym.c_str());
- g_abort();
+ abort();
}
msg_debug_cache("added a condition to the symbol %s", it->symbol.c_str());
diff -Naur a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c
--- a/src/libutil/mem_pool.c 2023-11-14 21:01:02.000000000 +0600
+++ b/src/libutil/mem_pool.c 2023-11-20 20:59:11.258603185 +0600
@@ -568,7 +568,7 @@
g_error("alloc_array: overflow %" G_GSIZE_FORMAT " * %" G_GSIZE_FORMAT "",
nmemb, size);
- g_abort();
+ abort();
}
return memory_pool_alloc_common(pool, size * nmemb, alignment, RSPAMD_MEMPOOL_NORMAL, loc);
}

View File

@ -1,142 +0,0 @@
#!/bin/sh
#
# rspamd - this script starts and stops the rspamd daemon
### BEGIN INIT INFO
# Provides: rspamd
# Required-Start: $remote_fs $network
# Required-Stop: $network $remote_fs
# Default-Start: 5
# Default-Stop:
# Short-Description: Rspamd daemon
# Description: Rspamd spam filtering daemon process
### END INIT INFO
#
# chkconfig: - 85 15
# description: rspamd is a spam filtering system
# processname: rspamd
# config: /etc/rspamd/rspamd.conf
# config: /etc/sysconfig/rspamd
# pidfile: /var/run/rspamd/rspamd.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
rspamd="/usr/bin/rspamd"
rspamadm="/usr/bin/rspamadm"
prog=$(basename $rspamd)
RSPAMD_CONF_FILE="/etc/rspamd/rspamd.conf"
RSPAMD_USER="_rspamd"
RSPAMD_GROUP="_rspamd"
[ -f /etc/sysconfig/rspamd ] && . /etc/sysconfig/rspamd
lockfile=/var/lock/subsys/rspamd
start() {
[ -x $rspamd ] || exit 5
[ -f $rspamd_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $rspamd -c $RSPAMD_CONF_FILE -u $RSPAMD_USER -g $RSPAMD_GROUP
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -TERM
retval=$?
if [ $retval -eq 0 ]; then
if [ "$CONSOLETYPE" != "serial" ]; then
echo -en "\\033[16G"
fi
STOPTIMEOUT=30
while [ $STOPTIMEOUT -gt 0 ]; do
rh_status_q || break
sleep 1
let STOPTIMEOUT=${STOPTIMEOUT}-1
done
if [ $STOPTIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to stop Rspamd. Forcefully stop the remaining processes."
killproc $prog -KILL
# Sleep forever after SIGKILL being sent (e.g. UNINT SLEEP)
while rh_status_q
do
sleep 1
echo -n $"."
done
fi
rm -f $lockfile
fi
echo
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $rspamd -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$rspamadm configtest -c $RSPAMD_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac

View File

@ -1,11 +0,0 @@
/var/log/rspamd/*log {
daily
rotate 10
missingok
notifempty
compress
sharedscripts
postrotate
systemctl --signal=USR1 --kill-who=main kill rspamd.service 2>/dev/null || :
endscript
}

View File

@ -1,318 +0,0 @@
%bcond_without luajit
%bcond_without fasttext
%if 0%{?rhel} < 8
%global dts devtoolset-11
%else
%global dts gcc-toolset-13
%endif
%if 0%{?rhel} == 7
%global _cmake %cmake3 -B %{_target_platform} -S .
%global _cmake_cmd %__cmake3
%global _cmake_build %__cmake3 --build "%{_target_platform}" %{?_smp_mflags} --verbose
%global _cmake_install DESTDIR="%{buildroot}" %__cmake3 --install %{_target_platform}
%else
%global _cmake %cmake
%global _cmake_cmd %__cmake
%global _cmake_build %cmake_build
%global _cmake_install %cmake_install
%undefine __cmake_in_source_build
%endif
Name: rspamd
Conflicts: rspamd-asan
Provides: rspamd
Version: 3.7.5
Release: 1%{?dist}
Summary: Rapid spam filtering system
Group: System Environment/Daemons
License: Apache-2.0
URL: https://rspamd.com
Source0: https://github.com/rspamd/rspamd/archive/%{version}/rspamd-%{version}.tar.gz
Source1: %{name}.logrotate
Source2: 80-rspamd.preset
Source3: %{name}.init
%if %{with luajit}
Source4: LuaJIT-2.1.ROLLING.tar.gz
%endif
# https://github.com/rspamd/fastText.git
Source5: fasttext.tar.gz
%if 0%{?rhel} == 6
# revert usage of g_abort() back to abort()
Patch0: rspamd-get-rid-of-g_abort.patch
# backport from glibc-headers-2.28
Patch1: rspamd-define-static_assert.patch
%endif
%if 0%{?rhel} == 7
BuildRequires: cmake3 >= 3.12
%else
BuildRequires: cmake >= 3.12
%endif
BuildRequires: ninja-build
%if 0%{?rhel} >= 7
BuildRequires: %{dts}-gcc %{dts}-gcc-c++ %{dts}-annobin-plugin-gcc %{dts}-runtime
%else
BuildRequires: gcc-c++ >= 11.0
%endif
BuildRequires: libunwind-devel
BuildRequires: binutils-devel
BuildRequires: file-devel
BuildRequires: lapack-devel
BuildRequires: pkgconfig(icu-i18n)
BuildRequires: pkgconfig(libsodium)
%ifarch x86_64
BuildRequires: hyperscan-devel
BuildRequires: jemalloc-devel
%endif
%if %{without luajit}
BuildRequires: lua-devel
%endif
%if 0%{?rhel} == 6
BuildRequires: rx-glib2-devel
%else
BuildRequires: glib2-devel
%endif
BuildRequires: openblas-devel
%if 0%{?rhel} >= 9
BuildRequires: openssl-devel
%else
BuildRequires: openssl3-devel
%endif
BuildRequires: pcre2-devel
BuildRequires: ragel
BuildRequires: sqlite-devel
Requires(pre): shadow-utils
%if 0%{?rhel} >= 7
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires: rx-glib2
Requires(post): chkconfig
Requires(preun): chkconfig, initscripts
Requires(postun): initscripts
%endif
%description
Rspamd is a rapid, modular and lightweight spam filter. It is designed to work
with big amount of mail and can be easily extended with own filters written in
lua.
%prep
%autosetup -p1 -n %{name}-%{version}
%if %{with luajit}
pushd %{_builddir}
tar -xf %{SOURCE4}
popd
%endif
%if %{with fasttext}
pushd %{_builddir}
tar -xf %{SOURCE5}
popd
%endif
%build
%if 0%{?rhel} >= 7
source /opt/rh/%{dts}/enable
%endif
%if %{with luajit}
pushd %{_builddir}/LuaJIT-2.1.ROLLING
make clean
make %{?_smp_mflags} CC="gcc -fPIC" PREFIX=%{_builddir}/luajit-build
make install PREFIX=%{_builddir}/luajit-build
popd
rm -f %{_builddir}/luajit-build/lib/*.so || true
%endif
%if %{with fasttext}
pushd %{_builddir}/fasttext
%if 0%{?rhel} > 7
sed 's/-pthread/-fPIC -pthread/' -i CMakeLists.txt
%endif
%_cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=%{_builddir}/fasttext-bin
%_cmake_build
%_cmake_cmd --install %{_vpath_builddir}
popd
%endif
%if 0%{?rhel} == 6
export LDFLAGS="$LDFLAGS -L/opt/rx/lib -Wl,-rpath=/opt/rx/lib"
%endif
%if %{with fasttext}
export LDFLAGS="$LDFLAGS -Wl,-rpath=%{_libdir}/rspamd/fasttext"
%endif
%_cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_LTO=ON \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCONFDIR=%{_sysconfdir}/rspamd \
-DMANDIR=%{_mandir} \
-DDBDIR=%{_localstatedir}/lib/rspamd \
-DRUNDIR=%{_localstatedir}/run/rspamd \
-DLOGDIR=%{_localstatedir}/log/rspamd \
-DEXAMPLESDIR=%{_datadir}/examples/rspamd \
-DSHAREDIR=%{_datadir}/rspamd \
-DLIBDIR=%{_libdir}/rspamd/ \
-DINCLUDEDIR=%{_includedir} \
-DRSPAMD_GROUP=_rspamd \
-DRSPAMD_USER=_rspamd \
-DENABLE_PCRE2=ON \
%if 0%{?rhel} < 7
-DWANT_SYSTEMD_UNITS=OFF \
-DDISABLE_PTHREAD_MUTEX=1 \
%else
-DWANT_SYSTEMD_UNITS=ON \
-DSYSTEMDDIR=%{_unitdir} \
%endif
-DNO_SHARED=ON \
-DDEBIAN_BUILD=1 \
-DENABLE_LIBUNWIND=ON \
-DENABLE_LIBCXX=AUTO \
%ifarch x86_64 aarch64
-DENABLE_HYPERSCAN=ON \
%endif
%ifarch x86_64
-DENABLE_JEMALLOC=ON \
%endif
%if %{with luajit}
-DENABLE_LUAJIT=ON \
-DLUA_ROOT=%{_builddir}/luajit-build \
%else
-DENABLE_LUAJIT=OFF \
%endif
%if %{with fasttext}
-DENABLE_FASTTEXT=ON \
-DFASTTEXT_ROOT_DIR=%{_builddir}/fasttext-bin \
%endif
-DENABLE_BLAS=ON
%_cmake_build
%install
%_cmake_install
%if %{with fasttext}
mkdir -p %{buildroot}%{_libdir}/rspamd/fasttext
cp %{_builddir}/fasttext-bin/lib/libfasttext.so.0 %{buildroot}%{_libdir}/rspamd/fasttext/
%endif
%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/rspamd
%if 0%{?rhel} >= 7
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_presetdir}/80-rspamd.preset
%endif
%{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/log/rspamd
%{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/lib/rspamd
%{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/rspamd/local.d/
%{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/rspamd/override.d/
%if 0%{?rhel} < 7
%{__install} -p -D -m 0755 %{SOURCE3} %{buildroot}%{_initrddir}/%{name}
%{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/run/rspamd
%endif
%clean
rm -rf %{buildroot}
%pre
%{_sbindir}/groupadd -r _rspamd 2>/dev/null || :
%{_sbindir}/useradd -g _rspamd -c "Rspamd user" -s /bin/false -r -d %{_localstatedir}/lib/rspamd _rspamd 2>/dev/null || :
%post
%{__chown} -R _rspamd:_rspamd %{_localstatedir}/lib/rspamd
%{__chown} _rspamd:_rspamd %{_localstatedir}/log/rspamd
%if 0%{?rhel} < 7
/sbin/chkconfig --add %{name}
%else
systemctl --no-reload preset rspamd.service >/dev/null 2>&1 || :
%endif
%preun
%if 0%{?rhel} < 7
if [ $1 = 0 ]; then
/sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
%else
%systemd_preun rspamd.service
%endif
%postun
%if 0%{?rhel} < 7
if [ $1 -ge 1 ]; then
/sbin/service %{name} condrestart > /dev/null 2>&1 || :
fi
%else
%systemd_postun_with_restart rspamd.service
%endif
%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE.md
%doc AUTHORS.md README.md CONTRIBUTING.md
%dir %{_sysconfdir}/rspamd
%config(noreplace) %{_sysconfdir}/rspamd/*
%{_bindir}/rspamd
%{_bindir}/rspamd_stats
%{_bindir}/rspamc
%{_bindir}/rspamadm
%if 0%{?rhel} < 7
%{_initrddir}/%{name}
%{_localstatedir}/run/%{name}
%else
%{_unitdir}/rspamd.service
%{_presetdir}/80-rspamd.preset
%endif
%dir %{_libdir}/rspamd
%{_libdir}/rspamd/*
%{_mandir}/man8/rspamd.*
%{_mandir}/man1/rspamc.*
%{_mandir}/man1/rspamadm.*
%dir %{_datadir}/rspamd
%{_datadir}/rspamd/*
%config(noreplace) %{_sysconfdir}/logrotate.d/rspamd
%attr(-, _rspamd, _rspamd) %dir %{_localstatedir}/lib/rspamd
%dir %{_localstatedir}/log/rspamd
%changelog
* Thu Dec 21 2023 Raven <raven@sysadmins.ws> - 3.7.5-1
- update to 3.7.5
* Mon Nov 20 2023 Raven <raven@sysadmins.ws> - 3.7.4-1
- update to 3.7.4
* Tue Oct 3 2023 Raven <raven@sysadmins.ws> - 3.6-1
- initial build