From 2e7805e53102e20b773666c9dc66f047bf83e02f Mon Sep 17 00:00:00 2001 From: Stuart Gathman Date: Tue, 27 Jan 2009 02:28:52 +0000 Subject: [PATCH] Fedora core changes --- pymilter.spec | 70 +++++++++++++++++++++++++++++++++++++++------------ setup.py | 7 +++--- start.sh | 8 +++--- 3 files changed, 63 insertions(+), 22 deletions(-) diff --git a/pymilter.spec b/pymilter.spec index 496cf92..d8ca64f 100644 --- a/pymilter.spec +++ b/pymilter.spec @@ -1,21 +1,33 @@ -%define __python python -#define __python python2.4 +# EL 3,4,5 supported, set to 0 for Fedora +%define RHEL 0 + +%if %{RHEL} > 0 && %{RHEL} < 5 +%define __python python2.4 +%endif + %define libdir %{_libdir}/pymilter %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%define pythonbase %(basename %{__python}) Summary: Python interface to sendmail milter API Name: pymilter Version: 0.9.0 -Release: 2%{dist} +Release: 4%{dist} Source: http://downloads.sourceforge.net/pymilter/%{name}-%{version}.tar.gz -#Patch: %{name}-%{version}.patch +Patch: %{name}-smutil.patch +Patch1: %{name}-start.patch License: GPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Url: http://www.bmsi.com/python/milter.html -Requires: %{__python} >= 2.4, sendmail >= 8.13 -BuildRequires: ed, %{__python}-devel >= 2.4, sendmail-devel >= 8.13 +%if %{RHEL} > 0 +Requires: %{pythonbase} >= 2.4, sendmail >= 8.13 +BuildRequires: ed, %{pythonbase}-devel >= 2.4, sendmail-devel >= 8.13 +%else +Requires: %{pythonbase}, sendmail +BuildRequires: ed, %{pythonbase}-devel, sendmail-devel +%endif %description This is a python extension module to enable python scripts to @@ -25,18 +37,32 @@ DSNs, and doing CBV. %prep %setup -q -#patch -p0 -b .bms +%patch -p0 -b .smutil +%patch1 -p0 -b .start %build env CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build %install rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES -mkdir -p $RPM_BUILD_ROOT/var/run/milter +%{__python} setup.py install --root=$RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/milter +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/milter mkdir -p $RPM_BUILD_ROOT%{libdir} cp start.sh $RPM_BUILD_ROOT%{libdir} ed $RPM_BUILD_ROOT%{libdir}/start.sh <<'EOF' +/^datadir=/ +c +datadir="%{_localstatedir}/log/milter" +. +/^piddir=/ +c +piddir="%{_localstatedir}/run/milter" +. +/^libdir=/ +c +libdir="%{libdir}" +. /^python=/ c python="%{__python}" @@ -45,43 +71,55 @@ w q EOF chmod a+x $RPM_BUILD_ROOT%{libdir}/start.sh -grep '.pyc$' INSTALLED_FILES | sed -e 's/c$/o/' >>INSTALLED_FILES # start.sh is used by spfmilter and milter, and could be used by -# other milters running on redhat -%files -f INSTALLED_FILES +# other milters using pymilter. +%files %defattr(-,root,root,-) %doc README ChangeLog NEWS TODO CREDITS sample.py milter-template.py -%dir %{python_sitelib}/Milter -%dir %{libdir} -%config %{libdir}/start.sh -%dir %attr(0755,mail,mail) /var/run/milter +%{python_sitearch}/* +%{libdir} +%dir %attr(0755,mail,mail) %{_localstatedir}/run/milter +%dir %attr(0755,mail,mail) %{_localstatedir}/log/milter %clean rm -rf $RPM_BUILD_ROOT %changelog +* Wed Jan 07 2009 Stuart Gathman 0.9.0-4 +- Stop using INSTALLED_FILES to make Fedora happy +- Remove config flag from start.sh glue +- Own /var/log/milter +- Use %{_localstatedir} + * Wed Jan 07 2009 Stuart Gathman 0.9.0-2 - Changes to meet Fedora standards + * Mon Nov 24 2008 Stuart Gathman 0.9.0-1 - Split pymilter into its own CVS module - Support chgfrom and addrcpt_par - Support NS records in Milter.dns + * Mon Aug 25 2008 Stuart Gathman 0.8.10-2 - /var/run/milter directory must be owned by mail + * Mon Aug 25 2008 Stuart Gathman 0.8.10-1 - improved parsing into email and fullname (still 2 self test failures) - implement no-DSN CBV, reduce full DSNs + * Mon Sep 24 2007 Stuart Gathman 0.8.9-1 - Use ifarch hack to build milter and milter-spf packages as noarch - Remove spf dependency from dsn.py, add dns.py + * Fri Jan 05 2007 Stuart Gathman 0.8.8-1 - move AddrCache, parse_addr, iniplist to Milter package - move parse_header to Milter.utils - fix plock for missing source and can't change owner/group - split out pymilter and pymilter-spf packages - move milter apps to /usr/lib/pymilter + * Sat Nov 04 2006 Stuart Gathman 0.8.7-1 - SPF moved to pyspf RPM + * Tue May 23 2006 Stuart Gathman 0.8.6-2 - Support CBV timeout diff --git a/setup.py b/setup.py index 3df71b2..49b95c7 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,11 @@ import os import sys from distutils.core import setup, Extension -# FIXME: on some versions of sendmail, smutil is renamed to sm -# on slackware and debian, leave it out entirely. It depends +# FIXME: on some versions of sendmail, smutil is renamed to sm. +# On slackware and debian, leave it out entirely. It depends # on how libmilter was built by the sendmail package. -libs = ["milter", "smutil"] +#libs = ["milter", "smutil"] +libs = ["milter"] libdirs = ["/usr/lib/libmilter"] # needed for Debian # patch distutils if it can't cope with the "classifiers" or diff --git a/start.sh b/start.sh index e3c09f1..736ee30 100755 --- a/start.sh +++ b/start.sh @@ -1,14 +1,16 @@ #!/bin/sh appname="$1" script="${2:-${appname}}" -datadir=/var/log/milter +datadir="/var/log/milter" +piddir="/var/run/milter" +libdir="/usr/lib/pymilter" python="python2.4" exec >>${datadir}/${appname}.log 2>&1 if test -s ${datadir}/${script}.py; then cd ${datadir} # use version in log dir if it exists for debugging else - cd /usr/lib/pymilter + cd ${libdir} fi ${python} ${script}.py & -echo $! >/var/run/milter/${appname}.pid +echo $! >${piddir}/${appname}.pid