ports/78698: Update spamass-milter to 0.3.0

Jeremy Chadwick freebsd at jdc.parodius.com
Fri Mar 11 14:00:14 UTC 2005


>Number:         78698
>Category:       ports
>Synopsis:       Update spamass-milter to 0.3.0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 11 14:00:13 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Jeremy Chadwick
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
Parodius Networking
>Environment:
System: FreeBSD pentarou.parodius.com 4.11-STABLE FreeBSD 4.11-STABLE #0: Sat Feb 5 08:39:49 PST 2005 root at pentarou.parodius.com:/usr/obj/usr/src/sys/PENTAROU i386
>Description:
	Update spamass-milter port to the official 0.3.0 release.  Also
	applied some additional changes to the port:

	* Add additional spamass-milter documentation to DOCSDIR.
	* Update the rc.subr(8) script to be more friendly when sendmail
	  isn't presently running.
	* Update pkg-message to mention using spamd_flags="-u nobody" so
	  that spamd warnings don't show up in the maillog.
	* Mention correct path to sa-spamd.sh rc.subr(8) script in
	  activation.txt.
	* Other changes, see Makefile...

	Verified to work as expected on FreeBSD 5.4-PRERELEASE.

	Also: the port maintainer is "ports at freebsd.org".  If you need an
	official maintainer, I can happily maintain this.
>How-To-Repeat:
	n/a
>Fix:
	Apply below patch.

	NOTE: Committer should remove files/patch-spamass-milter.cpp.
	It has been integrated into 0.3.0.


diff -ruN spamass-milter.orig/Makefile spamass-milter/Makefile
--- spamass-milter.orig/Makefile	Wed Nov 10 00:49:52 2004
+++ spamass-milter/Makefile	Fri Mar 11 05:41:42 2005
@@ -6,29 +6,28 @@
 #
 
 PORTNAME=	spamass-milter
-PORTVERSION=	0.2.0
-PORTREVISION=	5
+PORTVERSION=	0.3.0
 CATEGORIES=	mail
 MASTER_SITES=	${MASTER_SITE_SAVANNAH}
 MASTER_SITE_SUBDIR=	spamass-milt
 
 MAINTAINER=	ports at FreeBSD.org
-COMMENT=	Sendmail Milter (mail filter) for SpamAssassin
+COMMENT=	Sendmail Milter (mail filter) plugin for SpamAssassin
 
 BUILD_DEPENDS=	spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin
 RUN_DEPENDS=	spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin
 
+##
+# Use the following quirks to choose which sendmail to use (ports or system):
 #
-# You can choose the sendmail to be used by specifying
+#   WITH_SENDMAIL_BASE=yes
+# or
+#   WITH_SENDMAIL_PORT=yes
 #
-# WITH_SENDMAIL_BASE=yes
-#  or
-# WITH_SENDMAIL_PORT=yes
+# If unspecified, check for an up-to-date system version but give an
+# installed port preference over it.
 #
 
-# if no preference was set, check for an up to date base version
-# but give an installed port preference over it.
-
 .include <bsd.port.pre.mk>
 
 .if exists(${LOCALBASE}/lib/libldap.so)
@@ -36,7 +35,7 @@
 .endif
 
 .if !defined(WITHOUT_LDAP) && defined(WITH_LDAP)
-USE_OPENLDAP=		yes
+USE_OPENLDAP=yes
 .endif
 
 .if !defined(WITH_SENDMAIL_BASE) && \
@@ -56,25 +55,27 @@
 MILTERBASE?=	${LOCALBASE}
 .endif
 
+.if !defined(NOPORTDOCS)
+PORTDOCS=	AUTHORS ChangeLog NEWS README TODO
+.endif
+
 MILTERINC=	${MILTERBASE}/include
 MILTERLIB=	${MILTERBASE}/lib
 
 CPPFLAGS+=	-I${MILTERINC}
 LDFLAGS+=	-L${MILTERLIB}
 
-GNU_CONFIGURE=	yes
-CONFIGURE_ENV+=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
-
 USE_REINPLACE=	yes
-
 USE_RC_SUBR=	yes
+GNU_CONFIGURE=	yes
+CONFIGURE_ENV+=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
 RC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
 
+PKGMESSAGE=	${WRKDIR}/pkg-message
+
 MAN1=		spamass-milter.1
 
 post-patch:
