From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Oct 11 00:50:15 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D3DF16A41F for ; Tue, 11 Oct 2005 00:50:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B6FDC43D46 for ; Tue, 11 Oct 2005 00:50:14 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j9B0oE8E092686 for ; Tue, 11 Oct 2005 00:50:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j9B0oEhT092685; Tue, 11 Oct 2005 00:50:14 GMT (envelope-from gnats) Resent-Date: Tue, 11 Oct 2005 00:50:14 GMT Resent-Message-Id: <200510110050.j9B0oEhT092685@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Edwin Groothuis Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3E65C16A429 for ; Tue, 11 Oct 2005 00:40:18 +0000 (GMT) (envelope-from edwin@mavetju.org) Received: from mail3out.barnet.com.au (mail3out.barnet.com.au [202.83.176.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 62AA243D64 for ; Tue, 11 Oct 2005 00:40:08 +0000 (GMT) (envelope-from edwin@mavetju.org) Received: by mail3out.barnet.com.au (Postfix, from userid 27) id D23E1877CDD; Tue, 11 Oct 2005 10:40:04 +1000 (EST) Received: from mail3-auth.barnet.com.au (mail3.barnet.com.au [202.83.176.16]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.barnet.com.au", Issuer "BarNet Root Certificate Authority" (verified OK)) by mail3.barnet.com.au (Postfix) with ESMTP id 88DFB877CE0 for ; Tue, 11 Oct 2005 10:40:04 +1000 (EST) Received: from k7.mavetju (edwin-3.int.barnet.com.au [10.10.12.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "edwin.adsl.barnet.com.au", Issuer "BarNet Root Certificate Authority" (not verified)) by mail3-auth.barnet.com.au (Postfix) with ESMTP id BF193877CCA for ; Tue, 11 Oct 2005 10:40:03 +1000 (EST) Received: by k7.mavetju (Postfix, from userid 1001) id 00F5B614D; Tue, 11 Oct 2005 10:40:02 +1000 (EST) Message-Id: <20051011004002.00F5B614D@k7.mavetju> Date: Tue, 11 Oct 2005 10:40:02 +1000 (EST) From: Edwin Groothuis To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/87234: [patch] add patch-dos2unix target X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Edwin Groothuis List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2005 00:50:15 -0000 >Number: 87234 >Category: ports >Synopsis: [patch] add patch-dos2unix target >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Oct 11 00:50:14 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Edwin Groothuis >Release: FreeBSD 5.2.1-RELEASE i386 >Organization: - >Environment: System: FreeBSD k7.mavetju 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #8: Wed Dec 15 16:58:01 EST 2004 edwin@k7.mavetju:/usr/src-5.2.1/sys/i386/compile/k7 i386 >Description: The porters handbook says at http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/slow-patch.html: To quickly convert those files from CR/LF to just LF, you can do something like this: USE_REINPLACE= yes post-extract: @${FIND} -E ${WRKDIR} -type f -iregex ".*\.(c|cpp|h|txt)" -print0 | \ ${XARGS} -0 ${REINPLACE_CMD} -e 's/[[:cntrl:]]*$$//' Of course, if you need to process each and every file, -iregex above can be omitted. Be aware that this piece of code will strip all trailing control characters from each line of processed file (except \n). Let's for simplicty sake replace that one ugly statement with a simple USE_ statement and let bsd.port.mk figure out the rest: USE_DOS2UNIX= yes ^-- run dos2unix over all files under WRKSRC USE_DOS2UNIX= foo bar ^-- run dos2unix over WRKSRC/foo and WRKSRC/bar Once commited (or on the row to be commited), I volunteer to... - Fix the porters handbook with regarding to documentation, and - Fix the ports with their own dos2unix implementation with this new statement. >How-To-Repeat: >Fix: --- bsd.port.mk.orig Sat Oct 8 09:58:14 2005 +++ bsd.port.mk Tue Oct 11 10:36:51 2005 @@ -216,6 +216,9 @@ # compression. # USE_ZIP - If set, this port distfile uses zip, not tar w/[bg]zip # for compression. +# USE_DOS2UNIX - If set to "YES", remove the ^M from all files +# under ${WRKSRC}. If set to a string, remove in all +# files under ${WRKSRC} with one of these names the ^Ms. # USE_GCC - If set, this port requires this version of gcc, either in # the system or installed from a port. # USE_GMAKE - If set, this port uses gmake. @@ -1465,6 +1468,10 @@ CONFIGURE_ENV+= MAKE=${GMAKE} .endif +.if defined(USE_DOS2UNIX) +USE_REINPLACE= yes +.endif + .if defined(USE_GCC) .include "${PORTSDIR}/Mk/bsd.gcc.mk" .endif @@ -3259,9 +3266,27 @@ # Patch +.if !target(patch-dos2unix) +patch-dos2unix: +.if defined(USE_DOS2UNIX) +.if ${USE_DOS2UNIX:U}=="YES" + @${ECHO_MSG} "===> Converting DOS text files to UNIX text files" + @${FIND} -E ${WRKSRC} -type f -print0 | \ + ${XARGS} -0 ${REINPLACE_CMD} -i"" -e 's/[[:cntrl:]]*$$//' +.else +.for f in ${USE_DOS2UNIX} + @${ECHO_MSG} "===> Converting DOS text file to UNIX text file: ${f}" + @${REINPLACE_CMD} -i"" -e 's/[[:cntrl:]]*$$//' ${WRKSRC}/${f} +.endfor +.else + ${DO_NADA} +.endif +.endif + .if !target(do-patch) do-patch: .if defined(PATCHFILES) +.endif @${ECHO_MSG} "===> Applying distribution patches for ${PKGNAME}" @(cd ${_DISTDIR}; \ for i in ${_PATCHFILES}; do \ @@ -3761,9 +3786,9 @@ # Please note that the order of the following targets is important, and # should not be modified. -_SANITY_SEQ= pre-everything check-makefile check-categories \ - check-makevars check-depends check-deprecated \ - check-vulnerable buildanyway-message options-message +_SANITY_SEQ= pre-everything check-makefile check-categories \ + check-makevars check-depends check-deprecated \ + check-vulnerable buildanyway-message options-message _FETCH_DEP= check-sanity _FETCH_SEQ= fetch-depends pre-fetch pre-fetch-script \ do-fetch post-fetch post-fetch-script @@ -3772,12 +3797,12 @@ pre-extract-script do-extract \ post-extract post-extract-script _PATCH_DEP= extract -_PATCH_SEQ= patch-message patch-depends pre-patch pre-patch-script \ - do-patch post-patch post-patch-script +_PATCH_SEQ= patch-message patch-depends patch-dos2unix pre-patch \ + pre-patch-script do-patch post-patch post-patch-script _CONFIGURE_DEP= patch _CONFIGURE_SEQ= build-depends lib-depends misc-depends configure-message \ - pre-configure pre-configure-script patch-autotools \ - run-autotools do-configure post-configure post-configure-script + pre-configure pre-configure-script patch-autotools \ + run-autotools do-configure post-configure post-configure-script _BUILD_DEP= configure _BUILD_SEQ= build-message pre-build pre-build-script do-build \ post-build post-build-script >Release-Note: >Audit-Trail: >Unformatted: