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