From nobody@FreeBSD.org  Sun May 30 19:21:17 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 17DD81065673
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 30 May 2010 19:21:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 069BF8FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 30 May 2010 19:21:17 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o4UJLGkw026378
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 30 May 2010 19:21:16 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o4UJLGQI026377;
	Sun, 30 May 2010 19:21:16 GMT
	(envelope-from nobody)
Message-Id: <201005301921.o4UJLGQI026377@www.freebsd.org>
Date: Sun, 30 May 2010 19:21:16 GMT
From: Marshal Newrock <marshal@zordio.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mail/spamass-milter improved adding command-line options
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 30 19:30:03 UTC 2010
>Closed-Date:    Thu Aug 26 12:04:42 UTC 2010
>Last-Modified:  Thu Aug 26 12:10:09 UTC 2010
>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:
Responsible-Changed-From-To: freebsd-ports-bugs->stefan 
Responsible-Changed-By: stefan 
Responsible-Changed-When: Wed Jun 30 15:00:27 UTC 2010 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147230 
Responsible-Changed-From-To: stefan->freebsd-ports-bugs 
Responsible-Changed-By: stefan 
Responsible-Changed-When: Mon Aug 2 16:43:11 UTC 2010 
Responsible-Changed-Why:  
Return this PR to the pool - I currently do not have the time to take care of 
it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147230 
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Thu Aug 26 11:52:41 UTC 2010 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147230 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/147230: commit references a PR
Date: Thu, 26 Aug 2010 12:04:45 +0000 (UTC)

 pav         2010-08-26 12:04:31 UTC
 
   FreeBSD ports repository
 
   Modified files:
     mail/spamass-milter  Makefile 
     mail/spamass-milter/files extra-patch-addauth 
   Added files:
     mail/spamass-milter/files extra-patch-options 
   Removed files:
     mail/spamass-milter/files extra-patch-rejecttext2 
                               extra-patch-rejecttext2a 
   Log:
   - Automate adding command line options from various optional patches
   
   PR:             ports/147230
   Submitted by:   Marshal Newrock <marshal@zordio.com>
   
   Revision  Changes    Path
   1.43      +15 -5     ports/mail/spamass-milter/Makefile
   1.2       +0 -9      ports/mail/spamass-milter/files/extra-patch-addauth
   1.1       +11 -0     ports/mail/spamass-milter/files/extra-patch-options (new)
   1.2       +0 -11     ports/mail/spamass-milter/files/extra-patch-rejecttext2 (dead)
   1.2       +0 -11     ports/mail/spamass-milter/files/extra-patch-rejecttext2a (dead)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
