]> git.pld-linux.org Git - packages/dspam.git/blobdiff - dspam.spec
- up to 3.6.8; DB driver no longer available
[packages/dspam.git] / dspam.spec
index c4cf44a105c2a6d2b061ac7e4f4b0021aa659a18..07d11c22bc88c8fa17b1b29abffdbb63faac968e 100644 (file)
@@ -1,37 +1,53 @@
-# TODO: everything
+# TODO:
+# - support for libdclassify
+# - oracle driver
+# - messages from default install of cron with mysql driver Memory fault
+# - installing dspam and dspam-client on same host causes
+#   /etc/dspam.conf being owned by both packages and .rpmnew files being
+#   created. move the config to -libs? -common? patch code to use
+#   different config for client?
 #
 # Conditional build:
-%bcond_with    mysql   # enable MySQL storage driver (disable sqlite driver)
-%bcond_with    pgsql   # enable PostgreSQL storage driver (disable sqlite driver)
-%bcond_with    sqlite3 # enable SQLite3 storage driver (disable sqlite2 driver)
+%bcond_without mysql   # disable MySQL storage driver
+%bcond_without pgsql   # disable PostgreSQL storage driver
+%bcond_without sqlite  # disable SQLite3 storage driver
+%bcond_with    mysql40 # use with mysql 4.0
 #
+%include       /usr/lib/rpm/macros.perl
 Summary:       A library and Mail Delivery Agent for Bayesian spam filtering
 Summary(pl):   Biblioteka i MDA do bayesowskiego filtrowania spamu
 Name:          dspam
-Version:       3.4.8
+Version:       3.6.8
 Release:       0.1
 License:       GPL
 Group:         Applications/Mail
 Source0:       http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
-# Source0-md5: b6930c31fe0940b8ad6d27324f8bab3e
+# Source0-md5: c4b1a7079690ee16d8b0f36b2a2a90a4
+Patch0:                %{name}-webui.patch
+Patch1:                %{name}-config.patch
+Patch2:                %{name}-speedup.patch
+Source1:       %{name}.init
+Source2:       %{name}-apache.conf
 URL:           http://www.nuclearelephant.com/projects/dspam/
-%if %{with mysql}
-BuildRequires: mysql-devel
-%else
-%if %{with pgsql}
-BuildRequires: postgresql-devel
-%else
-%if %{with sqlite3}
-BuildRequires: sqlite3-devel
-%else
-BuildRequires: sqlite-devel
-BuildRequires: sqlite-static
-%endif
-%endif
-%endif
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: clamav-devel
+BuildRequires: libtool
+%{?with_mysql:BuildRequires:   mysql-devel}
+BuildRequires: openldap-devel
+%{?with_pgsql:BuildRequires:   postgresql-devel}
+BuildRequires: rpm-perlprov >= 4.1-13
+BuildRequires: rpmbuild(macros) >= 1.268
 BuildRequires: sed >= 4.0
+%{?with_sqlite:BuildRequires:  sqlite3-devel}
+BuildRequires: zlib-devel
+Requires(post,preun):  /sbin/chkconfig
+Requires:      rc-scripts
 Buildroot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define                _webapps        /etc/webapps
+%define                _webapp         %{name}
+
 %description
 DSPAM (as in De-Spam) is an open-source project to create a new kind
 of anti-spam mechanism, and is currently effective as both a
@@ -70,10 +86,25 @@ DSPAM dzia
 z ka¿dym innym MTA obs³uguj±cym zewnêtrznego agenta MDA (postfiksem,
 qmailem itd.).
 
+%package client
+Summary:       dspam client
+Summary(pl):   Klient dspam
+Group:         Applications/Mail
+# to get the same dspam.conf when both installed
+Conflicts:     dspam < %{version}-%{release}
+Conflicts:     dspam > %{version}-%{release}
+
+%description client
+dspam client.
+
+%description client -l pl
+Klient dspam.
+
 %package libs
 Summary:       A library for Bayesian spam filtering
 Summary(pl):   Biblioteka do bayesowskiego filtrowania spamu
 Group:         Libraries
+Requires:      %{name}-driver = %{version}-%{release}
 
 %description libs
 DSPAM (as in De-Spam) is an open-source project to create a new kind
@@ -124,66 +155,172 @@ Static DSPAM library.
 %description static -l pl
 Statyczna biblioteka DSPAM.
 
+%package driver-hash
+Summary:       HASH driver for DSPAM
+Summary(pl):   Sterownik HASH dla DSPAM-a
+Group:         Libraries
+Requires(post):        sed >= 4.0
+Requires:      %{name}-libs = %{version}-%{release}
+Provides:      %{name}-driver = %{version}-%{release}
+
+%description driver-hash
+HASH driver for DSPAM.
+
+%description driver-hash -l pl
+Sterownik HASH dla DSPAM-a.
+
+%package driver-mysql
+Summary:       MySQL driver for DSPAM
+Summary(pl):   Sterownik MySQL dla DSPAM-a
+Group:         Libraries
+Requires(post):        sed >= 4.0
+Requires:      %{name}-libs = %{version}-%{release}
+Provides:      %{name}-driver = %{version}-%{release}
+
+%description driver-mysql
+MySQL driver for DSPAM.
+
+%description driver-mysql -l pl
+Sterownik MySQL dla DSPAM-a.
+
+%package driver-pgsql
+Summary:       PostgreSQL driver for DSPAM
+Summary(pl):   Sterownik PostgreSQL dla DSPAM-a
+Group:         Libraries
+Requires(post):        sed >= 4.0
+Requires:      %{name}-libs = %{version}-%{release}
+Provides:      %{name}-driver = %{version}-%{release}
+
+%description driver-pgsql
+PostgreSQL driver for DSPAM.
+
+%description driver-pgsql -l pl
+Sterownik PostgreSQL dla DSPAM-a.
+
+%package driver-sqlite
+Summary:       SQLite driver for DSPAM
+Summary(pl):   Sterownik SQLite dla DSPAM-a
+Group:         Libraries
+Requires(post):        sed >= 4.0
+Requires:      %{name}-libs = %{version}-%{release}
+Provides:      %{name}-driver = %{version}-%{release}
+
+%description driver-sqlite
+SQLite driver for DSPAM.
+
+%description driver-sqlite -l pl
+Sterownik SQLite dla DSPAM-a.
+
+%package webui
+Summary:       DSPAM Web UI
+Summary(pl):   Interfejs WWW do programu DSPAM
+Group:         Applications/WWW
+Requires:      webapps
+# needs dspam binary
+Requires:      %{name} = %{version}-%{release}
+
+%description webui
+The Web UI (CGI client) can be run from any executable location on a
+web server, and detects its user's identity from the REMOTE_USER
+environment variable. This means you'll need to use HTTP password
+authentication to access the CGI (Any type of authentication will
+work, so long as Apache supports the module). This is also convenient
+in that you can set up authentication using almost any existing system
+you have. The only catch is that you'll need the usernames to match
+the actual DSPAM usernames used the system. A copy of the shadow
+password file will suffice for most common installs.
+
+%description webui -l pl
+Interfejs u¿ytkownika WWW (klient CGI) mo¿e byæ uruchamiany z
+dowolnego wykonywalnego miejsca na serwerze WWW i rozpoznaje to¿samo¶æ
+u¿ytkownika ze zmiennej ¶rodowiskowej REMOTE_USER. Oznacza to, ¿e
+trzeba u¿yæ uwietrzytelnienia HTTP z has³em do dostêpu do CGI (dzia³aæ
+bêdzie dowolny rodzaj uwierzytelnienia obs³ugiwany przez modu³y
+Apache'a). Jest to o tyle wygodne, ¿e mo¿na skonfigurowaæ
+uwierzytelnianie dla prawie ka¿dego istniej±cego systemu. Jedynym
+wymogiem jest, ¿eby nazwy u¿ytkowników pokrywa³y siê z nazwami
+u¿ytkowników DSPAM-a u¿ywanymi w systemie. Kopia pliku shadow
+wystarczy dla wiêkszo¶ci popularnych instalacji.
+
 %prep
 %setup -q
-sed -i -e 's#-static##g' src/tools/Makefile*
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
+%{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
+sed -i -e 's,/usr/local/dspam/bin,/usr/bin,' ./scripts/train.pl
 
 %build
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__automake}
+
+DRIVERS="
+hash_drv
+%{?with_mysql:mysql_drv}
+%{?with_pgsql:pgsql_drv}
+%{?with_sqlite:sqlite_drv}
+"
 %configure \
+       --disable-dependency-tracking \
+       %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
        --enable-trusted-user-security \
-       --enable-bayesian-dobly \
-       --enable-chained-tokens \
-       --enable-experimental \
        --enable-bias \
        --enable-large-scale \
-       --enable-delivery-to-stdout \
        --with-userdir=/var/lib/%{name} \
-       --with-dspam-home=/var/lib/%{name} \
        --with-userdir-owner=none \
        --with-userdir-group=none \
+       --with-dspam-home=/var/lib/%{name} \
+       --with-dspam-home-owner=none \
+       --with-dspam-home-group=none \
        --with-dspam-owner=none \
        --with-dspam-group=none \
        --with-signature-life=14 \
-       --disable-dependency-tracking \
-%if %{with mysql}
+       --enable-ldap \
+       --enable-clamav \
+       --enable-preferences-extension \
+       --enable-long-usernames \
+       --enable-neural-networking \
        --enable-virtual-users \
-       --with-storage-driver=mysql_drv \
+       --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
+%if %{with mysql}
        --with-mysql-includes=%{_includedir}/mysql \
-       --with-mysql-libraries=%{_libdir}
-%else
+       --with-mysql-libraries=%{_libdir} \
+%endif
 %if %{with pgsql}
-       --enable-virtual-users \
-       --with-storage-driver=pgsql_drv \
        --with-pgsql-includes=%{_includedir}/postgresql \
-       --with-pgsql-libraries=%{_libdir}
-%else
-%if %{with sqlite3}
-       --with-storage-driver=sqlite3_drv \
-       --with-sqlite3-includes=%{_includedir} \
-       --with-sqlite3-libraries=%{_libdir}
-%else
-       --with-storage-driver=sqlite_drv \
-       --with-sqlite-includes=%{_includedir} \
-       --with-sqlite-libraries=%{_libdir}
-%endif
+       --with-pgsql-libraries=%{_libdir} \
 %endif
+%if %{with sqlite}
+       --with-sqlite3-includes=%{_includedir} \
+       --with-sqlite3-libraries=%{_libdir} \
 %endif
+       --enable-daemon
+
+# --enable-dclassify-extension needs libdclassify
+
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{/var/run/dspam,/etc/{rc.d/init.d,sysconfig}} \
+       $RPM_BUILD_ROOT/var/lib/%{name}/{txt,data}
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
+
+cp -a txt/*.txt $RPM_BUILD_ROOT/var/lib/%{name}/txt
+
 # install devel files
-install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/lib/%{name}}
+install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
 
 # provide maintenance scripts
-install -d $RPM_BUILD_ROOT/etc/cron.daily
-install -d $RPM_BUILD_ROOT/etc/cron.weekly
-
+install -d $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
 #!/bin/sh
 exec %{_bindir}/%{name}_clean -s -p
@@ -191,16 +328,10 @@ EOF
 
 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
 
-# fix prefix
-sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
-sed -i -e "s|%{_prefix}/local|%{_prefix}|g" cgi/dspam.cgi
-
 # fix purge stuff
 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
 
 %if %{with mysql}
-# fix missing file
-install -d $RPM_BUILD_ROOT/var/lib/%{name}
 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
 _UNCONFIGURED_
 
@@ -217,8 +348,6 @@ EOF
 %endif
 
 %if %{with pgsql}
-# fix missing file
-install -d $RPM_BUILD_ROOT/var/lib/%{name}
 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
 _UNCONFIGURED_
 
@@ -234,55 +363,100 @@ DATABASE
 EOF
 %endif
 
+install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
+install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
+install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
+touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
+
+%post
+/sbin/chkconfig --add dspam
+%service dspam restart "dspam daemon"
+
+%preun
+if [ "$1" = "0" ]; then
+       %service dspam stop
+       /sbin/chkconfig --del dspam
+fi
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post  libs -p /sbin/ldconfig
 %postun        libs -p /sbin/ldconfig
 
+%post driver-hash
+if [ "$1" = "1" ]; then
+       sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
+fi
+
+%post driver-mysql
+if [ "$1" = "1" ]; then
+       sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
+fi
+
+%post driver-pgsql
+if [ "$1" = "1" ]; then
+       sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
+fi
+
+%post driver-sqlite
+if [ "$1" = "1" ]; then
+       sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
+fi
+
+%triggerin webui -- apache1
+%webapp_register apache %{_webapp}
+
+%triggerun webui -- apache1
+%webapp_unregister apache %{_webapp}
+
+%triggerin webui -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun webui -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
 %files
 %defattr(644,root,root,755)
 %doc README CHANGELOG RELEASE.NOTES UPGRADING
-%doc cgi/base.css cgi/dspam.cgi
-%if %{with mysql}
-%doc doc/mysql_drv.txt
-%doc src/tools.mysql_drv/*.sql
-%endif
-%if %{with pgsql}
-%doc doc/pgsql_drv.txt
-%doc src/tools.pgsql_drv/*.sql
-%endif
-%if %{!with mysql} && %{!with pgsql}
-%doc doc/sqlite_drv.txt
-%endif
+%doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
+%doc scripts/train.pl
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
+%dir %attr(775,root,mail) /var/run/dspam
 %dir %attr(750,root,mail) /var/lib/%{name}
-%{?with_mysql:%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data}
-%{?with_pgsql:%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data}
+%dir %attr(770,root,mail) /var/lib/%{name}/data
+%dir /var/lib/%{name}/txt
+%config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/txt/*.txt
+%dir %attr(770,root,mail) /var/log/dspam
+%attr(754,root,root) /etc/rc.d/init.d/dspam
 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
-%attr(755,root,mail) %{_bindir}/%{name}
-%attr(755,root,mail) %{_bindir}/%{name}c
-%attr(755,root,mail) %{_bindir}/%{name}_logrotate
+%attr(755,root,root) %{_bindir}/%{name}
+%attr(755,root,root) %{_bindir}/%{name}_logrotate
 %attr(755,root,root) %{_bindir}/%{name}_clean
-%attr(755,root,root) %{_bindir}/%{name}_corpus
 %attr(755,root,root) %{_bindir}/%{name}_crc
 %attr(755,root,root) %{_bindir}/%{name}_dump
-%attr(755,root,root) %{_bindir}/%{name}_genaliases
 %attr(755,root,root) %{_bindir}/%{name}_stats
 %attr(755,root,root) %{_bindir}/%{name}_merge
 %attr(755,root,root) %{_bindir}/%{name}_2sql
 %attr(755,root,root) %{_bindir}/%{name}_admin
-%{?with_pgsql:%attr(755,root,root) %{_bindir}/%{name}_pg2int8}
+%attr(755,root,root) %{_bindir}/%{name}_train
 %{_mandir}/man?/%{name}*
 
+%files client
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
+%attr(755,root,root) %{_bindir}/%{name}c
+
 %files libs
 %defattr(644,root,root,755)
 %doc README CHANGELOG
 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
+%attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
 
 %files devel
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/lib*.so
+%attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
 %{_libdir}/lib*.la
 %{_includedir}/%{name}
 %{_mandir}/man3/libdspam*
@@ -291,3 +465,48 @@ rm -rf $RPM_BUILD_ROOT
 %files static
 %defattr(644,root,root,755)
 %{_libdir}/lib*.a
+
+%files driver-hash
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/css*
+%attr(755,root,root) %{_libdir}/libhash_drv*.so*
+
+%if %{with mysql}
+%files driver-mysql
+%defattr(644,root,root,755)
+%doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
+%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
+%attr(755,root,root) %{_libdir}/libmysql_drv*.so*
+%endif
+
+%if %{with pgsql}
+%files driver-pgsql
+%defattr(644,root,root,755)
+%doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
+%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
+%attr(755,root,root) %{_bindir}/%{name}_pg2int8
+%attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
+%endif
+
+%if %{with sqlite}
+%files driver-sqlite
+%defattr(644,root,root,755)
+%doc doc/sqlite_drv.txt
+%attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
+%endif
+
+%files webui
+%defattr(644,root,root,755)
+%dir %attr(750,root,http) %{_webapps}/%{_webapp}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
+%attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
+%config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
+
+%dir %{_datadir}/dspam
+%dir %{_datadir}/dspam/cgi
+%attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
+%{_datadir}/dspam/cgi/templates
+%{_datadir}/dspam/htdocs
This page took 0.065374 seconds and 4 git commands to generate.