Date: Wed, 29 Nov 2006 20:56:36 +0100 (CET) From: Pav Lucistnik <pav@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/106029: USE_DOS2UNIX improvement Message-ID: <200611291956.kATJuav6031266@ikaros.oook.cz> Resent-Message-ID: <200611292000.kATK0afR065041@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 106029 >Category: ports >Synopsis: USE_DOS2UNIX improvement >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: Wed Nov 29 20:00:36 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Pav Lucistnik >Release: FreeBSD 6.2-PRERELEASE amd64 >Organization: >Environment: System: FreeBSD ikaros.oook.cz 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #0: Thu Sep 28 19:10:00 CEST 2006 root@ikaros.oook.cz:/usr/obj/usr/src/sys/SMP amd64 >Description: Improvements to current feature USE_DOS2UNIX (replace DOS linefeeds with UNIX ones): - allows to specify generic file extensions, which will be then searched and patched in the whole directory tree USE_DOS2UNIX= *.cpp *.h - backwards compatible: retains old behaviour if slash is used in the expression USE_DOS2UNIX= src/config.h - new variable to specify find(1) iregex argument USE_DOS2UNIX= yes DOS2UNIX_REGEX= .*\.(cpp|h) Superseeds ports/93007. >How-To-Repeat: >Fix: Also available on freefall as ~pav/dos2unix.patch --- dos2unix.patch begins here --- Index: bsd.port.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v retrieving revision 1.544 diff -a -u -r1.544 bsd.port.mk --- bsd.port.mk 30 Sep 2006 19:25:45 -0000 1.544 +++ bsd.port.mk 29 Nov 2006 19:51:10 -0000 @@ -299,6 +299,9 @@ # 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. +# DOS2UNIX_REGEX +# - Limit the ^M removal to files which name matches +# the regular expression. # 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. @@ -1268,6 +1271,8 @@ .endif +DOS2UNIX_REGEX?= .* + # Start of pre-makefile section. .if !defined(AFTERPORTMK) && !defined(INOPTIONSMK) @@ -3480,13 +3485,20 @@ .if defined(USE_DOS2UNIX) .if ${USE_DOS2UNIX:U}=="YES" @${ECHO_MSG} "===> Converting DOS text files to UNIX text files" - @${FIND} ${WRKSRC} -type f -print0 | \ + @${FIND} -E ${WRKSRC} -type f -iregex '${DOS2UNIX_REGEX}' -print0 | \ ${XARGS} -0 ${REINPLACE_CMD} -i '' -e 's/ $$//' .else -.for f in ${USE_DOS2UNIX} @${ECHO_MSG} "===> Converting DOS text file to UNIX text file: ${f}" +.if ${USE_DOS2UNIX:M*/*} +.for f in ${USE_DOS2UNIX} @${REINPLACE_CMD} -i '' -e 's/ $$//' ${WRKSRC}/${f} .endfor +.else +.for f in ${USE_DOS2UNIX} + @${FIND} ${WRKSRC} -type f -name '${f}' -print0 | \ + ${XARGS} -0 ${REINPLACE_CMD} -i '' -e 's/ $$//' +.endfor +.endif .endif .else @${DO_NADA} --- dos2unix.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611291956.kATJuav6031266>