Compare commits

..

1 Commits

Author SHA1 Message Date
cvs2svn fd530ebf86 This commit was manufactured by cvs2svn to create tag 'pymilter-0_9_0'.
Sprout from master 2008-12-14 03:01:43 UTC Stuart Gathman <stuart@gathman.org> 'Release 0.9.0'
Cherrypick from bmsi 2005-05-31 18:23:49 UTC Stuart Gathman <stuart@gathman.org> 'Development changes since 0.7.2':
    sample.py
    test/amazon
    test/big5
    test/bounce
    test/bounce1
    test/bound
    test/honey
    test/missingboundary
    test/samp1
    test/spam44
    test/spam7
    test/spam8
    test/test1
    test/test8
    test/virus1
    test/virus13
    test/virus2
    test/virus3
    test/virus4
    test/virus5
    test/virus6
    test/virus7
    testsample.py
2008-12-14 03:01:44 +00:00
5 changed files with 50 additions and 86 deletions
+2 -4
View File
@@ -142,10 +142,8 @@ def connectcallback(ctx,hostname,family,hostaddr):
def closecallback(ctx): def closecallback(ctx):
m = ctx.getpriv() m = ctx.getpriv()
if not m: return CONTINUE if not m: return CONTINUE
try: rc = m.close()
rc = m.close() m._setctx(None) # release milterContext
finally:
m._setctx(None) # release milterContext
return rc return rc
def dictfromlist(args): def dictfromlist(args):
+3 -9
View File
@@ -35,12 +35,6 @@ $ python setup.py help
libraries=["milter","smutil","resolv"] libraries=["milter","smutil","resolv"]
* $Log$ * $Log$
* Revision 1.16 2008/12/16 04:21:05 customdesigned
* Fedora release
*
* Revision 1.15 2008/12/13 20:29:56 customdesigned
* Split off milter applications.
*
* Revision 1.14 2008/12/04 19:43:00 customdesigned * Revision 1.14 2008/12/04 19:43:00 customdesigned
* Doc updates. * Doc updates.
* *
@@ -1100,7 +1094,7 @@ milter_addrcpt(PyObject *self, PyObject *args) {
PyThreadState *t; PyThreadState *t;
int rc; int rc;
if (!PyArg_ParseTuple(args, "s|z:addrcpt", &rcpt, &params)) return NULL; if (!PyArg_ParseTuple(args, "s|z:addrcpt", &rcpt)) return NULL;
ctx = _find_context(self); ctx = _find_context(self);
if (ctx == NULL) return NULL; if (ctx == NULL) return NULL;
t = PyEval_SaveThread(); t = PyEval_SaveThread();
@@ -1152,8 +1146,8 @@ milter_replacebody(PyObject *self, PyObject *args) {
ctx = _find_context(self); ctx = _find_context(self);
if (ctx == NULL) return NULL; if (ctx == NULL) return NULL;
t = PyEval_SaveThread(); t = PyEval_SaveThread();
return _thread_return(t,smfi_replacebody(ctx, return _thread_return(t,smfi_replacebody(ctx, bodyp, bodylen),
(unsigned char *)bodyp, bodylen), "cannot replace message body"); "cannot replace message body");
} }
static char milter_setpriv__doc__[] = static char milter_setpriv__doc__[] =
+38 -63
View File
@@ -1,33 +1,23 @@
# EL 3,4,5 supported, set to 0 for Fedora
%if 0%{?el3} || 0%{?el4}
%define __python python2.4 %define __python python2.4
%endif %define version 0.9.0
%define release 1.el4
%define libdir %{_libdir}/pymilter %define libdir %{_libdir}/pymilter
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} %define name pymilter
%define pythonbase %(basename %{__python}) %define redhat7 0
Summary: Python interface to sendmail milter API Summary: Python interface to sendmail milter API
Name: pymilter Name: %{name}
Version: 0.9.1 Version: %{version}
Release: 1%{dist} Release: %{release}
Source: http://downloads.sourceforge.net/pymilter/%{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
Patch: %{name}-smutil.patch #Patch: %{name}-%{version}.patch
Patch1: %{name}-start.patch
License: GPLv2+ License: GPLv2+
Group: Development/Libraries Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRoot: %{_tmppath}/%{name}-buildroot
Vendor: Stuart D. Gathman <stuart@bmsi.com>
Url: http://www.bmsi.com/python/milter.html Url: http://www.bmsi.com/python/milter.html
Requires: %{pythonbase} >= 2.4, sendmail >= 8.13 Requires: %{__python} >= 2.4, sendmail >= 8.13
%if 0%{?el3} || 0%{?el4} BuildRequires: %{__python}-devel >= 2.4, sendmail-devel >= 8.13
# Need python2.4 specific pydns, not the version for system python
Requires: pydns
%else
# Needed for callbacks, not a core function but highly useful for milters
Requires: python-pydns
%endif
BuildRequires: ed, %{pythonbase}-devel >= 2.4, sendmail-devel >= 8.13
%description %description
This is a python extension module to enable python scripts to This is a python extension module to enable python scripts to
@@ -37,32 +27,30 @@ DSNs, and doing CBV.
%prep %prep
%setup -q %setup -q
%patch -p0 -b .smutil #patch -p0 -b .bms
%patch1 -p0 -b .start
%build %build
env CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build %if %{redhat7}
LDFLAGS="-s"
%else # Redhat builds debug packages after 7.3
LDFLAGS="-g"
%endif
env CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$LDFLAGS" %{__python} setup.py build
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --root=$RPM_BUILD_ROOT %{__python} setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/milter mkdir -p $RPM_BUILD_ROOT/var/run/milter
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/milter
mkdir -p $RPM_BUILD_ROOT%{libdir} mkdir -p $RPM_BUILD_ROOT%{libdir}
%ifos aix4.1
cat >$RPM_BUILD_ROOT%{libdir}/start.sh <<'EOF'
#!/bin/sh
cd /var/log/milter
exec /usr/local/bin/python bms.py >>milter.log 2>&1
EOF
%else # not aix4.1
cp start.sh $RPM_BUILD_ROOT%{libdir} cp start.sh $RPM_BUILD_ROOT%{libdir}
ed $RPM_BUILD_ROOT%{libdir}/start.sh <<'EOF' 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=/ /^python=/
c c
python="%{__python}" python="%{__python}"
@@ -70,56 +58,43 @@ python="%{__python}"
w w
q q
EOF EOF
%endif
chmod a+x $RPM_BUILD_ROOT%{libdir}/start.sh chmod a+x $RPM_BUILD_ROOT%{libdir}/start.sh
%if !%{redhat7}
#grep '.pyc$' INSTALLED_FILES | sed -e 's/c$/o/' >>INSTALLED_FILES
%endif
# start.sh is used by spfmilter and milter, and could be used by # start.sh is used by spfmilter and milter, and could be used by
# other milters using pymilter. # other milters running on redhat
%files %files -f INSTALLED_FILES
%defattr(-,root,root,-) %defattr(-,root,root)
%doc README ChangeLog NEWS TODO CREDITS sample.py milter-template.py %doc README ChangeLog NEWS TODO CREDITS sample.py milter-template.py
%{python_sitearch}/* %config %{libdir}/start.sh
%{libdir} %dir %attr(0755,mail,mail) /var/run/milter
%dir %attr(0755,mail,mail) %{_localstatedir}/run/milter
%dir %attr(0755,mail,mail) %{_localstatedir}/log/milter
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Wed Jan 07 2009 Stuart Gathman <stuart@bmsi.com> 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 <stuart@bmsi.com> 0.9.0-2
- Changes to meet Fedora standards
* Mon Nov 24 2008 Stuart Gathman <stuart@bmsi.com> 0.9.0-1 * Mon Nov 24 2008 Stuart Gathman <stuart@bmsi.com> 0.9.0-1
- Split pymilter into its own CVS module - Split pymilter into its own CVS module
- Support chgfrom and addrcpt_par - Support chgfrom and addrcpt_par
- Support NS records in Milter.dns - Support NS records in Milter.dns
* Mon Aug 25 2008 Stuart Gathman <stuart@bmsi.com> 0.8.10-2 * Mon Aug 25 2008 Stuart Gathman <stuart@bmsi.com> 0.8.10-2
- /var/run/milter directory must be owned by mail - /var/run/milter directory must be owned by mail
* Mon Aug 25 2008 Stuart Gathman <stuart@bmsi.com> 0.8.10-1 * Mon Aug 25 2008 Stuart Gathman <stuart@bmsi.com> 0.8.10-1
- improved parsing into email and fullname (still 2 self test failures) - improved parsing into email and fullname (still 2 self test failures)
- implement no-DSN CBV, reduce full DSNs - implement no-DSN CBV, reduce full DSNs
* Mon Sep 24 2007 Stuart Gathman <stuart@bmsi.com> 0.8.9-1 * Mon Sep 24 2007 Stuart Gathman <stuart@bmsi.com> 0.8.9-1
- Use ifarch hack to build milter and milter-spf packages as noarch - Use ifarch hack to build milter and milter-spf packages as noarch
- Remove spf dependency from dsn.py, add dns.py - Remove spf dependency from dsn.py, add dns.py
* Fri Jan 05 2007 Stuart Gathman <stuart@bmsi.com> 0.8.8-1 * Fri Jan 05 2007 Stuart Gathman <stuart@bmsi.com> 0.8.8-1
- move AddrCache, parse_addr, iniplist to Milter package - move AddrCache, parse_addr, iniplist to Milter package
- move parse_header to Milter.utils - move parse_header to Milter.utils
- fix plock for missing source and can't change owner/group - fix plock for missing source and can't change owner/group
- split out pymilter and pymilter-spf packages - split out pymilter and pymilter-spf packages
- move milter apps to /usr/lib/pymilter - move milter apps to /usr/lib/pymilter
* Sat Nov 04 2006 Stuart Gathman <stuart@bmsi.com> 0.8.7-1 * Sat Nov 04 2006 Stuart Gathman <stuart@bmsi.com> 0.8.7-1
- SPF moved to pyspf RPM - SPF moved to pyspf RPM
* Tue May 23 2006 Stuart Gathman <stuart@bmsi.com> 0.8.6-2 * Tue May 23 2006 Stuart Gathman <stuart@bmsi.com> 0.8.6-2
- Support CBV timeout - Support CBV timeout
+4 -5
View File
@@ -2,11 +2,10 @@ import os
import sys import sys
from distutils.core import setup, Extension from distutils.core import setup, Extension
# FIXME: on some versions of sendmail, smutil is renamed to sm. # FIXME: on some versions of sendmail, smutil is renamed to sm
# On slackware and debian, leave it out entirely. It depends # on slackware and debian, leave it out entirely. It depends
# on how libmilter was built by the sendmail package. # on how libmilter was built by the sendmail package.
#libs = ["milter", "smutil"] libs = ["milter", "smutil"]
libs = ["milter"]
libdirs = ["/usr/lib/libmilter"] # needed for Debian libdirs = ["/usr/lib/libmilter"] # needed for Debian
# patch distutils if it can't cope with the "classifiers" or # patch distutils if it can't cope with the "classifiers" or
@@ -17,7 +16,7 @@ if sys.version < '2.2.3':
DistributionMetadata.download_url = None DistributionMetadata.download_url = None
# NOTE: importing Milter to obtain version fails when milter.so not built # NOTE: importing Milter to obtain version fails when milter.so not built
setup(name = "pymilter", version = '0.9.1', setup(name = "pymilter", version = '0.9.0',
description="Python interface to sendmail milter API", description="Python interface to sendmail milter API",
long_description="""\ long_description="""\
This is a python extension module to enable python scripts to This is a python extension module to enable python scripts to
+3 -5
View File
@@ -1,16 +1,14 @@
#!/bin/sh #!/bin/sh
appname="$1" appname="$1"
script="${2:-${appname}}" script="${2:-${appname}}"
datadir="/var/log/milter" datadir=/var/log/milter
piddir="/var/run/milter"
libdir="/usr/lib/pymilter"
python="python2.4" python="python2.4"
exec >>${datadir}/${appname}.log 2>&1 exec >>${datadir}/${appname}.log 2>&1
if test -s ${datadir}/${script}.py; then if test -s ${datadir}/${script}.py; then
cd ${datadir} # use version in log dir if it exists for debugging cd ${datadir} # use version in log dir if it exists for debugging
else else
cd ${libdir} cd /usr/lib/pymilter
fi fi
${python} ${script}.py & ${python} ${script}.py &
echo $! >${piddir}/${appname}.pid echo $! >/var/run/milter/${appname}.pid