Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2002 02:11:23 +0300
From:      "Alexandr A.Babaylov" <"."@babolo.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        @cicuta.babolo.ru
Subject:   ports/45200: Options to use local patches in ports tree
Message-ID:  <1036969883.424961.703.nullmailer@cicuta.babolo.ru>

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

>Number:         45200
>Category:       ports
>Synopsis:       Options to use local patches in ports tree
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 10 15:20:01 PST 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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