Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 2014 07:20:45 +0000
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        marino@freebsd.org
Cc:        "svn-ports-head@freebsd.org" <svn-ports-head@freebsd.org>, Max Brazhnikov <makc@freebsd.org>, Antoine Brodin <antoine@FreeBSD.org>, "svn-ports-all@freebsd.org" <svn-ports-all@freebsd.org>, William Grzybowski <wg@freebsd.org>, "ports-committers@freebsd.org" <ports-committers@freebsd.org>, Mathieu Arnold <mat@freebsd.org>, Adam Weinberger <adamw@adamw.org>
Subject:   Re: svn commit: r363361 - in head/editors/fte: . files
Message-ID:  <20140801072045.GH71116@FreeBSD.org>
In-Reply-To: <53DB3665.6020201@marino.st>
References:  <20140730160843.GA2688@FreeBSD.org> <53D919BC.6010307@marino.st> <20140801051652.GA59625@FreeBSD.org> <CAALwa8=R2i9PA7R8VXHStZCDGy_ZFaYcBtRmY-_ZFq9k=toJ%2Bw@mail.gmail.com> <20140801060506.GA71116@FreeBSD.org> <53DB3021.7010909@marino.st> <20140801062047.GC71116@FreeBSD.org> <53DB32E8.7020700@marino.st> <20140801063243.GE71116@FreeBSD.org> <53DB3665.6020201@marino.st>

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

--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Aug 01, 2014 at 08:40:37AM +0200, John Marino wrote:
> I've been using "_" => "__" for a while now, it's not bad.  Yes, double
> underscore remains but a very low frequency.  The main issue is that it
> represents a different character ("_") than it does now ("\").

OK, second version.

./danfe

--sdtB3X0nJg68CQEu
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="makepatch2.diff"

Index: /usr/ports/Mk/bsd.port.mk
===================================================================
--- /usr/ports/Mk/bsd.port.mk	(revision 363531)
+++ /usr/ports/Mk/bsd.port.mk	(working copy)
@@ -1180,21 +1180,36 @@
 
 .else
 
-# Look for ${PATCH_WRKSRC}/.../*.orig files, and (re-)create
-# ${FILEDIR}/patch-* files from them.
+# Look for files named "*.orig" under ${PATCH_WRKSRC} and (re-)generate
+# ${FILEDIR}/patch-* files from them.  By default, '-' (dash, minus) is
+# used to replace path separators in patch file names; it can be set to
+# something else via PATCH_PATH_SEPARATOR variable (note that only [-+_]
+# characters are allowed).
+#
+# Check whether output file exists, and if it does, start to double the
+# patch path separator characters one by one until we avoid a clash.
 
 .if !target(makepatch)
+PATCH_PATH_SEPARATOR?=	-
 makepatch: ${FILESDIR}
+.if empty(PATCH_PATH_SEPARATOR) || ${PATCH_PATH_SEPARATOR:C/[-+_]//}
+	@${ECHO_MSG} "Error (${.TARGET}) PATCH_PATH_SEPARATOR must be one of the [-+_] characters."
+	@${FALSE}
+.endif
 	@(cd ${PATCH_WRKSRC}; \
 		for i in `find . -type f -name '*.orig'`; do \
-			ORG=$$i; \
-			NEW=$${i%.orig}; \
+			ORG=$${i#./}; \
+			NEW=$${ORG%.orig}; \
 			cmp -s $${ORG} $${NEW} && continue; \
-			OUT=${FILESDIR}`${ECHO} $${NEW} | \
-				${SED} -e 's|/|__|g' \
-					-e 's|^\.__|/patch-|'`; \
-			${ECHO} ${DIFF} -ud $${ORG} $${NEW} '>' $${OUT}; \
-			${DIFF} -ud $${ORG} $${NEW} > $${OUT} || ${TRUE}; \
+			PATCH=`${ECHO} $${NEW} | ${SED} -e \
+				's|/|${PATCH_PATH_SEPARATOR}|g'`; \
+			while [ -f "${FILESDIR}/patch-$${PATCH}" ]; do \
+				PATCH=`${ECHO} $${PATCH} | ${SED} -e \
+					's|${PATCH_PATH_SEPARATOR}|&&|'`; \
+				done; \
+			OUT=${FILESDIR}/patch-$${PATCH}; \
+			${ECHO} ${DIFF} -udp $${ORG} $${NEW} '>' $${OUT}; \
+			${DIFF} -udp $${ORG} $${NEW} > $${OUT} || ${TRUE}; \
 		done \
 	)
 .endif

--sdtB3X0nJg68CQEu--



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