-	@${SED} -e 's|/usr/local|${PREFIX}|g' \
-		${FILESDIR}/activation.txt > ${WRKDIR}/activation.txt
 	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
 		${FILESDIR}/spamass-milter.sh > ${WRKDIR}/spamass-milter.sh
 .if !defined(WITHOUT_LDAP) && defined(WITH_LDAP)
@@ -83,10 +84,17 @@
 
 post-install:
 	@${INSTALL_SCRIPT} ${WRKDIR}/spamass-milter.sh ${PREFIX}/etc/rc.d/spamass-milter.sh
+	@${SED} -e's,%%PREFIX%%,${PREFIX},g' \
+		${FILESDIR}/activation.txt > ${WRKDIR}/activation.txt
 .if !defined(NOPORTDOCS)
-	${MKDIR} ${DOCSDIR}
-	${INSTALL_DATA} ${WRKDIR}/activation.txt ${DOCSDIR}/activation.txt
+	@${MKDIR} ${DOCSDIR}
+	@${INSTALL_DATA} ${WRKDIR}/activation.txt ${DOCSDIR}/activation.txt
+.for f in ${PORTDOCS}
+	@${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
+.endfor
 .endif
+	@${SED} -e's,%%DOCSDIR%%,${DOCSDIR},g' \
+		${MASTERDIR}/pkg-message > ${PKGMESSAGE}
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
diff -ruN spamass-milter.orig/distinfo spamass-milter/distinfo
--- spamass-milter.orig/distinfo	Tue Mar 30 19:09:25 2004
+++ spamass-milter/distinfo	Fri Mar 11 04:52:42 2005
@@ -1,2 +1,2 @@
-MD5 (spamass-milter-0.2.0.tar.gz) = 70da3e4a6039f5e738ce21f69430e230
-SIZE (spamass-milter-0.2.0.tar.gz) = 113894
+MD5 (spamass-milter-0.3.0.tar.gz) = ced600331a0df7609fdbdf0e6d0eb943
+SIZE (spamass-milter-0.3.0.tar.gz) = 140126
diff -ruN spamass-milter.orig/files/activation.txt spamass-milter/files/activation.txt
--- spamass-milter.orig/files/activation.txt	Fri Jun 25 02:37:43 2004
+++ spamass-milter/files/activation.txt	Fri Mar 11 05:16:22 2005
@@ -6,35 +6,29 @@
 
 2. If you didn't activate spamd (the SpamAssassin daemon), do so now:
 
-	/usr/local/etc/rc.d/spamd.sh start
+	%%PREFIX%%/etc/rc.d/sa-spamd.sh start
 
 3. Activate spamass-milter:
 
-	/usr/local/etc/rc.d/spamass-milter.sh start
+	%%PREFIX%%/etc/rc.d/spamass-milter.sh start
 
 4. Backup your sendmail.cf (in /etc/mail).
 
 5. If you didn't create your own customized version of Sendmail .mc
-   file, create one from the default template (replace YOURNAME with a
-   suitable name; a good candidate is the output of `hostname -s'):
+   file, create one from the default template (hostname.mc):
 
 	cd /etc/mail
-	cp -p freebsd.mc YOURNAME.mc
-	echo "SENDMAIL_MC = /etc/mail/YOURNAME.mc" >> /etc/make.conf
-
-   The last line tells the system to use your customized version instead
-   of the default freebsd.mc when you run mergemaster(8) later on.
+	make
 
-6. Add the spamass-milter hook to your Sendmail .mc file.  The magic
+6. Add the spamass-milter hook to your hostname.mc file.  The magic
    line to add is:
 
 	INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')
+	define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
 
    Everything should go on a single line, no line break/continuation is
-   allowed!
-
-   The best place to add this is right after the dnsbl-related comments.
-   (Hint: Every comment in an .mc file starts with `dnl'.)
+   allowed!  The best place to add this is right after the dnsbl-related
+   comments.  (Hint: Every comment in an .mc file starts with `dnl'.)
 
 7. Rebuild the sendmail.cf from your .mc file:
 
@@ -42,39 +36,31 @@
 	make
 	make install
 
-   Or you can run mergemaster(8) instead if you want, although it's an
-   overkill.
-
 8. Restart Sendmail:
 
-	kill -HUP `head -1 /var/run/sendmail.pid`
+	cd /etc/mail
+	make stop
+	make start
 
 9. Test the whole piece:
 
-	/usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-nonspam.txt
-	/usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-spam.txt
+	echo "Testing spamass-milter..." | mail -s"Spam test" root
 
-   Each of these commands might take a long time to finish (up to about
-   10-20 seconds), so please be patient.
+   This might take a long time to finish (up to about 10-20 seconds),
+   since spamd has just started, so please be patient.
 
-   You should receive two messages, one from `Keith Dawson' and the
-   other from xl6Ety00V at fismat1.fcfm.buap.mx.  The one from Keith Dawson
-   shouldn't be tagged as a spam, bearing this header line:
+   You (root) should receive a message from root at hostname, bearing this
+   header line:
 
 	X-Spam-Status: No, ...
 
-   On the other hand, the one from xl6Ety00V at fismat1.fcfm.buap.mx should
-   be tagged as a spam, bearing these two header lines:
-
-	X-Spam-Status: Yes, ...
-	X-Spam-Flag: YES
-
-   If things don't work as expected, promptly restore your sendmail.cf
-   from the backup copy then restart sendmail as shown on step 8; you
-   may lose incoming mail otherwise!
+   If things don't work as expected, promptly restore the stock FreeBSD
+   sendmail.cf (/etc/mail/freebsd.cf) as your default sendmail config,
+   or restore your own backup (if you keep one), as shown in step 8;
+   you may lose incoming mail otherwise!
 
 
 Now all messages received by Sendmail are filtered through
 SpamAssassin, and probable spam messages are tagged with the header
 `X-Spam-Flag: YES'.  Tell your users about this so they can set up
-appropriate filters on their mail reader.
+appropriate filters in their mail client.
diff -ruN spamass-milter.orig/files/patch-spamass-milter.cpp spamass-milter/files/patch-spamass-milter.cpp
--- spamass-milter.orig/files/patch-spamass-milter.cpp	Sat Oct 16 01:49:07 2004
+++ spamass-milter/files/patch-spamass-milter.cpp	Wed Dec 31 16:00:00 1969
@@ -1,64 +0,0 @@
---- spamass-milter.cpp.orig	Thu Jun 26 16:10:44 2003
-+++ spamass-milter.cpp	Wed Oct 13 00:52:23 2004
-@@ -102,6 +102,10 @@
- #include <csignal>
- #include <string>
- #include <iostream>
-+using std::string;
-+using std::cout;
-+using std::cerr;
-+using std::endl;
- 
- #ifdef  __cplusplus
- extern "C" {
-@@ -273,6 +277,7 @@
- 				exit(errno);
- 				break;
- 			case 0: /* Child */
-+				setsid();
- 				break;
- 			default: /* Parent */
- 				exit(0);
-@@ -351,6 +356,9 @@
-   string::size_type eoh = ( eoh1 < eoh2 ? eoh1 : eoh2 );
-   string::size_type bob = assassin->d().find_first_not_of("\r\n", eoh);
- 
-+  if (bob == string::npos)
-+  	bob = assassin->d().size();
-+
-   update_or_insert(assassin, ctx, assassin->spam_flag(), &SpamAssassin::set_spam_flag, "X-Spam-Flag");
-   update_or_insert(assassin, ctx, assassin->spam_status(), &SpamAssassin::set_spam_status, "X-Spam-Status");
- 
-@@ -365,7 +373,7 @@
- 	{
- 		int score, rv;
- 		const char *spam_status = assassin->spam_status().c_str();
--		rv = sscanf(spam_status,"%*s hits=%d", &score);
-+		rv = sscanf(spam_status,"%*s score=%d", &score);
- 		if (rv != 1)
- 			debug(D_ALWAYS, "Could not extract score from <%s>", spam_status);
- 		else 
-@@ -539,6 +547,10 @@
- 	}
-   }
- 
-+  /* if the header line ends in \r\n, don't return the \r */
-+  if (header[field_end-1] == '\r')
-+	field_end--;
-+
-   //  Maybe remove the whitespace picked up when a header wraps - this
-   //  might actually be a requirement
-   return header.substr( field_start, field_end - field_start );
-@@ -1341,7 +1353,11 @@
- {
-   // assuming we have a recipient in the form: <username at somehost.somedomain>
-   // we return 'username'
--  return _rcpt.substr(1,_rcpt.find('@')-1);
-+  int at = _rcpt.find('@');
-+  int plus = _rcpt.find('+');
-+  if (plus > 0 && plus < at)
-+    at = plus;
-+  return _rcpt.substr(1,at-1);
- }
- 
- int
diff -ruN spamass-milter.orig/files/spamass-milter.sh spamass-milter/files/spamass-milter.sh
--- spamass-milter.orig/files/spamass-milter.sh	Tue May 25 02:08:26 2004
+++ spamass-milter/files/spamass-milter.sh	Fri Mar 11 04:56:56 2005
@@ -24,27 +24,33 @@
 command=%%PREFIX%%/sbin/spamass-milter
 required_dirs=%%PREFIX%%/share/spamassassin
 
-# set defaults
-
-spamass_milter_enable=${spamass_milter_enable:-"NO"}
-spamass_milter_socket=${spamass_milter_socket:-"/var/run/spamass-milter.sock"}
-spamass_milter_flags=${spamass_milter_flags:-"-f -p ${spamass_milter_socket}"}
-
 start_postcmd=start_postcmd
 stop_postcmd=stop_postcmd
 
 start_postcmd()
 {
-  sleep 1
-  kill -HUP `head -1 /var/run/sendmail.pid`
+  if test -f /var/run/sendmail.pid
+  then
+	sleep 1
+	kill -HUP `head -1 /var/run/sendmail.pid`
+  fi
 }
 
 stop_postcmd()
 {
   rm -f ${spamass_milter_socket}
-  sleep 1
-  kill -HUP `head -1 /var/run/sendmail.pid`
+  if test -f /var/run/sendmail.pid
+  then
+	sleep 1
+	kill -HUP `head -1 /var/run/sendmail.pid`
+  fi
 }
+
+# set defaults
+
+spamass_milter_enable=${spamass_milter_enable:-"NO"}
+spamass_milter_socket=${spamass_milter_socket:-"/var/run/spamass-milter.sock"}
+spamass_milter_flags=${spamass_milter_flags:-"-f -p ${spamass_milter_socket}"}
 
 load_rc_config ${name}
 run_rc_command "$1"
diff -ruN spamass-milter.orig/pkg-descr spamass-milter/pkg-descr
--- spamass-milter.orig/pkg-descr	Wed Jun 26 11:54:01 2002
+++ spamass-milter/pkg-descr	Fri Mar 11 04:41:15 2005
@@ -1,5 +1,5 @@
-spamass-milter is a little plugin for the Sendmail Milter (Mail Filter)
-library that pipes all incoming mail (including things received by
-rmail/UUCP) through the SpamAssassin, a highly customizable SpamFilter.
+spamass-milter is a plugin for the Sendmail Milter (Mail Filter) library
+that pipes all incoming mail (including things received by rmail/UUCP)
+through the SpamAssassin, a highly customizable spam filter.
 
 WWW: http://savannah.gnu.org/projects/spamass-milt/
diff -ruN spamass-milter.orig/pkg-message spamass-milter/pkg-message
--- spamass-milter.orig/pkg-message	Wed Jun 26 11:54:01 2002
+++ spamass-milter/pkg-message	Fri Mar 11 05:51:03 2005
@@ -1,5 +1,14 @@
+
 ------------------------------------------------------------------------
-spamass-milter has been installed, but you have to activate it manually
-to use it.  Refer to ${PREFIX}/share/doc/spamass-milter/activation.txt
-for details.
+spamass-milter has been installed, but it must be activated manually.
+Pleae refer to...
+
+  %%DOCSDIR%%/activation.txt
+
+...for details.
+
+You may also want to tweak your spamd rc.subr(8) startup flags to
+specify a username to switch credentials to when delivering mail, if
+applicable.
 ------------------------------------------------------------------------
+
diff -ruN spamass-milter.orig/pkg-plist spamass-milter/pkg-plist
--- spamass-milter.orig/pkg-plist	Tue May 25 02:08:26 2004
+++ spamass-milter/pkg-plist	Fri Mar 11 05:31:28 2005
@@ -1,4 +1,4 @@
 sbin/spamass-milter
 etc/rc.d/spamass-milter.sh
-%%PORTDOCS%%share/doc/spamass-milter/activation.txt
-%%PORTDOCS%%@dirrm share/doc/spamass-milter
+%%PORTDOCS%%%%DOCSDIR%%/activation.txt
+ at unexec rmdir %%DOCSDIR%% 2>/dev/null || true
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list