From babolo@cicuta.babolo.ru  Sun Nov 10 15:11:20 2002
Return-Path: <babolo@cicuta.babolo.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D5D9E37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 10 Nov 2002 15:11:20 -0800 (PST)
Received: from pike.mail.pike.ru (pike.mail.pike.ru [194.135.18.234])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5A44943E42
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 10 Nov 2002 15:11:19 -0800 (PST)
	(envelope-from babolo@cicuta.babolo.ru)
Received: (qmail 54098 invoked from network); 10 Nov 2002 23:14:45 -0000
Received: from babolo.ru (HELO cicuta.babolo.ru) (194.58.226.160)
  by pike.mail.pike.ru with SMTP; 10 Nov 2002 23:14:45 -0000
Received: (nullmailer pid 704 invoked by uid 136);
	Sun, 10 Nov 2002 23:11:23 -0000
Message-Id: <1036969883.424961.703.nullmailer@cicuta.babolo.ru>
Date: Mon, 11 Nov 2002 02:11:23 +0300
From: Alexandr A.Babaylov <"."@babolo.ru>
Reply-To: Alexandr A.Babaylov <"."@babolo.ru>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Options to use local patches in ports tree
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45200
>Category:       ports
>Synopsis:       Options to use local patches in ports tree
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 10 15:20:01 PST 2002
>Closed-Date:    Fri Jan 24 16:51:04 PST 2003
>Last-Modified:  Sun Mar 17 01:50:01 UTC 2013
>Originator:     Alexandr A. Babaylov
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
home
>Environment:
System: FreeBSD cicuta.babolo.ru 4.7-STABLE FreeBSD 4.7-STABLE #0: Sat Nov 9 21:54:50 MSK 2002 babolo@cicuta.babolo.ru:/tmp/babolo/usr/src/sys/cicuta i386

>Description:
	A lot of local patches live in it own directory
	tree (for CVSing) but with a need to be automatically
	applied every build.
>How-To-Repeat:
	It is easy to use local patch or two with some port.
	But if number of it grows:

0cicuta~(2)>find /home/babolo/ports -type f | wc
     956     956   47746

	they need separate directory with separate CVS

>Fix:

Index: bsd.port.mk
===================================================================
RCS file: /home/CVShome/FreeBSD/ports/Mk/bsd.port.mk,v
retrieving revision 1.427
diff -u -r1.427 bsd.port.mk
--- bsd.port.mk	3 Nov 2002 05:43:49 -0000	1.427
+++ bsd.port.mk	10 Nov 2002 22:10:05 -0000
@@ -96,6 +96,15 @@
 #						This variable supercedes CD_MOUNTPT, which is
 #						obsolete.
 #
+# This variables control local modifications.
+#
+# LOCAL_PATCHDIR_PREFIX - Root of directory tree similar to ports
+#				directory tree with local patches (and possibly
+#				local ports).
+# WITHOUT_LOCAL_PATCHDIR - Should never be used in official ports tree.
+#				Set this variable in local ports to not clash
+#				local pathes themselves.
+# 
 # Set these if your port should not be built under certain circumstances.
 # These are string variables; you should set them to the reason why
 # they are necessary.
@@ -708,6 +717,7 @@
 FILESDIR?=		${MASTERDIR}/files
 SCRIPTDIR?=		${MASTERDIR}/scripts
 PKGDIR?=		${MASTERDIR}
+LOCAL_PATCHDIR?=	${LOCAL_PATCHDIR_PREFIX}/${PATCHDIR}
 
 .if defined(USE_IMAKE) && !defined(USE_X_PREFIX)
 USE_X_PREFIX=	yes
@@ -2322,6 +2332,35 @@
 			done; \
 		fi; \
 	fi
+.if defined(LOCAL_PATCHDIR_PREFIX) && !defined(WITHOUT_LOCAL_PATCHDIR)
+	@if [ -d ${LOCAL_PATCHDIR_PREFIX}/ ]; then \
+		if [ "`echo ${LOCAL_PATCHDIR}/patch-*`" != "${LOCAL_PATCHDIR}/patch-*" ]; then \
+			${ECHO_MSG} "===>  Applying LOCAL patches for ${PKGNAME}" ; \
+			PATCHES_APPLIED="" ; \
+			for i in ${LOCAL_PATCHDIR}/patch-*; do \
+				case $$i in \
+					*.orig|*.rej|*~|*,v) \
+						${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
+						;; \
+					*) \
+						if [ ${PATCH_DEBUG_TMP} = yes ]; then \
+							${ECHO_MSG} "===>   Applying LOCAL patch $$i" ; \
+						fi; \
+						if ${PATCH} ${PATCH_ARGS} < $$i ; then \
+							PATCHES_APPLIED="$$PATCHES_APPLIED $$i" ; \
+						else \
+							${ECHO_MSG} `${ECHO} ">> Patch $$i failed to apply cleanly." | ${SED} "s|${LOCAL_PATCHDIR}/||"` ; \
+							if [ x"$$PATCHES_APPLIED" != x"" ]; then \
+								${ECHO_MSG} `${ECHO} ">> Patch(es) $$PATCHES_APPLIED applied cleanly." | ${SED} "s|${LOCAL_PATCHDIR}/||g"` ; \
+							fi; \
+							${FALSE} ; \
+						fi; \
+						;; \
+				esac; \
+			done; \
+		fi; \
+	fi
+.endif
 .endif
 
 # Configure

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->portmgr 
Responsible-Changed-By: ijliao 
Responsible-Changed-When: Mon Nov 11 09:58:57 PST 2002 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45200 
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Fri Jan 24 16:50:06 PST 2003 
State-Changed-Why:  
Thanks for the submission, but I don't think this feature 
is necessary.  Local patches can easily be accomodated by using 
cvs, or a 'refuse' file entry for cvsup (and an appropriate 
local patch naming scheme). 

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

