Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 2014 05:16:52 +0000
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        marino@freebsd.org
Cc:        svn-ports-head@freebsd.org, Max Brazhnikov <makc@freebsd.org>, svn-ports-all@freebsd.org, William Grzybowski <wg@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:  <20140801051652.GA59625@FreeBSD.org>
In-Reply-To: <53D919BC.6010307@marino.st>
References:  <41D25BC1-AC62-4280-A342-8A2BDD84B1E0@adamw.org> <20140730070412.GA97692@FreeBSD.org> <3898057.T8DsoXnEEp@mercury.ph.man.ac.uk> <53D89EBF.4080805@marino.st> <2D24420529C9ECAEABB9A791@atuin.in.mat.cc> <53D8A2BB.7090704@marino.st> <6270029E710D3C52B60B6224@atuin.in.mat.cc> <20140730081413.GA29876@FreeBSD.org> <20140730160843.GA2688@FreeBSD.org> <53D919BC.6010307@marino.st>

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

--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Jul 30, 2014 at 06:13:48PM +0200, John Marino wrote:
> On 7/30/2014 18:08, Alexey Dokuchaev wrote:
> > Given some thought over it, I propose the following changes to makepatch:
> > 
> >   - default to dash (minus, '-')
> >   - provide a command line option (-s?) or make(1) variable (PATH_SEPARATOR)
> >     to override it when needed
> >   - assert that forced value is not something insane ('__', '::', '../../',
> >     etc.) -- basically, match it over a prerefined list of acceptable values
> > 
> > I can cook up a patch unless John had beaten me on that already.
> 
> Nope, go for it.

Have a look (attached).  I've also fixed annoying bug (appending of leading
"./" in the ---/+++ lines of generated patches), and improved the comment.

./danfe

--tThc/1wpZn/ma/RB
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="makepatch.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,29 @@
 
 .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).
 
 .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}; \
+			OUT=${FILESDIR}/`${ECHO} $${NEW} | \
+				${SED} -e 's|/|${PATCH_PATH_SEPARATOR}|g' \
+					-e 's|^|patch-|'`; \
+			${ECHO} ${DIFF} -udp $${ORG} $${NEW} '>' $${OUT}; \
+			${DIFF} -udp $${ORG} $${NEW} > $${OUT} || ${TRUE}; \
 		done \
 	)
 .endif

--tThc/1wpZn/ma/RB--



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