spamassassin/spamassassin.spec

Thu, 23 Apr 2009 15:20:21 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 23 Apr 2009 15:20:21 +0200
changeset 192
62106debeb75
parent 191
d980506f80fc
child 194
42dc0386ad57
permissions
-rw-r--r--

Specify options in configuration and adapt package for virtual users.

michael@191 1 ##
michael@191 2 ## spamassassin.spec -- OpenPKG RPM Package Specification
michael@191 3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@191 4 ##
michael@191 5 ## Permission to use, copy, modify, and distribute this software for
michael@191 6 ## any purpose with or without fee is hereby granted, provided that
michael@191 7 ## the above copyright notice and this permission notice appear in all
michael@191 8 ## copies.
michael@191 9 ##
michael@191 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@191 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@191 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@191 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@191 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@191 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@191 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@191 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@191 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@191 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@191 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@191 21 ## SUCH DAMAGE.
michael@191 22 ##
michael@191 23
michael@191 24 # package version
michael@191 25 %define V_real 3.2.5
michael@191 26 %define V_here 3.2.5
michael@191 27 %define V_sdir 3.2.5
michael@191 28
michael@191 29 # package information
michael@191 30 Name: spamassassin
michael@191 31 Summary: Mail Filter Identifying Spam
michael@191 32 URL: http://spamassassin.apache.org/
michael@191 33 Vendor: Justin Mason
michael@191 34 Packager: OpenPKG Foundation e.V.
michael@191 35 Distribution: OpenPKG Community
michael@191 36 Class: BASE
michael@191 37 Group: Mail
michael@191 38 License: ASF
michael@191 39 Version: %{V_here}
michael@192 40 Release: 20080612
michael@191 41
michael@191 42 # package options
michael@191 43 %option with_fsl yes
michael@191 44
michael@191 45 # list of sources
michael@191 46 Source0: http://www.apache.org/dist/spamassassin/source/Mail-SpamAssassin-%{V_real}.tar.gz
michael@191 47 Source1: rc.spamassassin
michael@191 48 Source2: local.cf
michael@191 49 Source3: fsl.spamassassin
michael@191 50
michael@191 51 # build information
michael@191 52 Prefix: %{l_prefix}
michael@191 53 BuildRoot: %{l_buildroot}
michael@191 54 BuildPreReq: OpenPKG, openpkg >= 20060823, perl, perl-openpkg >= 5.8.4, make
michael@191 55 PreReq: OpenPKG, openpkg >= 20060823, perl
michael@191 56 BuildPreReq: perl-db, perl-crypto, perl-xml, perl-dns
michael@191 57 PreReq: perl-db, perl-crypto, perl-xml, perl-dns
michael@191 58 %if "%{with_fsl}" == "yes"
michael@191 59 BuildPreReq: fsl
michael@191 60 PreReq: fsl
michael@191 61 %endif
michael@191 62 AutoReq: no
michael@191 63 AutoReqProv: no
michael@191 64
michael@191 65 %description
michael@191 66 SpamAssassin provides you with a way to reduce if not completely
michael@191 67 eliminate Unsolicited Commercial Email (UCE, aka SPAM) from your
michael@191 68 incoming email. It uses a genetic-algorithm evolved scoring system
michael@191 69 to identify messages which look spammy, then adds headers to the
michael@191 70 message so they can be filtered by the user's mail reading software.
michael@191 71 This distribution includes the spamd/spamc components which create a
michael@191 72 server that considerably speeds processing of mail.
michael@191 73
michael@191 74 %track
michael@191 75 prog spamassassin = {
michael@191 76 version = %{V_real}
michael@191 77 url = http://www.apache.org/dist/spamassassin/source/
michael@191 78 regex = Mail-SpamAssassin-(\d+\.\d+\.\d+)\.tar\.gz
michael@191 79 }
michael@191 80
michael@191 81 %prep
michael@191 82 %setup -q -n Mail-SpamAssassin-%{V_sdir}
michael@191 83
michael@191 84 %build
michael@191 85 # configure package
michael@191 86 %{l_prefix}/bin/perl-openpkg prepare
michael@191 87 export CC="%{l_cc}"
michael@191 88 export CFLAGS="%{l_cflags -O} -Ispamc %{l_cppflags}"
michael@191 89 export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
michael@191 90 export LIBS="%{l_ldflags} %{l_fsl_ldflags} %{l_fsl_libs}"
michael@191 91 %{l_prefix}/bin/perl-openpkg configure \
michael@191 92 -A DESTDIR="$RPM_BUILD_ROOT" \
michael@191 93 -A PREFIX="%{l_prefix}" \
michael@191 94 -A SYSCONFDIR="%{l_prefix}/etc/spamassassin" \
michael@191 95 -A LOCALRULESDIR="%{l_prefix}/etc/spamassassin" \
michael@191 96 -A DATADIR="%{l_prefix}/share/spamassassin" \
michael@191 97 -A PERL_BIN="%{l_prefix}/bin/perl"
michael@191 98
michael@191 99 # build package
michael@191 100 %{l_make} %{l_mflags}
michael@191 101
michael@191 102 %install
michael@191 103 rm -rf $RPM_BUILD_ROOT
michael@191 104
michael@191 105 # install package
michael@191 106 %{l_make} %{l_mflags} install
michael@191 107
michael@191 108 # install default configuration
michael@191 109 %{l_shtool} mkdir -f -p -m 755 \
michael@191 110 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin
michael@191 111 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@191 112 %{SOURCE local.cf} \
michael@191 113 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin/
michael@191 114
michael@192 115 # create directories for PID file and virtual users
michael@191 116 %{l_shtool} mkdir -f -p -m 755 \
michael@192 117 $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin \
michael@192 118 $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin/spool
michael@191 119
michael@191 120 # strip installation
michael@191 121 chmod u+w $RPM_BUILD_ROOT%{l_prefix}/bin/*
michael@191 122 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@191 123 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
michael@191 124
michael@192 125 # install runcommand script
michael@191 126 %{l_shtool} mkdir -f -p -m 755 \
michael@191 127 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@191 128 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@191 129 %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@191 130
michael@191 131 # install OSSP fsl configuration
michael@191 132 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@191 133 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@191 134 %{SOURCE fsl.spamassassin} \
michael@191 135 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@191 136
michael@191 137 # determine installation files
michael@191 138 %{l_prefix}/bin/perl-openpkg \
michael@191 139 -F perl-openpkg-files \
michael@191 140 fixate cleanup
michael@191 141 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@191 142 %{l_files_std} \
michael@191 143 '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \
michael@191 144 '%config %{l_prefix}/etc/spamassassin/*' \
michael@191 145 '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/spamassassin' \
michael@192 146 '%attr(755,%{l_susr},%{l_sgrp}) %{l_prefix}/var/spamassassin/spool' \
michael@191 147 '%attr(4755,%{l_rusr},%{l_mgrp}) %{l_prefix}/bin/spamc' \
michael@191 148 `cat perl-openpkg-files`
michael@191 149
michael@191 150 %files -f files
michael@191 151
michael@191 152 %clean
michael@191 153 rm -rf $RPM_BUILD_ROOT
michael@191 154
michael@191 155 %post
michael@191 156 # after upgrade, restart service
michael@191 157 [ $1 -eq 2 ] || exit 0
michael@191 158 eval `%{l_rc} spamassassin status 2>/dev/null`
michael@191 159 [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart
michael@191 160 exit 0
michael@191 161
michael@191 162 %preun
michael@191 163 # before erase, stop service
michael@191 164 [ $1 -eq 0 ] || exit 0
michael@191 165 %{l_rc} spamassassin stop 2>/dev/null
michael@191 166 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.pid >/dev/null 2>&1 || true
michael@191 167 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true
michael@191 168 exit 0
michael@191 169

mercurial