]> TLD Linux GIT Repositories - packages/spamassassin.git/blob - spamassassin.spec
- updated to 3.4.4, removed obsolete sought rules
[packages/spamassassin.git] / spamassassin.spec
1 # TODO
2 # - build lib{,ssl}spamc.so (if there is a point)
3 # - sa-check_spamd into nagios-plugin-check_spamd subpackage
4 #
5 # Conditional build:
6 %bcond_without  tests           # do not perform "make test"
7
8 %define         pdir    Mail
9 %define         pnam    SpamAssassin
10 %define         sa_version %(printf %d.%03d%03d $(echo %{version} | tr '.' ' '))
11 Summary:        A spam filter for email which can be invoked from mail delivery agents
12 Summary(pl.UTF-8):      Filtr antyspamowy, przeznaczony dla programów dostarczających pocztę (MDA)
13 Name:           spamassassin
14 Version:        3.4.4
15 Release:        1
16 License:        Apache v2.0
17 Group:          Applications/Mail
18 Source0:        http://ftp.man.poznan.pl/pub/apache//spamassassin/source/%{pdir}-%{pnam}-%{version}.tar.bz2
19 # Source0-md5:  ce51fe5665d5838c56db6712846b58bb
20 Source1:        %{name}.sysconfig
21 Source2:        %{name}-spamd.init
22 Source3:        %{name}-default.rc
23 Source4:        %{name}-spamc.rc
24 Source5:        sa-update.sh
25 Source6:        sa-update.cron
26 Source7:        spamassassin-official.conf
27 Patch0:         bug_771408_perl_version
28 Patch1:         config-dir.patch
29 URL:            http://spamassassin.apache.org/
30 BuildRequires:  openssl-devel >= 0.9.7d
31 BuildRequires:  perl(ExtUtils::MakeMaker) >= 6.16
32 BuildRequires:  perl-Archive-Tar
33 BuildRequires:  perl-DBI
34 BuildRequires:  perl-DB_File
35 BuildRequires:  perl-Digest-SHA1 >= 2.10
36 BuildRequires:  perl-HTML-Parser >= 3
37 BuildRequires:  perl-IO-Socket-INET6 >= 2.51
38 BuildRequires:  perl-IO-Socket-SSL
39 BuildRequires:  perl-IO-Zlib
40 BuildRequires:  perl-IP-Country
41 BuildRequires:  perl-Mail-SPF-Query
42 BuildRequires:  perl-Net-DNS >= 0.65-3
43 BuildRequires:  perl-Net-Ident
44 BuildRequires:  perl-NetAddr-IP >= 4.000
45 #BuildRequires: perl-Razor2
46 BuildRequires:  perl-devel >= 1:5.8.0
47 BuildRequires:  perl-libwww
48 BuildRequires:  re2c
49 BuildRequires:  rpm-perlprov >= 4.1-13
50 BuildRequires:  rpmbuild(macros) >= 1.453
51 %if %{with tests}
52 # are these really needed?
53 #BuildRequires: perl-Compress-Zlib
54 BuildRequires:  perl-Encode-Detect
55 BuildRequires:  perl-MIME-Base64
56 BuildRequires:  perl-MIME-tools
57 BuildRequires:  perl-Mail-DKIM
58 BuildRequires:  perl-Mail-DomainKeys
59 BuildRequires:  perl-Mail-SPF
60 BuildRequires:  perl-MailTools
61 BuildRequires:  perl-Razor > 2.61
62 %endif
63 Requires:       perl-Mail-SpamAssassin = %{version}-%{release}
64 Obsoletes:      SpamAssassin
65 Obsoletes:      spamassassin-tools
66 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
67
68 %define         _noautoreq      'perl(Razor2::Client::Agent)' 'perl(Razor::Agent)' 'perl(Razor::Client)' 'perl(DBI)' 'perl(Net::Ident)'
69
70 %description
71 Apache SpamAssassin provides you with a way to reduce if not
72 completely eliminate Unsolicited Commercial Email (SPAM) from your
73 incoming email. It can be invoked by a MDA such as sendmail or
74 postfix, or can be called from a procmail script, .forward file, etc.
75 It uses a genetic-algorithm evolved scoring system to identify
76 messages which look spammy, then adds headers to the message so they
77 can be filtered by the user's mail reading software. This distribution
78 includes the spamd/spamc components which create a server that
79 considerably speeds processing of mail.
80
81 To enable spamassassin, if you are receiving mail locally, simply add
82 this line to your ~/.procmailrc:
83 INCLUDERC=/etc/spamassassin/spamassassin-default.rc
84
85 To filter spam for all users, add that line to /etc/procmailrc
86 (creating if necessary).
87
88 %description -l pl.UTF-8
89 Apache SpamAssassin daje możliwość zredukowania, jeśli nie kompletnego
90 wyeliminowania niezamawianej komercyjnej poczty (Unsolicited
91 Commercial Email, spamu) z poczty. Może być wywoływany z MDA, np.
92 Sendmaila czy Postfiksa, lub z pliku ~/.forward itp. Używa ogólnego
93 algorytmu oceniania w celu identyfikacji wiadomości, które wyglądają
94 na SPAM, po czym dodaje nagłówki do wiadomości, umożliwiając
95 filtrowanie przez oprogramowanie użytkownika. Ta dystrybucja zawiera
96 programy spamd/spamc, umożliwiające uruchomienie serwera, co znacznie
97 przyspieszy proces przetwarzania poczty.
98
99 Aby uruchomić spamassassina dla lokalnie przychodzącej poczty,
100 wystarczy dodać do własnego ~/.procmailrc linię:
101 INCLUDERC=/etc/spamassassin/spamassassin-default.rc
102
103 Aby filtrować spam dla wszystkich użytkowników, należy dodać tę linię
104 do pliku /etc/procmailrc (tworząc go w razie potrzeby).
105
106 %package spamd
107 Summary:        spamd - daemonized version of spamassassin
108 Summary(pl.UTF-8):      spamd - spamassassin w postaci demona
109 Group:          Applications/Mail
110 Requires(post,preun):   /sbin/chkconfig
111 Requires:       perl-Mail-SpamAssassin = %{version}-%{release}
112 Requires:       rc-scripts
113 Suggests:       perl-Apache-Test
114 Suggests:       perl-IO-Socket-IP
115 Suggests:       perl-IO-Socket-SSL
116 Suggests:       perl-IO-Socket-INET6
117 Suggests:       perl-Net-Ident
118
119 %description spamd
120 The purpose of this program is to provide a daemonized version of the
121 spamassassin executable. The goal is improving throughput performance
122 for automated mail checking.
123
124 This is intended to be used alongside "spamc", a fast, low-overhead C
125 client program.
126
127 %description spamd -l pl.UTF-8
128 Spamd jest "demoniczną" wersją spamassassina. Jego zadaniem jest
129 poprawa wydajności automatycznego sprawdzania poczty.
130
131 Spamd powinien być używany wespół ze "spamc", który jest szybkim i
132 wydajnym programem klienckim.
133
134 %package spamc
135 Summary:        spamc - client for spamd
136 Summary(pl.UTF-8):      spamc - klient dla spamd
137 Group:          Applications/Mail
138 Suggests:       perl-Compress-Zlib
139
140 %description spamc
141 Spamc is the client half of the spamc/spamd pair. It should be used in
142 place of "spamassassin" in scripts to process mail. It will read the
143 mail from STDIN, and spool it to its connection to spamd, then read
144 the result back and print it to STDOUT. Spamc has extremely low
145 overhead in loading, so it should be much faster to load than the
146 whole spamassassin program.
147
148 To enable spamassassin, if you are receiving mail locally, simply add
149 this line to your ~/.procmailrc:
150 INCLUDERC=/etc/spamassassin/spamassassin-spamc.rc
151
152 To filter spam for all users, add that line to /etc/procmailrc
153 (creating if necessary).
154
155 %description spamc -l pl.UTF-8
156 Spamc powinien być używany zamiast "spamassassina" w skryptach
157 przetwarzających pocztę. Zczytuje pocztę ze STDIN, kolejkuje ją a
158 następnie przekazuje spamdowi, odczytuje wynik i podaje go na STDOUT.
159 Spamc stara się nie obciążać zbytnio procesora podczas ładowania,
160 dzięki czemu powinien działać szybciej niż sam spamassassin.
161
162 Aby uruchomić spamassassina dla lokalnie przychodzącej poczty,
163 wystarczy dodać do własnego ~/.procmailrc linię:
164 INCLUDERC=/etc/spamassassin/spamassassin-spamc.rc
165
166 Aby filtrować spam dla wszystkich użytkowników, należy dodać tę linię
167 do pliku /etc/procmailrc (tworząc go w razie potrzeby).
168
169 %package compile
170 Summary:        sa-compile - compile SpamAssassin ruleset into native code
171 Summary(pl.UTF-8):      sa-compile - kompilowanie reguł SpamAssasina do kodu natywnego
172 Group:          Applications/Mail
173 Requires:       gcc
174 Requires:       glibc-devel
175 Requires:       make
176 Requires:       perl(ExtUtils::MakeMaker)
177 Requires:       perl-Mail-SpamAssassin = %{version}-%{release}
178 Requires:       perl-devel
179 Requires:       re2c >= 0.10
180
181 %description compile
182 sa-compile uses "re2c" to compile the SpamAssassin ruleset. This is
183 then used by the "Mail::SpamAssassin::Plugin::Rule2XSBody" plugin to
184 speed up SpamAssassin's operation, where possible, and when that
185 plugin is loaded.
186
187 %description compile -l pl.UTF-8
188 sa-compile wykorzystuje re2c do kompilacji reguł SpamAssassina. Służy
189 to do przyspieszenia operacji SpamAssassina w miarę możliwości, kiedy
190 ta wtyczka jest wczytana.
191
192 %package update
193 Summary:        sa-update - automate SpamAssassin rule updates
194 Summary(pl.UTF-8):      sa-update - automatyczne uaktualnianie regułek SpamAssassina
195 Group:          Applications/Mail
196 Requires:       cronjobs
197 Requires:       gnupg
198 Requires:       perl-Archive-Tar
199 Requires:       perl-Mail-SpamAssassin = %{version}-%{release}
200 Requires:       perl-libwww
201
202 %description update
203 sa-update automates the process of downloading and installing new
204 rules and configuration, based on channels. The default channel is
205 updates.spamassassin.org, which has updated rules since the previous
206 release.
207
208 Update archives are verified by default using SHA1 hashes and GPG
209 signatures.
210
211 %description update -l pl.UTF-8
212 sa-update automatyzuje proces ściągania i instalowania nowych regułek
213 i konfiguracji w oparciu o kanały. Domyślny kanał to
214 updates.spamassassin.org, który ma uaktualnione regułki od czasu
215 poprzedniego wydania.
216
217 Archiwa uaktualnień są sprawdzane domyślnie przy użyciu skrótów SHA1 i
218 podpisów GPG.
219
220 %package -n perl-Mail-SpamAssassin
221 Summary:        Mail::SpamAssassin - SpamAssassin e-mail filter libraries
222 Summary(pl.UTF-8):      Mail::SpamAssassin - biblioteki filtra poczty SpamAssassin
223 Group:          Development/Languages/Perl
224 Requires:       perl-HTML-Parser >= 3
225 # what for this one?
226 #Requires:      perl-Sys-Hostname-Long
227 Suggests:       Razor
228 Suggests:       perl-Cache-DB_File >= 0.2
229 Suggests:       perl-DBD-mysql
230 Suggests:       perl-Encode-Detect
231 Suggests:       perl-Geo-IP
232 Suggests:       perl-IO-Socket-INET6 >= 2.51
233 Suggests:       perl-IP-Country
234 Suggests:       perl-Mail-DKIM
235 #Suggests:      perl-Mail-DomainKeys
236 #Suggests:      perl-Mail-SPF
237 Suggests:       perl-Mail-SPF-Query
238 Suggests:       perl-Net-DNS >= 0.34
239 Suggests:       perl-Net-Patricia
240 Suggests:       spamassassin-compile
241 Suggests:       spamassassin-plugin-fuzzyocr
242 Suggests:       spamassassin-update
243
244 %description -n perl-Mail-SpamAssassin
245 Mail::SpamAssassin is a Mail::Audit plugin to identify spam using text
246 analysis and several internet-based realtime blacklists. Using its
247 rule base, it uses a wide range of heuristic tests on mail headers and
248 body text to identify ``spam'', also known as unsolicited commercial
249 email. Once identified, the mail can then be optionally tagged as spam
250 for later filtering using the user's own mail user-agent application.
251
252 %description -n perl-Mail-SpamAssassin -l pl.UTF-8
253 Mail::SpamAssassin jest pluginem dla Mail::Audit, służącym do
254 identyfikacji spamu przy użyciu analizy zawartości i/lub internetowych
255 czarnych list. Do zidentyfikowania jako ,,spam'' stosuje szeroki
256 zakres testów heurystycznych na nagłówkach i treści, posiłkując się
257 stworzoną wcześniej bazą reguł. Po zidentyfikowaniu, poczta może być
258 oznaczona jako spam w celu późniejszego wyfiltrowania, np. przy użyciu
259 aplikacji do czytania poczty.
260
261 %prep
262 %setup -q -n %{pdir}-%{pnam}-%{version}
263 %patch0 -p1
264 %patch1 -p1
265
266 # disable broken test
267 %{__mv} t/sa_compile.t{,.disabled}
268
269 # this test needs network, does not work on builders
270 %{__mv} t/dnsbl_subtests.t{,.disabled}
271
272 # temporary disable problematic tests
273 %{__mv} t/trust_path.t{,.disabled}
274 %{__mv} t/urilocalbl_geoip.t{,.disabled}
275
276 %build
277 # for spamc/configure
278 export CFLAGS="%{rpmcflags}"
279 %{__perl} Makefile.PL \
280         INSTALLDIRS=vendor \
281         PREFIX=%{_prefix} \
282         SYSCONFDIR=%{_sysconfdir} \
283         CONFDIR=%{_sysconfdir}/spamassassin \
284         DATADIR=%{_datadir}/spamassassin \
285         ENABLE_SSL=yes \
286         CONTACT_ADDRESS="postmaster@localhost" \
287         PERL_BIN=%{__perl} < /dev/null
288
289 %{__make} \
290         CC="%{__cc}" \
291         OPTIMIZE="%{rpmcflags}"
292
293 %{?with_tests:%{__make} -j1 TEST_VERBOSE=1 test}
294
295 %install
296 rm -rf $RPM_BUILD_ROOT
297 install -d $RPM_BUILD_ROOT{/etc/{cron.d,sysconfig,rc.d/init.d},%{_sysconfdir}/spamassassin/channel.d}
298
299 %{__make} install \
300         DESTDIR=$RPM_BUILD_ROOT
301
302 install %{SOURCE1} $RPM_BUILD_ROOT/etc/sysconfig/spamd
303 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/spamd
304 install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/spamassassin
305 install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/spamassassin
306 install %{SOURCE5} $RPM_BUILD_ROOT%{_datadir}/spamassassin/sa-update.cron
307 install %{SOURCE6} $RPM_BUILD_ROOT/etc/cron.d/sa-update
308 install %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/spamassassin/channel.d
309
310 # sa-update, sa-compile
311 install -d $RPM_BUILD_ROOT/var/lib/spamassassin/{%{sa_version},compiled/%{sa_version}}
312 install -d $RPM_BUILD_ROOT%{_sysconfdir}/spamassassin/sa-update-keys
313 touch $RPM_BUILD_ROOT%{_sysconfdir}/spamassassin/sa-update-keys/{pubring,secring,trustdb}.gpg
314
315 rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/Mail/SpamAssassin/.packlist,%{_mandir}/man3/spamassassin-run.*}
316
317 cat > $RPM_BUILD_ROOT%{_sysconfdir}/spamassassin/channels << 'EOF'
318 # Use %{_sysconfdir}/spamassassin/channel.d/*.conf for new channels
319 EOF
320
321 %clean
322 rm -rf $RPM_BUILD_ROOT
323
324 %post spamd
325 /sbin/chkconfig --add spamd
326 %service spamd restart
327
328 %preun spamd
329 if [ "$1" = "0" ]; then
330         %service spamd stop
331         /sbin/chkconfig --del spamd
332 fi
333
334 %triggerun -n perl-Mail-SpamAssassin -- perl-Mail-SpamAssassin < 3.4.2-2
335 if [ $1 -le 1 ]; then
336         exit 0
337 fi
338 [ -d /etc/spamassassin ] || mkdir /etc/spamassassin 2>/dev/null || :
339 for f in /etc/mail/spamassassin/*.{cf,pre}; do
340         f=${f##*/}
341         [ -f "/etc/mail/spamassassin/$f" ] && mv "/etc/mail/spamassassin/$f" "/etc/spamassassin/$f" 2>/dev/null || :
342 done
343 [ -n "$(find /etc/mail/spamassassin -type d -empty 2>/dev/null)" ] && rmdir /etc/mail/spamassassin 2>/dev/null || :
344 [ -n "$(find /etc/mail -type d -empty 2>/dev/null)" ] && rmdir /etc/mail 2>/dev/null || :
345
346 %triggerun -- %{name} < 3.4.2-2
347 if [ $1 -le 1 ]; then
348         exit 0
349 fi
350 [ -d /etc/spamassassin ] || mkdir /etc/spamassassin 2>/dev/null || :
351 [ -f /etc/mail/spamassassin/spamassassin-default.rc ] && mv /etc/mail/spamassassin/spamassassin-default.rc /etc/spamassassin 2>/dev/null || :
352 [ -n "$(find /etc/mail/spamassassin -type d -empty 2>/dev/null)" ] && rmdir /etc/mail/spamassassin 2>/dev/null || :
353 [ -n "$(find /etc/mail -type d -empty 2>/dev/null)" ] && rmdir /etc/mail 2>/dev/null || :
354
355 %triggerun spamc -- spamassassin-spamc < 3.4.2-2
356 if [ $1 -le 1 ]; then
357         exit 0
358 fi
359 [ -d /etc/spamassassin ] || mkdir /etc/spamassassin 2>/dev/null || :
360 [ -f /etc/mail/spamassassin/spamassassin-spamc.rc ] && mv /etc/mail/spamassassin/spamassassin-spamc.rc /etc/spamassassin 2>/dev/null || :
361 [ -n "$(find /etc/mail/spamassassin -type d -empty 2>/dev/null)" ] && rmdir /etc/mail/spamassassin 2>/dev/null || :
362 [ -n "$(find /etc/mail -type d -empty 2>/dev/null)" ] && rmdir /etc/mail 2>/dev/null || :
363
364 %triggerpostun -n perl-Mail-SpamAssassin -- perl-Mail-SpamAssassin < 3.4.2-2
365 echo
366 echo "Warning! Configuration has been migrated to /etc/spamassassin."
367 echo
368
369 %triggerpostun spamd -- spamassassin-spamd < 3.1.0-5.3
370 # temp hack, should we care of the dead link?
371 ln -s spamd /etc/rc.d/init.d/spamassassin
372 /sbin/chkconfig --del spamassassin
373 rm -f /etc/rc.d/init.d/spamassassin
374 if [ -f /etc/sysconfig/spamassassin.rpmsave ]; then
375         mv -f /etc/sysconfig/spamassassin.rpmsave /etc/sysconfig/spamd
376 fi
377
378 %files
379 %defattr(644,root,root,755)
380 %doc CREDITS Changes INSTALL README TRADEMARK UPGRADE USAGE
381 %doc procmailrc.example sql/ ldap/
382 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/spamassassin/spamassassin-default.rc
383 %attr(755,root,root) %{_bindir}/sa-learn
384 %attr(755,root,root) %{_bindir}/sa-awl
385 %attr(755,root,root) %{_bindir}/spamassassin
386 %attr(755,root,root) %{_bindir}/sa-check_spamd
387
388 # It's needed for help of spamassassin command.
389 %{perl_vendorlib}/spamassassin-run.pod
390 %{_mandir}/man1/sa-learn.1*
391 %{_mandir}/man1/spamassassin.1*
392 %{_mandir}/man1/spamassassin-run.1*
393 %{_mandir}/man1/sa-awl.1*
394
395 %files spamd
396 %defattr(644,root,root,755)
397 %doc spamd/README*
398 %attr(754,root,root) /etc/rc.d/init.d/spamd
399 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/spamd
400 %attr(755,root,root) %{_bindir}/spamd
401 %{_mandir}/man1/spamd.1*
402
403 %files spamc
404 %defattr(644,root,root,755)
405 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/spamassassin/spamassassin-spamc.rc
406 %attr(755,root,root) %{_bindir}/spamc
407 %{_mandir}/man1/spamc.1*
408
409 %files compile
410 %defattr(644,root,root,755)
411 %attr(755,root,root) %{_bindir}/sa-compile
412 %{_mandir}/man1/sa-compile.1*
413 %dir /var/lib/spamassassin/compiled
414 %dir /var/lib/spamassassin/compiled/%{sa_version}
415
416 %files update
417 %defattr(644,root,root,755)
418 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/spamassassin/channels
419 %dir %{_sysconfdir}/spamassassin/channel.d
420 %{_sysconfdir}/spamassassin/channel.d/spamassassin-official.conf
421 %attr(700,root,root) %dir %{_sysconfdir}/spamassassin/sa-update-keys
422 %attr(700,root,root) %ghost %{_sysconfdir}/spamassassin/sa-update-keys/*
423 %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/sa-update
424 %attr(755,root,root) %{_bindir}/sa-update
425 %attr(755,root,root) %{_datadir}/spamassassin/sa-update.cron
426 %{_datadir}/spamassassin/sa-update-pubkey.txt
427 %dir /var/lib/spamassassin/%{sa_version}
428 %{_mandir}/man1/sa-update.1*
429
430 %files -n perl-Mail-SpamAssassin
431 %defattr(644,root,root,755)
432 %doc sample-nonspam.txt sample-spam.txt
433 %dir %{_sysconfdir}/spamassassin
434 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/spamassassin/*.pre
435 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/spamassassin/*.cf
436 %exclude %{_sysconfdir}/spamassassin/sa-update-keys
437 %dir %{_datadir}/spamassassin
438 %config(noreplace) %{_datadir}/spamassassin/languages
439 %config(noreplace) %{_datadir}/spamassassin/user_prefs.template
440 %exclude %{_datadir}/spamassassin/sa-update-pubkey.txt
441
442 %dir /var/lib/spamassassin
443
444 %{perl_vendorlib}/Mail/*
445 %{_mandir}/man3/*.3*