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