From: Sergey Matveychuk <sem@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc: kris@FreeBSD.org
Subject: Re: ports/45200: Options to use local patches in ports tree
Date: Mon, 06 Aug 2007 20:08:08 +0400

 Can we reopen it in light of using of portsnap?
 
 It looks like as unharmful and useful for a few users who did not use 
 portsnap because of local patches.
 
 --
 Dixi.
 Sem.

From: Kris Kennaway <kris@obsecurity.org>
To: Sergey Matveychuk <sem@FreeBSD.org>
Cc: bug-followup@FreeBSD.org, kris@FreeBSD.org
Subject: Re: ports/45200: Options to use local patches in ports tree
Date: Mon, 6 Aug 2007 15:21:16 -0400

 On Mon, Aug 06, 2007 at 08:08:08PM +0400, Sergey Matveychuk wrote:
 > Can we reopen it in light of using of portsnap?
 > 
 > It looks like as unharmful and useful for a few users who did not use 
 > portsnap because of local patches.
 
 The same advice applies: use a REFUSE entry in portsnap.conf.  Other
 solutions are probably possible using existing methods, e.g. a
 Makefile.local with EXTRA_PATCHES set.
 
 Kris

From: Sergey Matveychuk <sem@FreeBSD.org>
To: Kris Kennaway <kris@obsecurity.org>
Cc: bug-followup@FreeBSD.org,  kris@FreeBSD.org
Subject: Re: ports/45200: Options to use local patches in ports tree
Date: Tue, 07 Aug 2007 12:30:14 +0400

 Kris Kennaway wrote:
 > On Mon, Aug 06, 2007 at 08:08:08PM +0400, Sergey Matveychuk wrote:
 >> Can we reopen it in light of using of portsnap?
 >>
 >> It looks like as unharmful and useful for a few users who did not use 
 >> portsnap because of local patches.
 > 
 > The same advice applies: use a REFUSE entry in portsnap.conf.  Other
 > solutions are probably possible using existing methods, e.g. a
 > Makefile.local with EXTRA_PATCHES set.
 
 The purpose of the patch is to keep patches out of ports tree. A goal of 
 it is you can keep your patches in local CVS (as we and author of the 
 patch do). So there is a sense of it.
 
 -- 
 Dixi.
 Sem.

From: Kris Kennaway <kris@obsecurity.org>
To: Sergey Matveychuk <sem@FreeBSD.org>
Cc: Kris Kennaway <kris@obsecurity.org>, bug-followup@FreeBSD.org,
	kris@FreeBSD.org
Subject: Re: ports/45200: Options to use local patches in ports tree
Date: Tue, 7 Aug 2007 12:17:27 -0400

 On Tue, Aug 07, 2007 at 12:30:14PM +0400, Sergey Matveychuk wrote:
 > Kris Kennaway wrote:
 > >On Mon, Aug 06, 2007 at 08:08:08PM +0400, Sergey Matveychuk wrote:
 > >>Can we reopen it in light of using of portsnap?
 > >>
 > >>It looks like as unharmful and useful for a few users who did not use 
 > >>portsnap because of local patches.
 > >
 > >The same advice applies: use a REFUSE entry in portsnap.conf.  Other
 > >solutions are probably possible using existing methods, e.g. a
 > >Makefile.local with EXTRA_PATCHES set.
 > 
 > The purpose of the patch is to keep patches out of ports tree. A goal of 
 > it is you can keep your patches in local CVS (as we and author of the 
 > patch do). So there is a sense of it.
 
 I don't understand what you mean.
 
 Kris

From: Sergey Matveychuk <sem@FreeBSD.org>
To: Kris Kennaway <kris@obsecurity.org>
Cc: bug-followup@FreeBSD.org,  kris@FreeBSD.org
Subject: Re: ports/45200: Options to use local patches in ports tree
Date: Tue, 07 Aug 2007 20:43:30 +0400

 Kris Kennaway wrote:
 > On Tue, Aug 07, 2007 at 12:30:14PM +0400, Sergey Matveychuk wrote:
 >> Kris Kennaway wrote:
 >>> On Mon, Aug 06, 2007 at 08:08:08PM +0400, Sergey Matveychuk wrote:
 >>>> Can we reopen it in light of using of portsnap?
 >>>>
 >>>> It looks like as unharmful and useful for a few users who did not use 
 >>>> portsnap because of local patches.
 >>> The same advice applies: use a REFUSE entry in portsnap.conf.  Other
 >>> solutions are probably possible using existing methods, e.g. a
 >>> Makefile.local with EXTRA_PATCHES set.
 >> The purpose of the patch is to keep patches out of ports tree. A goal of 
 >> it is you can keep your patches in local CVS (as we and author of the 
 >> patch do). So there is a sense of it.
 > 
 > I don't understand what you mean.
 
 I mean keeping patches outside of the ports tree. Let's say in 
 /usr/local/local-patches/category/portname/*.
 
 We keep local patches in our company's CVS. So it's convenient for us.
 
 -- 
 Dixi.
 Sem.
>Unformatted:
