]> git.pld-linux.org Git - packages/dspam.git/blob - dspam.spec
- pl for -webui
[packages/dspam.git] / dspam.spec
1 # TODO:
2 # - support for libdclassify
3 # - oracle driver
4 # - messages from default install of cron with mysql driver Memory fault
5 # - installing dspam and dspam-client on same host causes
6 #   /etc/dspam.conf being owned by both packages and .rpmnew files being
7 #   created. move the config to -libs? -common? patch code to use
8 #   different config for client?
9 #
10 # Conditional build:
11 %bcond_without  mysql   # disable MySQL storage driver
12 %bcond_without  pgsql   # disable PostgreSQL storage driver
13 %bcond_without  sqlite  # disable SQLite3 storage driver
14 %bcond_without  db      # disable BerkeleyDB storage driver
15 %bcond_with     mysql40 # use with mysql 4.0
16 #
17 %include        /usr/lib/rpm/macros.perl
18 Summary:        A library and Mail Delivery Agent for Bayesian spam filtering
19 Summary(pl):    Biblioteka i MDA do bayesowskiego filtrowania spamu
20 Name:           dspam
21 Version:        3.6.5
22 Release:        0.27
23 License:        GPL
24 Group:          Applications/Mail
25 Source0:        http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
26 # Source0-md5:  da4f0e00633bff49d71fde418caaf14b
27 Patch0:         %{name}-webui.patch
28 Patch1:         %{name}-config.patch
29 Patch2:         %{name}-speedup.patch
30 Source1:        %{name}.init
31 Source2:        %{name}-apache.conf
32 URL:            http://www.nuclearelephant.com/projects/dspam/
33 BuildRequires:  autoconf
34 BuildRequires:  automake
35 BuildRequires:  clamav-devel
36 %{?with_db:BuildRequires:       db-devel}
37 BuildRequires:  libtool
38 %{?with_mysql:BuildRequires:    mysql-devel}
39 BuildRequires:  openldap-devel
40 %{?with_pgsql:BuildRequires:    postgresql-devel}
41 BuildRequires:  rpm-perlprov >= 4.1-13
42 BuildRequires:  rpmbuild(macros) >= 1.268
43 BuildRequires:  sed >= 4.0
44 %{?with_sqlite:BuildRequires:   sqlite3-devel}
45 BuildRequires:  zlib-devel
46 Requires(post,preun):   /sbin/chkconfig
47 Requires:       rc-scripts
48 Buildroot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 %define         _webapps        /etc/webapps
51 %define         _webapp         %{name}
52
53 %description
54 DSPAM (as in De-Spam) is an open-source project to create a new kind
55 of anti-spam mechanism, and is currently effective as both a
56 server-side agent for UNIX email servers and a developer's library for
57 mail clients, other anti-spam tools, and similar projects requiring
58 drop-in spam filtering.
59
60 The DSPAM agent masquerades as the email server's local delivery agent
61 and filters/learns spams using an advanced Bayesian statistical
62 approach (based on Bayes's theorem of combined probabilities) which
63 provides an administratively maintenance-free, easy-learning Anti-Spam
64 service custom tailored to each individual user's behavior. Advanced
65 because on top of standard Bayesian filtering is also incorporated the
66 use of Chained Tokens, de-obfuscation, and other enhancements. DSPAM
67 works great with Sendmail and Exim, and should work well with any
68 other MTA that supports an external local delivery agent (postfix,
69 qmail, etc.)
70
71 %description -l pl
72 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
73 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
74 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
75 uniksowych serwerów pocztowych jak i biblioteka dla programistów
76 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
77 wymagaj±cych filtrowania spamu w locie.
78
79 Agent DSPAM zachowuje siê jak lokalny agent dostarczania poczty (MDA)
80 i filtruje/uczy siê spamu przy u¿yciu zaawansowanego bayesowskiego
81 przybli¿enia statystycznego (opartego na twierdzeniu Bayesa o
82 po³±czonych prawdopodobieñstwach), daj±c nie wymagaj±c± obs³ugi
83 administracyjnej, ³atwo ucz±c± siê us³ugê antyspamow± dostosowan± do
84 zachowania ka¿dego u¿ytkownika. Metoda jest zaawansowana poniewa¿ na
85 podstawie standardowego filtrowania bayesowskiego wprowadzono u¿ycie
86 tokenów ³añcuchowych, eliminowanie ukrywanie i inne rozszerzenia.
87 DSPAM dzia³a wspaniale z Sendmailem i Eximem, powinien dzia³aæ dobrze
88 z ka¿dym innym MTA obs³uguj±cym zewnêtrznego agenta MDA (postfiksem,
89 qmailem itd.).
90
91 %package client
92 Summary:        dspam client
93 Summary(pl):    Klient dspam
94 Group:          Applications/Mail
95 # to get the same dspam.conf when both installed
96 Conflicts:      dspam < %{version}-%{release}
97 Conflicts:      dspam > %{version}-%{release}
98
99 %description client
100 dspam client.
101
102 %description client -l pl
103 Klient dspam.
104
105 %package libs
106 Summary:        A library for Bayesian spam filtering
107 Summary(pl):    Biblioteka do bayesowskiego filtrowania spamu
108 Group:          Libraries
109 Requires:       %{name}-driver = %{version}-%{release}
110
111 %description libs
112 DSPAM (as in De-Spam) is an open-source project to create a new kind
113 of anti-spam mechanism, and is currently effective as both a
114 server-side agent for UNIX email servers and a developer's library for
115 mail clients, other anti-spam tools, and similar projects requiring
116 drop-in spam filtering.
117
118 This package contains the library.
119
120 %description libs -l pl
121 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
122 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
123 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
124 uniksowych serwerów pocztowych jak i biblioteka dla programistów
125 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
126 wymagaj±cych filtrowania spamu w locie.
127
128 Ten pakiet zawiera wspomnian± bibliotekê.
129
130 %package devel
131 Summary:        Header files for the DSPAM library
132 Summary(pl):    Pliki nag³ówkowe biblioteki DSPAM
133 Group:          Development/Libraries
134 Requires:       %{name}-libs = %{version}-%{release}
135
136 %description devel
137 DSPAM has had its core engine moved into a separate library, libdspam.
138 This library can be used by developers to provide 'drop-in' spam
139 filtering for their mail client applications, other anti-spam tools,
140 or similar projects.
141
142 %description devel -l pl
143 G³ówny silnik DSPAM zosta³ przeniesiony do oddzielnej biblioteki
144 libdspam, która mo¿e byæ u¿ywana przez programistów do zapewnienia
145 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
146 narzêdzi antyspamowych i podobnych projektów.
147
148 %package static
149 Summary:        Static DSPAM library
150 Summary(pl):    Statyczna biblioteka DSPAM
151 Group:          Development/Libraries
152 Requires:       %{name}-devel = %{version}-%{release}
153
154 %description static
155 Static DSPAM library.
156
157 %description static -l pl
158 Statyczna biblioteka DSPAM.
159
160 %package driver-hash
161 Summary:        HASH driver for DSPAM
162 Summary(pl):    Sterownik HASH dla DSPAM-a
163 Group:          Libraries
164 Requires(post): sed >= 4.0
165 Requires:       %{name}-libs = %{version}-%{release}
166 Provides:       %{name}-driver = %{version}-%{release}
167
168 %description driver-hash
169 HASH driver for DSPAM.
170
171 %description driver-hash -l pl
172 Sterownik HASH dla DSPAM-a.
173
174 %package driver-db
175 Summary:        DB driver for DSPAM
176 Summary(pl):    Sterownik DB dla DSPAM-a
177 Group:          Libraries
178 Requires(post): sed >= 4.0
179 Requires:       %{name}-libs = %{version}-%{release}
180 Provides:       %{name}-driver = %{version}-%{release}
181
182 %description driver-db
183 DB driver for DSPAM.
184
185 %description driver-db -l pl
186 Sterownik DB dla DSPAM-a.
187
188 %package driver-mysql
189 Summary:        MySQL driver for DSPAM
190 Summary(pl):    Sterownik MySQL dla DSPAM-a
191 Group:          Libraries
192 Requires(post): sed >= 4.0
193 Requires:       %{name}-libs = %{version}-%{release}
194 Provides:       %{name}-driver = %{version}-%{release}
195
196 %description driver-mysql
197 MySQL driver for DSPAM.
198
199 %description driver-mysql -l pl
200 Sterownik MySQL dla DSPAM-a.
201
202 %package driver-pgsql
203 Summary:        PostgreSQL driver for DSPAM
204 Summary(pl):    Sterownik PostgreSQL dla DSPAM-a
205 Group:          Libraries
206 Requires(post): sed >= 4.0
207 Requires:       %{name}-libs = %{version}-%{release}
208 Provides:       %{name}-driver = %{version}-%{release}
209
210 %description driver-pgsql
211 PostgreSQL driver for DSPAM.
212
213 %description driver-pgsql -l pl
214 Sterownik PostgreSQL dla DSPAM-a.
215
216 %package driver-sqlite
217 Summary:        SQLite driver for DSPAM
218 Summary(pl):    Sterownik SQLite dla DSPAM-a
219 Group:          Libraries
220 Requires(post): sed >= 4.0
221 Requires:       %{name}-libs = %{version}-%{release}
222 Provides:       %{name}-driver = %{version}-%{release}
223
224 %description driver-sqlite
225 SQLite driver for DSPAM.
226
227 %description driver-sqlite -l pl
228 Sterownik SQLite dla DSPAM-a.
229
230 %package webui
231 Summary:        DSPAM Web UI
232 Summary(pl):    Interfejs WWW do programu DSPAM
233 Group:          Applications/WWW
234 Requires:       webapps
235 # needs dspam binary
236 Requires:       %{name} = %{version}-%{release}
237
238 %description webui
239 The Web UI (CGI client) can be run from any executable location on a
240 web server, and detects its user's identity from the REMOTE_USER
241 environment variable. This means you'll need to use HTTP password
242 authentication to access the CGI (Any type of authentication will
243 work, so long as Apache supports the module). This is also convenient
244 in that you can set up authentication using almost any existing system
245 you have. The only catch is that you'll need the usernames to match
246 the actual DSPAM usernames used the system. A copy of the shadow
247 password file will suffice for most common installs.
248
249 %description webui -l pl
250 Interfejs u¿ytkownika WWW (klient CGI) mo¿e byæ uruchamiany z
251 dowolnego wykonywalnego miejsca na serwerze WWW i rozpoznaje to¿samo¶æ
252 u¿ytkownika ze zmiennej ¶rodowiskowej REMOTE_USER. Oznacza to, ¿e
253 trzeba u¿yæ uwietrzytelnienia HTTP z has³em do dostêpu do CGI (dzia³aæ
254 bêdzie dowolny rodzaj uwierzytelnienia obs³ugiwany przez modu³y
255 Apache'a). Jest to o tyle wygodne, ¿e mo¿na skonfigurowaæ
256 uwierzytelnianie dla prawie ka¿dego istniej±cego systemu. Jedynym
257 wymogiem jest, ¿eby nazwy u¿ytkowników pokrywa³y siê z nazwami
258 u¿ytkowników DSPAM-a u¿ywanymi w systemie. Kopia pliku shadow
259 wystarczy dla wiêkszo¶ci popularnych instalacji.
260
261 %prep
262 %setup -q
263 %patch0 -p1
264 %patch1 -p1
265 %patch2 -p1
266 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
267 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
268 sed -i -e 's,/usr/local/dspam/bin,/usr/bin,' ./scripts/train.pl
269
270 %build
271 %{__libtoolize}
272 %{__aclocal} -I m4
273 %{__autoconf}
274 %{__automake}
275
276 DRIVERS="
277 hash_drv
278 %{?with_db:libdb4_drv}
279 %{?with_mysql:mysql_drv}
280 %{?with_pgsql:pgsql_drv}
281 %{?with_sqlite:sqlite_drv}
282 "
283 %configure \
284         --disable-dependency-tracking \
285         %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
286         --enable-trusted-user-security \
287         --enable-bias \
288         --enable-large-scale \
289         --with-userdir=/var/lib/%{name} \
290         --with-userdir-owner=none \
291         --with-userdir-group=none \
292         --with-dspam-home=/var/lib/%{name} \
293         --with-dspam-home-owner=none \
294         --with-dspam-home-group=none \
295         --with-dspam-owner=none \
296         --with-dspam-group=none \
297         --with-signature-life=14 \
298         --enable-ldap \
299         --enable-clamav \
300         --enable-preferences-extension \
301         --enable-long-usernames \
302         --enable-neural-networking \
303         --enable-virtual-users \
304         --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
305 %if %{with mysql}
306         --with-mysql-includes=%{_includedir}/mysql \
307         --with-mysql-libraries=%{_libdir} \
308 %endif
309 %if %{with pgsql}
310         --with-pgsql-includes=%{_includedir}/postgresql \
311         --with-pgsql-libraries=%{_libdir} \
312 %endif
313 %if %{with sqlite}
314         --with-sqlite3-includes=%{_includedir} \
315         --with-sqlite3-libraries=%{_libdir} \
316 %endif
317         --enable-daemon
318
319 # --enable-dclassify-extension needs libdclassify
320
321 %{__make}
322
323 %install
324 rm -rf $RPM_BUILD_ROOT
325 install -d $RPM_BUILD_ROOT{/var/run/dspam,/etc/{rc.d/init.d,sysconfig}} \
326         $RPM_BUILD_ROOT/var/lib/%{name}/{txt,data}
327
328 %{__make} install \
329         DESTDIR=$RPM_BUILD_ROOT
330
331 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
332
333 cp -a txt/*.txt $RPM_BUILD_ROOT/var/lib/%{name}/txt
334
335 # install devel files
336 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
337 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
338
339 # provide maintenance scripts
340 install -d $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
341 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
342 #!/bin/sh
343 exec %{_bindir}/%{name}_clean -s -p
344 EOF
345
346 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
347
348 # fix prefix
349 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
350
351 # fix purge stuff
352 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
353
354 %if %{with mysql}
355 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
356 _UNCONFIGURED_
357
358 Note!
359
360 This file can only contain 5 lines with the following values:
361
362 HOSTNAME
363 PORT
364 USERNAME
365 PASSWORD
366 DATABASE
367 EOF
368 %endif
369
370 %if %{with pgsql}
371 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
372 _UNCONFIGURED_
373
374 Note!
375
376 This file can only contain 5 lines with the following values:
377
378 HOSTNAME
379 PORT
380 USERNAME
381 PASSWORD
382 DATABASE
383 EOF
384 %endif
385
386 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
387 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
388 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
389 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
390
391 %post
392 /sbin/chkconfig --add dspam
393 %service dspam restart "dspam daemon"
394
395 %preun
396 if [ "$1" = "0" ]; then
397         %service dspam stop
398         /sbin/chkconfig --del dspam
399 fi
400
401 %clean
402 rm -rf $RPM_BUILD_ROOT
403
404 %post   libs -p /sbin/ldconfig
405 %postun libs -p /sbin/ldconfig
406
407 %post driver-db
408 if [ "$1" = "1" ]; then
409         sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
410 fi
411
412 %post driver-hash
413 if [ "$1" = "1" ]; then
414         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
415 fi
416
417 %post driver-mysql
418 if [ "$1" = "1" ]; then
419         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
420 fi
421
422 %post driver-pgsql
423 if [ "$1" = "1" ]; then
424         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
425 fi
426
427 %post driver-sqlite
428 if [ "$1" = "1" ]; then
429         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
430 fi
431
432 %triggerin webui -- apache1
433 %webapp_register apache %{_webapp}
434
435 %triggerun webui -- apache1
436 %webapp_unregister apache %{_webapp}
437
438 %triggerin webui -- apache < 2.2.0, apache-base
439 %webapp_register httpd %{_webapp}
440
441 %triggerun webui -- apache < 2.2.0, apache-base
442 %webapp_unregister httpd %{_webapp}
443
444 %files
445 %defattr(644,root,root,755)
446 %doc README CHANGELOG RELEASE.NOTES UPGRADING
447 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
448 %doc scripts/train.pl
449 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
450 %dir %attr(775,root,mail) /var/run/dspam
451 %dir %attr(750,root,mail) /var/lib/%{name}
452 %dir %attr(770,root,mail) /var/lib/%{name}/data
453 %dir /var/lib/%{name}/txt
454 %config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/txt/*.txt
455 %dir %attr(770,root,mail) /var/log/dspam
456 %attr(754,root,root) /etc/rc.d/init.d/dspam
457 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
458 %attr(755,root,root) %{_bindir}/%{name}
459 %attr(755,root,root) %{_bindir}/%{name}_logrotate
460 %attr(755,root,root) %{_bindir}/%{name}_clean
461 %attr(755,root,root) %{_bindir}/%{name}_corpus
462 %attr(755,root,root) %{_bindir}/%{name}_crc
463 %attr(755,root,root) %{_bindir}/%{name}_dump
464 %attr(755,root,root) %{_bindir}/%{name}_genaliases
465 %attr(755,root,root) %{_bindir}/%{name}_stats
466 %attr(755,root,root) %{_bindir}/%{name}_merge
467 %attr(755,root,root) %{_bindir}/%{name}_2sql
468 %attr(755,root,root) %{_bindir}/%{name}_admin
469 %attr(755,root,root) %{_bindir}/%{name}_train
470 %{_mandir}/man?/%{name}*
471
472 %files client
473 %defattr(644,root,root,755)
474 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
475 %attr(755,root,root) %{_bindir}/%{name}c
476
477 %files libs
478 %defattr(644,root,root,755)
479 %doc README CHANGELOG
480 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
481 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
482
483 %files devel
484 %defattr(644,root,root,755)
485 %attr(755,root,root) %{_libdir}/lib*.so
486 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
487 %{_libdir}/lib*.la
488 %{_includedir}/%{name}
489 %{_mandir}/man3/libdspam*
490 %{_pkgconfigdir}/*.pc
491
492 %files static
493 %defattr(644,root,root,755)
494 %{_libdir}/lib*.a
495
496 %files driver-hash
497 %defattr(644,root,root,755)
498 %attr(755,root,root) %{_bindir}/css*
499 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
500
501 %if %{with db}
502 %files driver-db
503 %defattr(644,root,root,755)
504 %attr(755,root,root) %{_libdir}/libdb4_drv*.so*
505 %endif
506
507 %if %{with mysql}
508 %files driver-mysql
509 %defattr(644,root,root,755)
510 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
511 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
512 %attr(755,root,root) %{_libdir}/libmysql_drv*.so*
513 %endif
514
515 %if %{with pgsql}
516 %files driver-pgsql
517 %defattr(644,root,root,755)
518 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
519 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
520 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
521 %attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
522 %endif
523
524 %if %{with sqlite}
525 %files driver-sqlite
526 %defattr(644,root,root,755)
527 %doc doc/sqlite_drv.txt
528 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
529 %endif
530
531 %files webui
532 %defattr(644,root,root,755)
533 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
534 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
535 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
536 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
537 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
538 %attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
539 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
540
541 %dir %{_datadir}/dspam
542 %dir %{_datadir}/dspam/cgi
543 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
544 %{_datadir}/dspam/cgi/templates
545 %{_datadir}/dspam/htdocs
This page took 0.088238 seconds and 4 git commands to generate.