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