Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Mar 2014 22:16:25 +0000 (UTC)
From:      Adam Weinberger <adamw@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r347704 - in head/mail/p5-Mail-SpamAssassin: . files
Message-ID:  <201403092216.s29MGPXa085509@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adamw
Date: Sun Mar  9 22:16:24 2014
New Revision: 347704
URL: http://svnweb.freebsd.org/changeset/ports/347704
QAT: https://qat.redports.org/buildarchive/r347704/

Log:
  - Tidy the Makefile a bit more
  - Break database backends out into their own OPTIONS group, for clarity
  - Generalize the plugin enabling process to make it easier to add support
    for new ones
  - Remove an unnecessary rc.subr function, and use ${name} in the rc script
  - Put some marginally helpful comments in the rc script
  
  No PORTREVISION bump as all these changes don't affect the finished
  product, sortof.

Modified:
  head/mail/p5-Mail-SpamAssassin/Makefile
  head/mail/p5-Mail-SpamAssassin/files/sa-spamd.in

Modified: head/mail/p5-Mail-SpamAssassin/Makefile
==============================================================================
--- head/mail/p5-Mail-SpamAssassin/Makefile	Sun Mar  9 22:06:36 2014	(r347703)
+++ head/mail/p5-Mail-SpamAssassin/Makefile	Sun Mar  9 22:16:24 2014	(r347704)
@@ -13,7 +13,7 @@ DISTFILES=		${DISTNAME}${EXTRACT_SUFX}:a
 MAINTAINER?=	adamw@FreeBSD.org
 COMMENT?=		Highly efficient mail filter for identifying spam
 
-LICENSE=	APACHE20
+LICENSE=		APACHE20
 
 BUILD_DEPENDS=	p5-NetAddr-IP>=4.00.7:${PORTSDIR}/net-mgmt/p5-NetAddr-IP \
 				p5-Net-DNS>=0.63:${PORTSDIR}/dns/p5-Net-DNS \
@@ -43,8 +43,9 @@ CONFIGURE_ARGS=	SYSCONFDIR="${PREFIX}/et
 				LOCALSTATEDIR="${DBDIR}/spamassassin" \
 				BUILD_SPAMC=yes
 
-OPTIONS_DEFINE=	AS_ROOT GNUPG IPV6 MYSQL PGSQL SSL UPDATE_AND_COMPILE
-OPTIONS_GROUP=	PLUGINS
+OPTIONS_DEFINE=	AS_ROOT GNUPG IPV6 SSL UPDATE_AND_COMPILE
+OPTIONS_GROUP=	DATABASE PLUGINS
+OPTIONS_GROUP_DATABASE=	MYSQL PGSQL
 OPTIONS_GROUP_PLUGINS=	DCC DKIM PYZOR RAZOR RELAY_COUNTRY SPF_QUERY
 OPTIONS_DEFAULT=AS_ROOT DKIM GNUPG RAZOR SSL UPDATE_AND_COMPILE
 
@@ -54,7 +55,9 @@ IPV6_DESC=			IPv6 sockets support
 SSL_DESC=			Build spamd/spamc with SSL support
 UPDATE_AND_COMPILE_DESC=	Download and compile rulesets (recommended)
 
-PLUGINS_DESC=		Select SpamAssassin plugins
+DATABASE_DESC=		Optional user-config database backends
+
+PLUGINS_DESC=		Optional SpamAssassin plugins
 DCC_DESC=			Add DCC support (mail/dcc-dccd)
 DKIM_DESC=			DKIM/DomainKeys Identified Mail (mail/p5-Mail-DKIM)
 PYZOR_DESC=			Add Pyzor support (mail/pyzor)
