Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 May 2010 19:21:16 GMT
From:      Marshal Newrock <marshal@zordio.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/147230: mail/spamass-milter improved adding command-line options
Message-ID:  <201005301921.o4UJLGQI026377@www.freebsd.org>
Resent-Message-ID: <201005301930.o4UJU3jn091980@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         147230
>Category:       ports
>Synopsis:       mail/spamass-milter improved adding command-line options
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 30 19:30:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Marshal Newrock
>Release:        7.2
>Organization:
Zordio
>Environment:
FreeBSD silver.zordio.com 7.2-RELEASE-p2 FreeBSD 7.2-RELEASE-p2 #0: Wed Jun 24 00:57:44 UTC 2009     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Whenever functionality is added which also adds a command-line option, additional patch files must be created to accomodate each possible combination of additional options.  Currently, there are two changes which add an option, and require four patches.

I am attaching a change which dynamically adds options to *args, generating the required patch on the fly.  This will make it easier to add future patches.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -Nur spamass-milter.orig/Makefile spamass-milter/Makefile
--- spamass-milter.orig/Makefile	2010-05-30 14:54:07.000000000 -0400
+++ spamass-milter/Makefile	2010-05-30 14:44:20.000000000 -0400
@@ -37,17 +37,22 @@
 
 .include <bsd.port.pre.mk>
 
+ORIG_ARGS=	fd:mMp:P:r:u:D:i:b:B:e:x
+NEW_ARGS:=	${ORIG_ARGS}
+
 .if defined(WITH_ADDAUTH_PATCH)
-EXTRA_PATCHES=	${FILESDIR}/extra-patch-addauth
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-addauth
+NEW_ARGS:=	${NEW_ARGS}a
 .endif
 
 .if defined(WITH_REJECTTEXT_PATCH)
 EXTRA_PATCHES+=	${FILESDIR}/extra-patch-rejecttext1
-.if defined(WITH_ADDAUTH_PATCH)
-EXTRA_PATCHES+=	${FILESDIR}/extra-patch-rejecttext2a
-.else
-EXTRA_PATCHES+=	${FILESDIR}/extra-patch-rejecttext2
+NEW_ARGS:=	${NEW_ARGS}R:
 .endif
+
+# extra-patch-options is modified in pre-patch
+.if ${ORIG_ARGS} != ${NEW_ARGS}
+EXTRA_PATCHES+=	${WRKDIR}/extra-patch-options
 .endif
 
 .if !defined(WITHOUT_LDAP) && defined(WITH_LDAP)
@@ -67,7 +72,6 @@
 .else
 IGNORE=	base system sendmail not found or too old, rebuild with WITH_SENDMAIL_PORT=yes
 .endif
-.endif
 .else
 BUILD_DEPENDS+=	${LOCALBASE}/lib/libmilter.a:${PORTSDIR}/mail/sendmail
 MILTERBASE?=	${LOCALBASE}
@@ -92,6 +96,9 @@
 MAN1=		spamass-milter.1
 
 pre-patch:
+.if ${ORIG_ARGS} != ${NEW_ARGS}
+	@${SED} -e 's|%NEW_ARGS%|${NEW_ARGS}|' ${FILESDIR}/extra-patch-options > ${WRKDIR}/extra-patch-options
+.endif
 
 .if !defined(WITH_SENDMAIL_PORT)
 	@${ECHO_CMD} ""
diff -Nur spamass-milter.orig/files/extra-patch-addauth spamass-milter/files/extra-patch-addauth
--- spamass-milter.orig/files/extra-patch-addauth	2010-05-30 14:44:48.000000000 -0400
+++ spamass-milter/files/extra-patch-addauth	2010-05-30 14:44:22.000000000 -0400
@@ -22,15 +22,6 @@
  
  #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
  static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
-@@ -181,7 +182,7 @@
- main(int argc, char* argv[])
- {
-    int c, err = 0;
--   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
-+   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:xa";
-    char *sock = NULL;
-    bool dofork = false;
-    char *pidfilename = NULL;
 @@ -196,6 +197,9 @@
  	/* Process command line options */
  	while ((c = getopt(argc, argv, args)) != -1) {
diff -Nur spamass-milter.orig/files/extra-patch-options spamass-milter/files/extra-patch-options
--- spamass-milter.orig/files/extra-patch-options	1969-12-31 19:00:00.000000000 -0500
+++ spamass-milter/files/extra-patch-options	2010-05-30 14:44:24.000000000 -0400
@@ -0,0 +1,11 @@
+--- spamass-milter.cpp.ORIG	2006-06-17 11:06:30.000000000 +0200
++++ spamass-milter.cpp	2006-06-17 11:10:11.000000000 +0200
+@@ -181,7 +182,7 @@
+ main(int argc, char* argv[])
+ {
+    int c, err = 0;
+-   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
++   const char *args = "%NEW_ARGS%";
+    char *sock = NULL;
+    bool dofork = false;
+    char *pidfilename = NULL;


>Release-Note:
>Audit-Trail:
>Unformatted:



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