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