spec cleanup (not complete yet)

This commit is contained in:
Michal Hlavinka 2009-10-29 15:50:04 +00:00
parent 04b690052b
commit b91cae1db0

View File

@ -1,76 +1,30 @@
Name: cyrus-imapd
Version: 2.3.15
Release: 3%{?dist}
# ********************** BUILD TIME OPTIONS START **********************
# To modify parameters, edit the .spec file or build like this:
# rpm --rebuild --define='SEEN_DB skiplist' cyrus-imapd-2.x.x-x.src.rpm
# use saslauth group
%{!?SASLGROUP: %global SASLGROUP 1}
# include deliver-wrapper
%{!?DEL_WRAP: %global DEL_WRAP 0}
# use preforking cyrus.conf
%{!?PREFORK: %global PREFORK 1}
# enable Netscape hack (recommended)
%{!?NETSCAPEHACK: %global NETSCAPEHACK 1}
# enable IMAP4 LIST extensions
%{!?LISTEXT: %global LISTEXT 1}
# enable IDLED support
%{!?IDLED: %global IDLED 1}
# enable SNMP support
%{!?SNMP: %global SNMP 1}
# force syncronous updates on ext3
%{!?FORCESYNCEXT3: %global FORCESYNCEXT3 0}
# include autocreate feature
%{!?AUTOCREATE: %global AUTOCREATE 1}
# don't check for RFC compliant line termination (bare newlines)
%{!?NO_BARE_NL: %global NO_BARE_NL 0}
# used syslog facility for logging
%{!?SYSLOGFACILITY: %global SYSLOGFACILITY MAIL}
# use -fpie for linking
%{!?USEPIE: %global USEPIE 1}
# ********************** BUILD TIME OPTIONS END ************************
Release: 4%{?dist}
%define _dbver db4
# Do we need the perl install hack for RedHat > 7.3 ?
%define _perlhack 1
%define _withldap 1
%define _snmpver net
%define ssl_pem_file %{_sysconfdir}/pki/%{name}/%{name}.pem
%define uid 76
%if %{SASLGROUP}
%define gid 76
%define _saslgroup saslauth
%endif
%define _cyrususer cyrus
%define _cyrusgroup mail
%define _vardata %{_var}/lib/imap
%define _spooldata %{_var}/spool/imap
%define _cyrexecdir %{_exec_prefix}/lib/%{name}
#FIXME: check if wise to remove (2x):
%define _confdir master/conf
%define _contribdir doc/contrib
%if %{PREFORK}
%define _cyrusconf %{_confdir}/prefork.conf
%else
%define _cyrusconf %{_confdir}/normal.conf
%endif
Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support
# BSD with advertising: imap/setproctitle.c, lib/mkgmtime.c, lib/sysexits.h
# the rest is CMU
License: MIT and BSD with advertising
License: MIT
Group: System Environment/Daemons
URL: http://cyrusimap.web.cmu.edu/
#Packager: Simon Matter <simon.matter@invoca.ch>
#Vendor: Invoca Systems
#Distribution: Invoca Linux Server
Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz
Source3: cyrus-deliver-wrapper.c
Source4: cyrus-user-procmailrc.template
@ -104,36 +58,36 @@ Source33: cyrus-imapd-README.skiplist_recovery
Patch0: cyrus-imapd-2.2.12-no_transfig.patch
Patch1: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.12/cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff
Patch2: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.12/cyrus-imapd-2.3.12p2-autosieve-0.6.0.diff
#Patch3: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.9/cyrus-imapd-2.3.9-rmquota+deletemailbox-0.2-1.diff
Patch4: http://servercc.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
Patch6: cyrus-imapd-2.1.16-getrlimit.patch
Patch7: cyrus-imapd-2.3.7-nobarenewlinescheck.patch
Patch10: cyrus-imapd-acceptinvalidfrom.patch
Patch12: cyrus-imapd-2.3.7-notify_sms.patch
Patch14: cyrus-imapd-2.3.1-authid_normalize.patch
Patch15: cyrus-imapd-2.3.1-make_md5_defaults.patch
Patch18: cyrus-imapd-2.3.7-krb4.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=461875
Patch19: cyrus-imapd-2.3.12p2-current-db.patch
Patch20: cyrus-imapd-2.3.15-bufov.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: autoconf >= 2.59
BuildRequires: cyrus-sasl-devel >= 2.1.15-1, perl-devel, tcp_wrappers
BuildRequires: %{_dbver}-devel, openssl-devel, pkgconfig
BuildRequires: flex, bison, groff >= 1.15-8, automake
BuildRequires: openldap-devel
BuildRequires: krb5-devel
%if %{SNMP}
BuildRequires: %{_snmpver}-snmp-devel
%endif
BuildRequires: net-snmp-devel
Requires(post): e2fsprogs, /sbin/chkconfig, /sbin/service, perl, grep, coreutils, findutils
Requires(preun): /sbin/chkconfig, /sbin/service, coreutils
Requires(postun): /sbin/service
Requires: %{name}-utils = %{version}-%{release}
Requires: cyrus-sasl-lib >= 2.1.15, file >= 3.35-1, %{_dbver}-utils
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Obsoletes: cyrus-murder, cyrus-nntp
Provides: cyrus-murder, cyrus-nntp
%description
The %{name} package contains the core of the Cyrus IMAP server.
@ -172,8 +126,6 @@ The %{name}-devel package contains header files and libraries
necessary for developing applications which use the imclient library.
%package perl
Provides: perl-Cyrus
Obsoletes: perl-Cyrus
Group: System Environment/Libraries
Summary: Cyrus IMAP server utility Perl modules
@ -197,16 +149,10 @@ one running the server.
%prep
%setup -q
%patch0 -p1 -b .no_transfig
%if %{AUTOCREATE}
%patch1 -p1 -b .autocreate
%patch2 -p1 -b .autosieve
#%patch3 -p1 -b .rmquota
%endif
%patch4 -p1 -b .flock
%patch6 -p1 -b .getrlimit
%if %{NO_BARE_NL}
%patch7 -p1 -b .nobarenewlinescheck
%endif
%patch10 -p1 -b .acceptinvalidfrom
%patch12 -p1 -b .notify_sms
%patch14 -p1 -b .authid_normalize
@ -232,30 +178,17 @@ if pkg-config openssl; then
fi
CPPFLAGS="-I%{_includedir}/kerberosIV $CPPFLAGS"; export CPPFLAGS
CCDLFLAGS="-rdynamic"; export CCDLFLAGS
%if %{USEPIE}
%ifnarch ppc ppc64
LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
%endif
%endif
%{configure} \
%if %{NETSCAPEHACK}
--enable-netscapehack \
%endif
%if %{LISTEXT}
--enable-listext \
%endif
%if %{IDLED}
--enable-idled \
%endif
%if %{_withldap}
--with-ldap=/usr \
%endif
%if %{SNMP}
--with-snmp \
%else
--without-snmp \
%endif
--enable-murder \
--enable-replication \
--enable-nntp \
@ -264,16 +197,13 @@ LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
--with-service-path=%{_cyrexecdir} \
--with-bdb-incdir=%{_includedir}/%{_dbver} \
--with-extraident="Fedora-RPM-%{version}-%{release}" \
--with-syslogfacility=%{SYSLOGFACILITY} \
--with-syslogfacility=MAIL \
--with-krbimpl=mit
%{__make} -C man -f Makefile.dist
%{__make} -C doc -f Makefile.dist
%{__make}
%{__make} -C notifyd notifytest
%if %{DEL_WRAP}
%{__cc} $CFLAGS -DLIBEXECDIR=\"%{_cyrexecdir}\" -Wall -o deliver-wrapper %{SOURCE3}
%endif
# Modify docs master --> cyrus-master
pushd man
@ -303,10 +233,8 @@ find doc -name "*.html.*" -type f | xargs -r %{__rm} -f
%{__install} -m 644 %{SOURCE23} doc/README.RPM
%{__install} -m 644 %{SOURCE24} doc/README.HOWTO-recover-mailboxes.db
%{__install} -m 644 %{SOURCE33} doc/README.skiplist_recovery
%if %{AUTOCREATE}
%{__install} -m 644 %{SOURCE8} doc/README.autocreate
%{__install} -m 644 %{SOURCE9} doc/README.autosievefolder
%endif
%{__install} -d doc/m4
%{__install} -m 644 %{SOURCE26} doc/m4/cyrus-procmailrc
%{__install} -m 644 %{SOURCE4} doc/m4/cyrus-user-procmailrc.template
@ -317,11 +245,9 @@ find doc -name "*.html.*" -type f | xargs -r %{__rm} -f
%{__perl} -pi -e "s@/var/imap/@%{_vardata}/@" %{_confdir}/*.conf doc/cyrusv2.mc doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
# enable/disable idled in .conf files to prevent error messages
%if %{IDLED}
%{__perl} -pi -e "s/# idled/ idled/" %{_confdir}/*.conf
%else
%{__perl} -pi -e "s/ idled/# idled/" %{_confdir}/*.conf
%endif
#FIXME:check if required in distributed conf, remove otherways
%{__perl} -pi -e "s/# idled/ idled/" %{_confdir}/*.conf
%install
%{__rm} -rf %{buildroot}
@ -337,9 +263,6 @@ popd
%{__make} install DESTDIR=%{buildroot} PREFIX=%{_prefix} mandir=%{_mandir}
%{__make} -C man install DESTDIR=%{buildroot} PREFIX=%{_prefix} mandir=%{_mandir}
%if %{DEL_WRAP}
%{__install} -m 2755 deliver-wrapper %{buildroot}%{_cyrexecdir}/
%endif
%{__install} -m 755 imtest/imtest %{buildroot}%{_bindir}/
%{__install} -m 755 notifyd/notifytest %{buildroot}%{_bindir}/
%{__install} -m 755 perl/imap/cyradm %{buildroot}%{_bindir}/
@ -355,9 +278,7 @@ done
%{buildroot}%{_libdir}/sasl \
%{buildroot}%{_spooldata} \
%{buildroot}%{_vardata}/{user,quota,proc,log,msg,socket,db,sieve,sync,md5,rpm,backup,meta} \
%if %{_withldap}
%{buildroot}%{_vardata}/ptclient \
%endif
%{buildroot}%{_datadir}/%{name}/rpm \
%{buildroot}%{_sysconfdir}/pki/%{name} \
%{_contribdir}
@ -374,7 +295,6 @@ done
%{__install} -m 644 %{SOURCE19} %{_contribdir}/cpmsg
%{__install} -m 644 %{SOURCE20} %{_contribdir}/folderxfer
%{__install} -m 644 %{SOURCE21} %{_contribdir}/inboxfer
%{__install} -m 644 %{SOURCE22} %{_contribdir}/
%{__install} -m 644 %{SOURCE30} %{_contribdir}/README
# fix permissions on perl .so files
@ -443,10 +363,6 @@ touch %{buildroot}%{ssl_pem_file}
%{__rm} -f %{buildroot}%{_cyrexecdir}/pop3proxyd
find %{buildroot} -name "perllocal.pod" -exec %{__rm} -f {} \;
find %{buildroot} -name ".packlist" -exec %{__rm} -f {} \;
%if !%{IDLED}
%{__rm} -f %{buildroot}%{_mandir}/man8/idled.8*
%{__rm} -f doc/man/idled.8.html
%endif
%{__rm} -f doc/text/Makefile
%{__rm} -f %{buildroot}%{_mandir}/man8/syncnews.8*
%{__rm} -f doc/man/syncnews.8.html
@ -467,25 +383,16 @@ fi
# Force synchronous updates, usually only on ext2 filesystems
for i in %{_vardata}/{user,quota} %{_spooldata}
do
%if %{FORCESYNCEXT3}
if [ $(find $i -maxdepth 0 -printf %%F) = "ext2" -o $(find $i -maxdepth 0 -printf %%F) = "ext3" ]; then
%else
if [ $(find $i -maxdepth 0 -printf %%F) = "ext2" ]; then
%endif
chattr -R +S $i 2>/dev/null
fi
done
# prevent idled related errors to show up
%if %{IDLED}
if grep -q "^# idled" %{_sysconfdir}/cyrus.conf ; then
#FIXME:check if it changes anything nowadays? remove otherways
if grep -q "^# idled" %{_sysconfdir}/cyrus.conf ; then
%{__perl} -pi -e "s/^# idled/ idled/" %{_sysconfdir}/cyrus.conf
fi
%else
if grep -q "^ idled" %{_sysconfdir}/cyrus.conf ; then
%{__perl} -pi -e "s/^ idled/# idled/" %{_sysconfdir}/cyrus.conf
fi
%endif
fi
# Create SSL certificates
exec > /dev/null 2> /dev/null
@ -514,9 +421,7 @@ if [ $1 = 0 ]; then
/sbin/chkconfig --del %{name}
%{__rm} -f %{_vardata}/socket/* 2> /dev/null
%{__rm} -f %{_vardata}/proc/* 2> /dev/null
%if %{_withldap}
%{__rm} -f %{_vardata}/ptclient/ptsock 2> /dev/null
%endif
fi
%postun
@ -526,61 +431,30 @@ fi
%pre utils
# Create 'cyrus' user on target host
%if %{SASLGROUP}
/usr/sbin/groupadd -g %{gid} -r %{_saslgroup} 2> /dev/null || :
/usr/sbin/groupadd -g %{gid} -r saslauth 2> /dev/null || :
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-G %{_saslgroup} -s /sbin/nologin -u %{uid} -r %{_cyrususer} 2> /dev/null || :
%else
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-s /sbin/nologin -u %{uid} -r %{_cyrususer} 2> /dev/null || :
%endif
-G saslauth -s /sbin/nologin -u %{uid} -r %{_cyrususer} 2> /dev/null || :
%post utils
# Add service entries if necessary
if ! %{__grep} -q ^lmtp %{_sysconfdir}/services; then
echo -e 'lmtp\t\t24/tcp\t\t\t\t# LMTP Mail Delivery over TCP' >> %{_sysconfdir}/services
echo -e 'lmtp\t\t24/udp\t\t\t\t# LMTP Mail Delivery over TCP' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^nntps %{_sysconfdir}/services; then
echo -e 'nntps\t\t563/tcp\t\t\t\t# NNTP over SSL' >> %{_sysconfdir}/services
echo -e 'nntps\t\t563/udp\t\t\t\t# NNTP over SSL' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^pop3s %{_sysconfdir}/services; then
echo -e 'pop3s\t\t995/tcp\t\t\t\t# POP-3 over SSL' >> %{_sysconfdir}/services
echo -e 'pop3s\t\t995/udp\t\t\t\t# POP-3 over SSL' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^imaps %{_sysconfdir}/services; then
echo -e 'imaps\t\t993/tcp\t\t\t\t# IMAP over SSL' >> %{_sysconfdir}/services
echo -e 'imaps\t\t993/udp\t\t\t\t# IMAP over SSL' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^sieve %{_sysconfdir}/services; then
echo -e 'sieve\t\t2000/tcp\t\t\t# Sieve Mail Filter Daemon' >> %{_sysconfdir}/services
echo -e 'sieve\t\t2000/udp\t\t\t# Sieve Mail Filter Daemon' >> %{_sysconfdir}/services
fi
#FIXME: is this needed?
if ! %{__grep} -q ^csync %{_sysconfdir}/services; then
echo -e 'csync\t\t2005/tcp\t\t\t# Cyrus IMAP Replication Daemon' >> %{_sysconfdir}/services
echo -e 'csync\t\t2005/udp\t\t\t# Cyrus IMAP Replication Daemon' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^mupdate %{_sysconfdir}/services; then
echo -e 'mupdate\t\t3905/tcp\t\t\t# Cyrus IMAP Mupdate Daemon' >> %{_sysconfdir}/services
echo -e 'mupdate\t\t3905/udp\t\t\t# Cyrus IMAP Mupdate Daemon' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^fud %{_sysconfdir}/services; then
echo -e 'fud\t\t4201/udp\t\t\t# Cyrus IMAP FUD Daemon' >> %{_sysconfdir}/services
fi
%postun utils
if [ $1 = 0 ]; then
/usr/sbin/userdel %{_cyrususer} 2> /dev/null || :
%if %{SASLGROUP}
if [ "$(%{__grep} ^%{_saslgroup}: %{_sysconfdir}/group | cut -d: -f4-)" = "" ]; then
/usr/sbin/groupdel %{_saslgroup} 2> /dev/null || :
fi
%endif
if [ "$(%{__grep} ^saslauth: %{_sysconfdir}/group | cut -d: -f4-)" = "" ]; then
/usr/sbin/groupdel saslauth 2> /dev/null || :
fi
fi
%files
%defattr(-,root,root,-)
%doc COPYRIGHT README
%doc doc/*
%config(noreplace) %{_sysconfdir}/cyrus.conf
%config(noreplace) %{_sysconfdir}/imapd.conf
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/%{name}
@ -640,12 +514,8 @@ fi
%{_cyrexecdir}/upgradesieve
%{_cyrexecdir}/cvt_cyrusdb_all
%{_cyrexecdir}/rpm_set_permissions
%if %{IDLED}
%{_cyrexecdir}/idled
%endif
%if %{AUTOCREATE}
%{_cyrexecdir}/compile_sieve
%endif
%{_cyrexecdir}/mupdate
%{_cyrexecdir}/mupdate-loadgen.pl
%{_cyrexecdir}/proxyd
@ -655,14 +525,9 @@ fi
%{_cyrexecdir}/sync_server
%{_cyrexecdir}/cyrfetchnews
%{_cyrexecdir}/nntpd
%if %{_withldap}
%{_cyrexecdir}/ptdump
%{_cyrexecdir}/ptexpire
%{_cyrexecdir}/ptloader
%endif
%if %{DEL_WRAP}
%attr(2755,%{_cyrususer},%{_cyrusgroup}) %{_cyrexecdir}/deliver-wrapper
%endif
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}
%attr(0750,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/socket
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/user
@ -677,17 +542,13 @@ fi
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/rpm
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/backup
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/meta
%if %{_withldap}
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/ptclient
%endif
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_spooldata}
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/rpm
%{_datadir}/%{name}/rpm/*
%{_mandir}/man5/*
%{_mandir}/man8/*
%doc COPYRIGHT README
%doc doc/*
%dir %{_sysconfdir}/pki/%{name}
%attr(0640,root,%{_cyrusgroup}) %ghost %config(missingok,noreplace) %verify(not md5 size mtime) %{ssl_pem_file}
@ -731,6 +592,9 @@ fi
%{_mandir}/man1/*
%changelog
* Thu Oct 29 2009 Michal Hlavinka <mhlavink@redhat.com> - 2.3.15-4
- spec cleanup
* Fri Oct 09 2009 Michal Hlavinka <mhlavink@redhat.com> - 2.3.15-3
- fix cyrus user shell for db import (#528126)