Index: contrib/tmda.spec
===================================================================
RCS file: /cvsroot/tmda/tmda/contrib/tmda.spec,v
retrieving revision 1.56
diff -u -r1.56 tmda.spec
--- contrib/tmda.spec	7 Dec 2002 10:50:29 -0000	1.56
+++ contrib/tmda.spec	14 Dec 2002 03:56:11 -0000
@@ -1,5 +1,5 @@
 %define name tmda
-%define version 0.65
+%define version 0.66
 %define release 1
 
 Summary: Tagged Message Delivery Agent
@@ -9,8 +9,7 @@
 Source0: http://tmda.net/releases/%{name}-%{version}.tgz
 License: GPL
 Group: Utilities/System
-BuildRoot: /var/tmp/%{name}-buildroot
-BuildArchitectures: noarch
+BuildRoot: %{_tmppath}/%{name}-buildroot
 Vendor: Jason R. Mastaler <jason@mastaler.com>
 Packager: tmda-workers@tmda.net
 Url: http://tmda.net/
@@ -24,10 +23,12 @@
 (for undesired senders), and a cryptographically enhanced confirmation
 system (for unknown, but legitimate senders).
 
+
 %prep
 %setup
 
 %build
+rm -rf %{buildroot}
 %define pypath %(if [ `type -p python2` ]; then type -p python2; else type -p python; fi)
 
 # fix shbang line in all executable files
@@ -37,22 +38,46 @@
 done
 
 %pypath ./compileall
+pushd contrib/cgi
+%pypath ./compile -i %{pylibdir}/TMDA/cgi -m system-wide
 
 %install
 %define pyprefix %(%pypath -c 'import sys; print sys.prefix')
 %define pyver %(%pypath -c 'import sys; print sys.version[:3]')
 %define pylibdir %{pyprefix}/lib/python%{pyver}/site-packages
+%define cgidir %{pylibdir}/TMDA/cgi
+%define httpdconfdir %{_sysconfdir}/httpd/conf.d
 mkdir -p %{buildroot}%{_bindir}
+mkdir -p %{buildroot}%{_sbindir}
 mkdir -p %{buildroot}%{_datadir}/tmda
+mkdir -p %{buildroot}%{_datadir}/emacs/site-lisp
 mkdir -p %{buildroot}%{pylibdir}/TMDA/pythonlib/email
+mkdir -p %{buildroot}%{cgidir}/display
+mkdir -p %{buildroot}%{_sysconfdir}/{rc.d/init.d,sysconfig}
+mkdir -p %{buildroot}%{httpdconfdir}
 install bin/tmda-* %{buildroot}%{_bindir}
+rm -f %{buildroot}%{_bindir}/tmda-ofmipd
+install bin/tmda-ofmipd %{buildroot}%{_sbindir}
 install templates/*.txt %{buildroot}%{_datadir}/tmda
 install TMDA/*.{py,pyc} %{buildroot}%{pylibdir}/TMDA
 install TMDA/pythonlib/email/*.{py,pyc} %{buildroot}%{pylibdir}/TMDA/pythonlib/email
+install contrib/print{cdb,dbm} %{buildroot}%{_bindir}
+install contrib/collectaddys %{buildroot}%{_bindir}
+install contrib/tmda.el %{buildroot}%{_datadir}/emacs/site-lisp
+install contrib/cgi/*.{py,pyc} %{buildroot}%{cgidir}
+install contrib/cgi/tmda-cgi %{buildroot}%{cgidir}/tmda.cgi
+install contrib/cgi/display/*.{gif,css} %{buildroot}%{cgidir}/display
+install contrib/ofmipd.init %{buildroot}%{_sysconfdir}/rc.d/init.d/ofmipd
+install contrib/ofmipd.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/ofmipd
+install contrib/ofmipd.passwd %{buildroot}%{_sysconfdir}/ofmipd
+cat contrib/cgi/tmda-cgi.conf | sed -e 's|SITE_DIR|%{cgidir}|' > %{buildroot}%{httpdconfdir}/tmda.conf
+ln -s %{_bindir}/tmda-inject %{buildroot}%{_sbindir} 
 
 %clean
 rm -rf %{buildroot}
 
+%ifarch noarch
+
 %files
 %attr(0755,root,root) %{_bindir}/*
 %attr(0644,root,root) %{pylibdir}/TMDA/*.py
@@ -63,7 +88,86 @@
 
 %doc --parents ChangeLog CODENAMES COPYING CRYPTO INSTALL README THANKS UPGRADE contrib/ htdocs/{README,*.html}
 
+%package ofmipd
+Summary: Tagged Message Delivery Agent - ofmipd server
+Group: System/Daemons
+BuildArch: noarch
+Requires: tmda >= %{version}
+%description ofmipd
+TMDA is an OSI certified software application designed to
+significantly reduce the amount of SPAM/UCE (junk-mail) you receive.
+This subpackage is the ofmipd server.
+
+%files ofmipd
+%attr(0755,root,root) %{_sbindir}/tmda-ofmipd
+%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/ofmipd
+%attr(0755,root,root) %{_sysconfdir}/ofmipd
+%{_sbindir}/tmda-inject
+%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/ofmipd
+%config(noreplace) %attr(0400,root,root) %{_sysconfdir}/ofmipd
+
+%pre ofmipd
+/usr/sbin/groupadd -r ofmipd >/dev/null 2>&1 || :
+/usr/sbin/useradd -r -g ofmipd -d /var/tmp -s /dev/null ofmipd >/dev/null 2>&1 || :
+
+%post ofmipd
+chkconfig --add ofmipd
+
+%preun ofmipd
+service ofmipd stop > /dev/null 2>&1 || :
+chkconfig --del ofmipd
+
+%postun ofmipd
+/usr/sbin/userdel ofmipd >/dev/null 2>&1 || :
+/usr/sbin/groupdel ofmipd >/dev/null 2>&1 || :
+
+
+%package emacs
+Summary: Tagged Message Deliver Agent - Emacs Support Files
+Group: Utilities/System
+Requires: tmda >= %{version}, emacs
+%description emacs
+TMDA is an OSI certified software application designed to
+significantly reduce the amount of SPAM/UCE (junk-mail) you receive.
+This subpackage is the emacs support files for TMDA.
+
+%files emacs
+%attr(0644,root,root) %{_datadir}/emacs/site-lisp/tmda.el
+
+%endif
+
+# Build architecture specific cgi files - this is architecture specific
+# because of the one binary file that gets built
+%ifnarch noarch
+%package cgi
+Summary: Tagged Message Delivery Agent - CGI Interface
+Group: Utilities/System
+BuildArch: i386
+Requires: tmda >= %{version}, httpd
+%description cgi
+TMDA is an OSI certified software application designed to
+significantly reduce the amount of SPAM/UCE (junk-mail) you receive.
+This subpackage is the CGI interface to TMDA.
+
+%files cgi
+%attr(0644,root,root) %{cgidir}/*.py
+%verify(not size md5 mtime) %attr(0644,root,root) %{cgidir}/*.pyc
+%attr(4755,root,root) %{cgidir}/tmda.cgi
+%attr(0644,root,root) %{cgidir}/display/*
+%config(noreplace) %attr(0644,root,root) %{httpdconfdir}/tmda.conf
+%doc contrib/cgi/README
+
+%post cgi
+service httpd reload > /dev/null 2>&1 || :
+
+%postun cgi
+service httpd reload > /dev/null 2>&1 || :
+
+%endif
+
 %changelog
+* Sun Dec 01 2002 Bernard Johnson <bjohnson@symetrix.com>
+  - version 0.66, repackages for subpackages, builds multiple archs
 
 * Wed Jun 06 2001 Ron Bickers <rbickers@logicetc.com>
   - initial RPM of TMDA 0.18
--- /dev/null	Thu Apr 11 10:25:15 2002
+++ contrib/ofmipd.init	Mon Dec  2 14:36:21 2002
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# Startup script for the TMDA ofmipd server
+#
+# chkconfig: 2345 87 13
+# description: ofmipd is a server that allows tagging of outgoing mail \
+#          for the TMDA system.
+# processname: ofmipd
+# pidfile: /var/run/ofmipd.pid
+# config: /etc/ofmipd.conf
+
+# Path to the script, server binary, and short-form for messages.
+program=/usr/sbin/tmda-ofmipd
+progname=ofmipd
+lockfile=/var/lock/subsys/ofmipd
+pidfile=/var/run/ofmipd.pid
+RETVAL=0
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+if [ -f /etc/sysconfig/$progname ]; then
+        . /etc/sysconfig/$progname
+fi
+
+start() {
+        echo -n $"Starting $progname: "
+        daemon $program $OPTIONS &
+        RETVAL=$?
+        echo
+        [ $RETVAL = 0 ] && touch $lockfile
+        return $RETVAL
+}
+stop() {
+	echo -n $"Stopping $progname: "
+	killproc $program
+	RETVAL=$?
+	echo
+	[ $RETVAL = 0 ] && rm -f $lockfile $pidfile
+}
+reload() {
+	echo -n $"Reloading $progname: "
+	killproc $program -HUP
+	RETVAL=$?
+	echo
+}
+
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  status)
+        status $program
+	RETVAL=$?
+	;;
+  restart)
+	stop
+	start
+	;;
+  condrestart)
+	if [ -f $pidfile ] ; then
+		stop
+		start
+	fi
+	;;
+  reload)
+        reload
+	;;
+  *)
+	echo $"Usage: $progname {start|stop|restart|condrestart|reload|status}"
+	exit 1
+esac
+
+exit $RETVAL
--- /dev/null	Thu Apr 11 10:25:15 2002
+++ contrib/ofmipd.passwd	Fri Dec 13 21:23:26 2002
@@ -0,0 +1,2 @@
+
+
--- /dev/null	Thu Apr 11 10:25:15 2002
+++ contrib/ofmipd.sysconfig	Fri Dec 13 16:53:06 2002
@@ -0,0 +1 @@
+OPTIONS="-u ofmipd -p 0.0.0.0 -R pop3://localhost"
--- /dev/null	Thu Apr 11 10:25:15 2002
+++ contrib/cgi/tmda-cgi.conf	Fri Dec 13 19:45:57 2002
@@ -0,0 +1,9 @@
+#
+# TMDA configuration file
+#
+Alias /tmda SITE_DIR
+AddHandler cgi-script .cgi
+<Directory SITE_DIR>
+    Options +ExecCGI
+    DirectoryIndex tmda.cgi
+</Directory>
