diff --git a/.bogofilter.metadata b/.bogofilter.metadata index 40e3601..61b3810 100644 --- a/.bogofilter.metadata +++ b/.bogofilter.metadata @@ -1 +1 @@ -c779c3afb3e57ae0208ee503a854aff716b0cafd SOURCES/bogofilter-1.2.5.tar.xz +c779c3afb3e57ae0208ee503a854aff716b0cafd SOURCES/bogofilter-1.2.5.tar.xz diff --git a/SPECS/bogofilter.spec b/SPECS/bogofilter.spec index a838d2a..3173af1 100644 --- a/SPECS/bogofilter.spec +++ b/SPECS/bogofilter.spec @@ -1,25 +1,45 @@ +%global with_libdb_migration 1 +%global libdb_migration_build_dir libdb_migration_build +%{!?with_system_gsl: %global with_system_gsl (%{undefined rhel} || 0%{?rhel} < 10)} + Summary: Fast anti-spam filtering by Bayesian statistical analysis Name: bogofilter Version: 1.2.5 -Release: 8%{?dist} -License: GPLv2 +Release: 16%{?dist} +License: GPL-2.0-only URL: http://bogofilter.sourceforge.net/ Source0: http://downloads.sourceforge.net/bogofilter/bogofilter-%{version}.tar.xz BuildRequires: gcc -BuildRequires: flex libdb-devel gsl-devel +BuildRequires: flex +BuildRequires: pkgconfig(sqlite3) BuildRequires: /usr/bin/iconv +BuildRequires: /usr/bin/xmlto BuildRequires: perl-generators BuildRequires: make -BuildRequires: xhtml1-dtds + +%if %{with_system_gsl} +BuildRequires: gsl-devel +%else +Provides: bundled(gsl) = 1.4 +%endif + +%if %{with_libdb_migration} +BuildRequires: libdb-devel-static +%endif %description Bogofilter is a Bayesian spam filter. In its normal mode of operation, it takes an email message or other text on standard input, does a statistical check against lists of "good" and "bad" words, and returns a status code indicating whether or not the message is spam. -Bogofilter is designed with fast algorithms (including Berkeley DB system), -coded directly in C, and tuned for speed, so it can be used for production -by sites that process a lot of mail. +Bogofilter is designed with fast algorithms, coded directly in C, and +tuned for speed, so it can be used for production by sites that process +a lot of mail. + +%if %{with_libdb_migration} +The current version switched from Berkeley DB to SQLite format. To migrate +to the new format run: bogomigrate-berkeley wordlist.db +%endif %package bogoupgrade Summary: Upgrades bogofilter database to current version @@ -40,9 +60,38 @@ iconv -f iso-8859-1 -t utf-8 \ %{__mv} -f doc/bogofilter-faq-fr.html.utf8 \ doc/bogofilter-faq-fr.html +%if %{with_libdb_migration} +# make a copy of the sources for the build with the libdb backend +%{__mkdir} ../%{libdb_migration_build_dir} +%{__cp} -r * ../%{libdb_migration_build_dir}/ +%{__mv} ../%{libdb_migration_build_dir} . +%endif + %build -%configure --disable-rpath +%configure --disable-rpath \ + --with-database=sqlite3 \ +%if !%{with_system_gsl} + --with-included-gsl=yes \ +%endif + %{nil} + +%{__make} %{?_smp_mflags} + +%if %{with_libdb_migration} +pushd %{libdb_migration_build_dir} +STATIC_DB= +BF_ZAP_LIBDB= +if [ -e /usr/lib64/libdb-5.3.a ]; then + STATIC_DB='/usr/lib64/libdb-5.3.a -lpthread' + BF_ZAP_LIBDB=zap +elif [ -e /usr/lib/libdb-5.3.a ]; then + STATIC_DB='/usr/lib/libdb-5.3.a -lpthread' + BF_ZAP_LIBDB=zap +fi +%configure --disable-rpath --with-database=db BF_ZAP_LIBDB=${BF_ZAP_LIBDB} STATIC_DB="${STATIC_DB}" LIBS="${LIBS} ${STATIC_DB}" %{__make} %{?_smp_mflags} +popd +%endif %install %{__make} DESTDIR=%{buildroot} install @@ -55,24 +104,40 @@ iconv -f iso-8859-1 -t utf-8 \ %{__install} -m644 doc/*.html rpm-doc/html/ %{__chmod} -x contrib/* - -for d in contrib ; do - install -d %{buildroot}%{_docdir}/%{name}/$d - files=$(find "$d" -maxdepth 1 -type f -print) - for f in $files ; do - case $f in - *.c|*.o|*.obj|*/Makefile*) continue ;; - *.1) - cp -p $f %{buildroot}%{_mandir}/man1 ;; - *) - cp -p $f %{buildroot}%{_docdir}/%{name}/$d ;; - esac - done -done - -mv bogogrep* contrib - -find %{buildroot}%{_docdir}/%{name} -name .dirstamp -print -delete +%{__rm} -v contrib/bogogrep.o +%{__rm} -rfv contrib/.deps + +%if %{with_libdb_migration} +pushd %{libdb_migration_build_dir} +%{__cp} -f src/bogoutil %{buildroot}/%{_bindir}/bogoutil-berkeley + +cat >> %{buildroot}%{_bindir}/bogomigrate-berkeley << FOE +#!/bin/bash + +if [ "\${1}" = "" ] || [ "\${1}" = "--help" ]; then + echo "Migrate Bogofilter Berkeley database into the current format." + echo "Expects one argument, the file name to migrate." + echo "Usage: bogomigrate-berkeley wordlist.db" + exit 1; +fi + +if [ -e "\${1}" ]; then + bogoutil-berkeley -d "\${1}" > "\${1}.txt.migrate" && \\ + bogoutil -I "\${1}.txt.migrate" -l "\${1}.migrated" && \\ + rm "\${1}.txt.migrate" && \\ + mv "\${1}" "\${1}.berkeley.bak" && \\ + mv "\${1}.migrated" "\${1}" && \\ + echo "Successfully migrated '\${1}' with \`bogoutil -d "\${1}" | wc -l\` entries." && \\ + echo "Backup of the original file is stored as '\${1}.berkeley.bak'." +else + echo "File '\${1}' does not exist" 1>&2 +fi +FOE + +%{__chmod} a+x %{buildroot}%{_bindir}/bogomigrate-berkeley + +popd +%endif %check %{__make} %{?_smp_mflags} check @@ -82,29 +147,53 @@ find %{buildroot}%{_docdir}/%{name} -name .dirstamp -print -delete %{_mandir}/man1/bogoupgrade* %files -%doc AUTHORS COPYING GETTING.STARTED NEWS README* RELEASE.NOTES* TODO bogofilter.cf.example +%doc AUTHORS COPYING NEWS README* RELEASE.NOTES* TODO bogofilter.cf.example %doc doc/bogofilter-SA* doc/bogofilter-tuning.HOWTO* doc/integrating* doc/programmer/ -%doc doc/README.*db -%doc rpm-doc/html/ rpm-doc/xml/ +%doc rpm-doc/html/ rpm-doc/xml/ contrib %{_mandir}/man1/bogo*.1* %{_mandir}/man1/bf_*.1* %config(noreplace) %{_sysconfdir}/bogofilter.cf %{_bindir}/bogo* %{_bindir}/bf_* -%{_docdir}/%{name}/contrib/* %exclude %{_bindir}/bogoupgrade %exclude %{_mandir}/man1/bogoupgrade* %changelog -* Mon Aug 09 2021 Mohan Boddu - 1.2.5-8 -- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Related: rhbz#1991688 +* Sat Jan 04 2025 Arkady L. Shane - 1.2.5-16 +- Rebuilt for MSVSphere 10 + +* Wed Jul 17 2024 Fedora Release Engineering - 1.2.5-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue Jan 23 2024 Fedora Release Engineering - 1.2.5-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 1.2.5-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Nov 22 2023 Milan Crha - 1.2.5-13 +- Resolves: #1788486 (Switch to SQLite database engine) + +* Wed Jul 19 2023 Fedora Release Engineering - 1.2.5-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jan 18 2023 Fedora Release Engineering - 1.2.5-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Tue Aug 23 2022 Mamoru TASAKA - 1.2.5-10 +- Rebuild for gsl-2.7.1 + +* Wed Jul 20 2022 Fedora Release Engineering - 1.2.5-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu May 12 2022 Adrian Reber - 1.2.5-8 +- Removed unnecessary files from contrib/ (#1950963) -* Tue Apr 20 2021 Milan Crha - 1.2.5-7 -- Resolves: #1950909 (Change what files are installed) +* Wed Jan 19 2022 Fedora Release Engineering - 1.2.5-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild -* Thu Apr 15 2021 Mohan Boddu - 1.2.5-6 -- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 +* Wed Jul 21 2021 Fedora Release Engineering - 1.2.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Tue Jan 26 2021 Fedora Release Engineering - 1.2.5-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild