spamassassin/spamassassin.spec

237 lines
8.2 KiB
RPMSpec

%define perl_major_ver %(eval `perl -V:version`; echo ${version%*.[0-9]*}.0)
%define spamd_groupid 65436
%define spamd_userid 65436
Name: spamassassin
Version: 3.4.0
Release: 4mamba
Summary: SpamAssassin(tm) is a mail filter to identify spam
Group: System/Tools
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://spamassassin.org
Source0: http://www.apache.org/dist/spamassassin/source/Mail-SpamAssassin-%{version}.tar.bz2
Source1: spamassassin.service
Source2: spamassassin-conf
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libperl
BuildRequires: libz-devel
BuildRequires: perl-HTML-Parser
BuildRequires: perl-HTTP-Date
BuildRequires: perl-Net-DNS
BuildRequires: perl-NetAddr-IP
BuildRequires: perl-devel
## AUTOBUILDREQ-END
BuildRequires: libopenssl-devel
BuildRequires: perl-Compress-Zlib >= 1.41
BuildRequires: perl-IO-Socket-SSL >= 0.96
BuildRequires: perl-Mail-SPF >= 2.004
BuildRequires: perl-Net-Ident >= 1.20
BuildRequires: perl-IP-Country
BuildRequires: perl-Mail-DomainKeys
BuildRequires: perl-Mail-DKIM
BuildRequires: perl-Encode-Detect
Requires: perl >= %{perl_major_ver}
Requires: /usr/sbin/sendmail
Requires: perl-Encode-Locale
Provides: SpamAssassin
Obsoletes: SpamAssassin
BuildRoot: %{_tmppath}/%{name}-%{version}-root
# FIXME:
#optional module missing: Mail::SPF::Query Skipped becaus:
# Used to check DNS Sender Policy Framework (SPF) records to fight email
# address forgery and make it easier to identify spams. (Mail::SPF is
# preferred instead of this module.)
#
#optional module missing: Razor2
%description
SpamAssassin(tm) is a mail filter to identify spam.
Using its rule base, it uses a wide range of heuristic tests on mail headers and body text to identify "spam", also known as unsolicited commercial email.
The spam-identification tactics used include:
* header analysis: spammers use a number of tricks to mask their identities, fool you into thinking they've sent a valid mail, or fool you into thinking you must have subscribed at some stage. SpamAssassin tries to spot these.
* text analysis: again, spam mails often have a characteristic style (to put it politely), and some characteristic disclaimers and CYA text. SpamAssassin can spot these, too.
* blacklists: SpamAssassin supports many useful existing blacklists, such as mail-abuse.org, ordb.org or others.
* Razor: Vipul's Razor is a collaborative spam-tracking database, which works by taking a signature of spam messages. Since spam typically operates by sending an identical message to hundreds of people, Razor short-circuits this by allowing the first person to receive a spam to add it to the database -- at which point everyone else will automatically block it.
Once identified, the mail can then be optionally tagged as spam for later filtering using the user's own mail user-agent application.
SpamAssassin requires very little configuration; you do not need to continually update it with details of your mail accounts, mailing list memberships, etc.
It accomplishes filtering without this knowledge, as much as possible.
%prep
%setup -q -n Mail-SpamAssassin-%{version}
##sed -i "s|qmail-queue|/var/qmail/bin/qmail-queue|" qmail/qmail-spamc.c
%build
perl Makefile.PL INSTALLDIRS=vendor CONTACT_ADDRESS=postmaster
make
#make test
%make qmail/qmail-spamc
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
#% makeinstall_perl
%makeinstall
# VENDORPREFIX=%{buildroot}%{_prefix}
packlist=`find %{buildroot} -name .packlist`
[ -z "$packlist" ] && exit 1 || cat $packlist | \
sed "s,%buildroot,,g;s,.*/man/.*,&.gz,g" | \
sort -u > .packlist && rm $packlist
strid=`echo $packlist | sed 's,.*auto\(.*\)/.packlist,\1,'`
for dir in `find %{buildroot} -type d | grep $strid`; do
echo "%dir ${dir#%buildroot}" >> .packlist
done
install -D %{SOURCE2} %{buildroot}%{_sysconfdir}/mail/spamassassin/local.cf
install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/spamassassin.service
install -p qmail/qmail-spamc %{buildroot}%{_bindir}
# dirty hack
sed -i "s,^#!%{_bindir}/perl[0-9\.]*,#!%{_bindir}/perl," \
%{buildroot}%{_bindir}/{sa-learn,spamassassin,spamd}
# remove unpackaged files
find %{buildroot}/usr/lib/perl5 -name perllocal.pod -exec rm -f {} \;
install rules/*.pre %{buildroot}%{_sysconfdir}/mail/spamassassin/
%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%pre
if [ $1 -ge 1 ]; then
/usr/sbin/groupadd spamd -g %{spamd_groupid} 2>/dev/null
/usr/sbin/useradd -u %{spamd_userid} -c 'Spamassassin user' -d /var/lib/spamassassin -g spamd \
-s /bin/false spamd 2>/dev/null
fi
:
%post
%systemd_post spamassassin
if [ $1 -ge 1 ]; then
sa-update &>/dev/null
# sysv -> systemd upgrade
if [ -L /etc/rc.d/rc5.d/S78spamassassin -o -L /etc/rc.d/rc3.d/S78spamassassin ]; then
systemctl -q enable postfix
systemctl -q restart postfix
fi
fi
if [ $1 -eq 1 ]; then
systemctl -q enable spamassassin
systemctl -q start spamassassin
fi
:
%preun
%systemd_preun spamassassin
if [ $1 -eq 0 ]; then
/usr/sbin/userdel spamd 2>/dev/null
/usr/sbin/groupdel spamd 2>/dev/null
fi
:
%postun
%systemd_postun_with_restart spamassassin
:
%posttrans
# clean old sysv broken links
find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \;
:
%files -f .packlist
%defattr(-,root,root)
%dir %{_sysconfdir}/mail/spamassassin
%{_sysconfdir}/mail/spamassassin/v330.pre
%config(noreplace) %{_sysconfdir}/mail/spamassassin/local.cf
%{_sysconfdir}/mail/spamassassin/init.pre
%{_sysconfdir}/mail/spamassassin/v310.pre
%{_sysconfdir}/mail/spamassassin/v312.pre
%{_sysconfdir}/mail/spamassassin/v320.pre
%{_sysconfdir}/mail/spamassassin/v340.pre
%{_bindir}/qmail-spamc
%dir %{_datadir}/spamassassin
%{_datadir}/spamassassin/*
%{_unitdir}/spamassassin.service
%changelog
* Thu Apr 09 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 3.4.0-4mamba
- fix spamd path in service file
* Thu Jan 22 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 3.4.0-3mamba
- systemd plus spamd user/group support
* Thu Jul 24 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 3.4.0-2mamba
- initscript: don't check obsoleted /etc/sysconfig/network
* Wed Feb 12 2014 Automatic Build System <autodist@mambasoft.it> 3.4.0-1mamba
- automatic version update by autodist
* Wed Nov 27 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 3.3.2-3mamba
- run sa-update in post script
- renamed from SpamAssassin
- require perl-Encode-Locale
- enable service by default on install/upgrade
* Mon Nov 12 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 3.3.2-2mamba
- perl 5.16 mass rebuild
* Wed Jun 22 2011 Automatic Build System <autodist@mambasoft.it> 3.3.2-1mamba
- automatic update by autodist
* Sat May 15 2010 Automatic Build System <autodist@mambasoft.it> 3.3.1-1mamba
- automatic update to 3.3.1 by autodist
* Mon Oct 19 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.5-4mamba
- reinstall missing v*.pre files
* Thu Oct 01 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.5-3mamba
- rebuilt with perl 5.10.1
* Thu Nov 06 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.5-2mamba
- automatic rebuild by autodist
* Thu Jun 19 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.5-1mamba
- update to 3.2.5
* Wed Jun 04 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.4-1mamba
- update to 3.2.4
* Thu Nov 08 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.3-1mamba
- update to 3.2.3
- build against some more perl requirements
* Wed May 09 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.0-1mamba
- update to 3.2.0
* Wed Apr 26 2006 Davide Madrisan <davide.madrisan@qilinux.it> 2.64-4qilnx
- removed dependency on perl-<version>
* Thu Apr 06 2006 Davide Madrisan <davide.madrisan@qilinux.it> 2.64-2qilnx
- removed dependency on qmail
* Mon Oct 18 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.64-1qilnx
- update to version 2.64 by autospec
- also fixe a security issue (QSA-2004-042): CAN-2004-0796
* Mon Feb 02 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.63-2qilnx
- added customized default configuration file
* Mon Feb 02 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.63-1qilnx
- new version rebuild
* Wed Nov 26 2003 Silvan Calarco <silvan.calarco@mambasoft.it> 2.60-1qilnx
- first build