From owner-freebsd-ports@FreeBSD.ORG Tue Mar 24 13:19:20 2015 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11311C9E; Tue, 24 Mar 2015 13:19:20 +0000 (UTC) Received: from udns.ultimatedns.net (unknown [IPv6:2602:d1:b4d6:e600:4261:86ff:fef6:aa2a]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFBC469F; Tue, 24 Mar 2015 13:19:19 +0000 (UTC) Received: from ultimatedns.net (localhost [127.0.0.1]) by udns.ultimatedns.net (8.14.9/8.14.9) with ESMTP id t2ODLj4v044298; Tue, 24 Mar 2015 06:21:51 -0700 (PDT) (envelope-from bsd-lists@bsdforge.com) To: ports@freebsd.org, Julian Elischer In-Reply-To: <55111AFF.8090901@freebsd.org> References: <5510F71B.7030900@freebsd.org> <0f7fcd73df4eca6817fc5eca8ff42207@ultimatedns.net>, <55111AFF.8090901@freebsd.org> From: "Chris H" Subject: Re: patch to bsd.ports.mk to support out-of-tree patches. Date: Tue, 24 Mar 2015 06:21:51 -0700 Content-Type: text/plain; charset=UTF-8; format=fixed MIME-Version: 1.0 Message-id: Content-Transfer-Encoding: 8bit Cc: Devin Teske X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Mar 2015 13:19:20 -0000 On Tue, 24 Mar 2015 16:06:23 +0800 Julian Elischer wrote > On 3/24/15 1:45 PM, Chris H wrote: > > On Tue, 24 Mar 2015 13:33:15 +0800 Julian Elischer > > wrote > > >> Hi, I've a need to keep soe changes outside of the ports tree, to > >> allow me to tailor > >> our installs. I could use the "EXTRA_PATCHES" setting, but I'd have to > >> outline the > >> patches every time and keep track of them one by one. > >> > >> Instead, I have adde dhte following to bsd.ports.mk: > >> > >> > >> > >> diff -u bsd.port.mk.orig bsd.port.mk > >> --- bsd.port.mk.orig 2015-03-23 21:55:47.498891000 -0700 > >> +++ bsd.port.mk 2015-03-23 22:15:16.757385000 -0700 > >> @@ -834,6 +834,11 @@ > >> # The patches specified by this variable will be > >> # applied after the normal distribution patches but > >> # before those in ${PATCHDIR}. > >> +# EXTRA_PATCH_TREE - where to find extra 'out-of-tree' patches > >> +# Points to a directory hierarchy with the same layout > >> +# as the ports tree, where local patches can be found. > >> +# This allows a third party to keep their patches in > >> +# some other source control system if needed. > >> # PATCH_WRKSRC - Directory to apply patches in. > >> # Default: ${WRKSRC} > >> # > >> @@ -3523,6 +3528,37 @@ > >> esac | ${PATCH} ${PATCH_DIST_ARGS} 'patch_dist_strip $$i' ; \ > >> done ) > >> .endif > >> +.if defined(EXTRA_PATCH_TREE) > >> + @set -e ;\ > >> + if [ -d ${EXTRA_PATCH_TREE} ]; then \ > >> + if [ "'${ECHO_CMD} > >> ${EXTRA_PATCH_TREE}/${PKGORIGIN}/patch-*'" != > >> "${EXTRA_PATCH_TREE}/${PKGORIGIN}/patch-*" ]; then \ > >> + ${ECHO_MSG} "===> Applying local patches for > >> ${PKGNAME}" ; \ > >> + PATCHES_APPLIED="" ; \ > >> + for i in > >> ${EXTRA_PATCH_TREE}/${PKGORIGIN}/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_CMD} "=> Patch $$i failed to apply cleanly." | > >> ${SED} "s|${EXTRA_PATCH_TREE}/${PKGORIGIN}/||"' ; \ > >> + if [ > >> x"$$PATCHES_APPLIED" != x"" -a ${PATCH_SILENT} != "yes" ]; then \ > >> + ${ECHO_MSG} '${ECHO_CMD} "=> Patch(es) $$PATCHES_APPLIED applied > >> cleanly." | ${SED} "s|${EXTRA_PATCH_TREE}/${PKGORIGIN > >> +}/||g"' ; \ > >> + fi; \ > >> + ${FALSE} ; \ > >> + fi; \ > >> + ;; \ > >> + esac; \ > >> + done; \ > >> + fi; \ > >> + fi > >> +.endif > >> .if defined(EXTRA_PATCHES) > >> @set -e ; \ > >> for i in ${EXTRA_PATCHES}; do \ > >> > >> > >> ============ > >> > >> > >> this allows me to keep as many patches as I require in a separate > >> "out-of-tree" > >> repository, that I can change at will, allowing the actual ports tree > >> to be > >> updated as needed with no chances of file collisions etc. > >> > >> Basically I keep a second parallel 'shadow' tree containing nothing > >> but patches, and > >> the ports tree remains unchanged. > >> > >> Is there any interest on taking this onboard? > > Thank you for this, Julian! > > Absolutely interested in seeing this. I've been forced > > to kludge a similar approach. This would be wonderful. > Well, we'll see what the regular ports people think.. I am not a ports > committer :-) You are too kind. For I am but a lowly Maintainer. :-) > > > > > Please do. > > > > --Chris > >> --Chris --