@@ -84,6 +87,14 @@ SSL_RUN_DEPENDS=	p5-IO-Socket-SSL>=0:${P
 SSL_CONFIGURE_ON=	ENABLE_SSL=yes
 SSL_CONFIGURE_OFF=	ENABLE_SSL=no
 
+# plugin names in rules/*.pre, for enabling/disabling
+DCC_INITVAR=			DCC
+DKIM_INITVAR=			DKIM
+PYZOR_INITVAR=			Pyzor
+RAZOR_INITVAR=			Razor2
+RELAY_COUNTRY_INITVAR=	RelayCountry
+SPF_QUERY_INITVAR=		SPF
+
 DOCS=		CREDITS Changes INSTALL NOTICE PACKAGING README TRADEMARK UPGRADE USAGE procmailrc.example
 DOCSSQL=	README README.awl README.bayes awl_mysql.sql awl_pg.sql bayes_mysql.sql bayes_pg.sql userpref_mysql.sql userpref_pg.sql
 DOCSLDAP=	README README.testing sa_test.ldif
@@ -120,40 +131,29 @@ PLIST_SUB+=	UPDATE_ON_INSTALL="no"
 .endif
 
 post-patch::
-	@${FIND} ${WRKSRC} -name \*.orig -delete
-	@${REINPLACE_CMD} -e 's#B_CONFDIR)/local.cf#B_CONFDIR)/local.cf.sample#g' \
-		-e 's#B_CONFDIR)/init.pre#B_CONFDIR)/init.pre.sample#g' \
-		-e 's#B_CONFDIR)/v310.pre#B_CONFDIR)/v310.pre.sample#g' \
-		-e 's#B_CONFDIR)/v312.pre#B_CONFDIR)/v312.pre.sample#g' \
-		-e 's#B_CONFDIR)/v320.pre#B_CONFDIR)/v320.pre.sample#g' \
-		-e 's#B_CONFDIR)/v330.pre#B_CONFDIR)/v330.pre.sample#g' \
-		-e 's#B_CONFDIR)/v340.pre#B_CONFDIR)/v340.pre.sample#g' \
+	${FIND} ${WRKSRC} -name \*.orig -delete
+	${REINPLACE_CMD} -e 's,B_CONFDIR)/local.cf,B_CONFDIR)/local.cf.sample,g' \
+		-e 's,B_CONFDIR)/init.pre,B_CONFDIR)/init.pre.sample,g' \
+		-e 's,B_CONFDIR)/v310.pre,B_CONFDIR)/v310.pre.sample,g' \
+		-e 's,B_CONFDIR)/v312.pre,B_CONFDIR)/v312.pre.sample,g' \
+		-e 's,B_CONFDIR)/v320.pre,B_CONFDIR)/v320.pre.sample,g' \
+		-e 's,B_CONFDIR)/v330.pre,B_CONFDIR)/v330.pre.sample,g' \
+		-e 's,B_CONFDIR)/v340.pre,B_CONFDIR)/v340.pre.sample,g' \
 		-e 's/require DBI/0/' \
 		${WRKSRC}/Makefile.PL
-	@${REINPLACE_CMD} -e '/^CC =/d; \
+	${REINPLACE_CMD} -e '/^CC =/d; \
 		s|@SSLCFLAGS@|& $${CFLAGS}|g' ${WRKSRC}/spamc/Makefile.in
 
-.if ${PORT_OPTIONS:MDCC}
-	${REINPLACE_CMD} -e '/DCC/s/^#loadplugin/loadplugin/' ${WRKSRC}/rules/v310.pre
-.endif
-.if empty(PORT_OPTIONS:MDKIM)
-	${REINPLACE_CMD} -e '/DKIM/s/^loadplugin/#loadplugin/' ${WRKSRC}/rules/v312.pre
-.endif
-.if empty(PORT_OPTIONS:MPYZOR)
-	${REINPLACE_CMD} -e '/Pyzor/s/^loadplugin/#loadplugin/' ${WRKSRC}/rules/v310.pre
-.endif
-.if ${PORT_OPTIONS:MRAZOR}
-	${REINPLACE_CMD} -e '/Razor2/s/^#loadplugin/loadplugin/' ${WRKSRC}/rules/v312.pre
-.endif
-.if ${PORT_OPTIONS:MRELAY_COUNTRY}
-	${REINPLACE_CMD} -e '/RelayCountry/s/^# ?loadplugin/loadplugin/' ${WRKSRC}/rules/init.pre
-.endif
-.if empty(PORT_OPTIONS:MSPF_QUERY)
-	${REINPLACE_CMD} -e '/SPF/s/^loadplugin/#loadplugin/' ${WRKSRC}/rules/init.pre
-.endif
-.if ${PORT_OPTIONS:MSACOMPILE}
-	${REINPLACE_CMD} -e '/Rule2XSBody/s/^# loadplugin/loadplugin/' ${WRKSRC}/rules/v320.pre
-.endif
+.for var in ${OPTIONS_GROUP_PLUGINS}
+.  if ${PORT_OPTIONS:M${var}}
+	${REINPLACE_CMD} -e '/${${var}_INITVAR}/s/^\#.*loadplugin/loadplugin/' ${WRKSRC}/rules/*.pre
+.  else
+	${REINPLACE_CMD} -e '/${${var}_INITVAR}/s/^loadplugin/\# loadplugin/' ${WRKSRC}/rules/*.pre
+.  endif
+.endfor
+
+	# load pre-compiled rules
+	${REINPLACE_CMD} -e '/Rule2XSBody/s/^\# loadplugin/loadplugin/' ${WRKSRC}/rules/v320.pre
 
 pre-su-install:
 	@${MKDIR} ${STAGEDIR}${DATADIR}

Modified: head/mail/p5-Mail-SpamAssassin/files/sa-spamd.in
==============================================================================
--- head/mail/p5-Mail-SpamAssassin/files/sa-spamd.in	Sun Mar  9 22:06:36 2014	(r347703)
+++ head/mail/p5-Mail-SpamAssassin/files/sa-spamd.in	Sun Mar  9 22:16:24 2014	(r347704)
@@ -9,17 +9,20 @@
 # KEYWORD: shutdown
 
 #
-# Add the following lines to /etc/rc.conf to enable spamd:
+# Add the following line to /etc/rc.conf to enable spamd:
 #
-#spamd_enable="YES"
+#   spamd_enable="YES"
 #
-# See spamd(8) for flags
+# You can pass flags to spamd with spamd_flags="..."
+# To change the user that spamd runs as, use
+#
+#    spamd_flags="-u USER [-H /path/to/home... we suggest /var/spool/spamd]"
 #
 
 . /etc/rc.subr
 
 name=spamd
-rcvar=spamd_enable
+rcvar=${name}_enable
 
 extra_commands="reload"
 load_rc_config $name
@@ -28,16 +31,9 @@ load_rc_config $name
 : ${spamd_enable:="NO"}
 : ${spamd_flags="-c %%SQL_FLAG%% %%RUN_AS_USER%%"}
 
-pidfile=${spamd_pidfile:-"/var/run/spamd/spamd.pid"}
-command=%%PREFIX%%/bin/spamd
+pidfile=${spamd_pidfile:-"/var/run/${name}/${name}.pid"}
+command=%%PREFIX%%/bin/${name}
 command_args="-d -r ${pidfile}"
 required_dirs=%%PREFIX%%/share/spamassassin
 
-stop_postcmd=stop_postcmd
-
-stop_postcmd()
-{
-  rm -f $pidfile
-}
-
 run_rc_command "$1"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403092216.s29MGPXa085509>