ports/92688: [PATCH] bsd.port.mk: add check to USE_DOS2UNIX
Alejandro Pulver
alejandro at varnet.biz
Wed Feb 1 16:30:14 UTC 2006
>Number: 92688
>Category: ports
>Synopsis: [PATCH] bsd.port.mk: add check to USE_DOS2UNIX
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Wed Feb 01 16:30:10 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Alejandro Pulver
>Release: FreeBSD 5.4-RELEASE i386
>Organization:
>Environment:
System: FreeBSD 5.4-RELEASE #0: Sat May 21 12:14:47 ART 2005
root at ale.varnet.bsd:/usr/src/sys/i386/compile/ATHLON-ALE
>Description:
This patch adds DOS text files detection support for the "patch-dos2unix target", and only removes the (one) trailing CR (\r) character.
This is because the conversion can (actually does) damage non-text files. Also the current version will delete all control characters at the end of the line, not only a CR (this can produce unexpected results).
>How-To-Repeat:
>Fix:
--- bsd.port.mk.diff begins here ---
--- /usr/ports/Mk/bsd.port.mk Fri Jan 27 23:11:05 2006
+++ bsd.port.mk Wed Feb 1 13:22:04 2006
@@ -3231,12 +3231,15 @@
.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:]]*$$//'
+ @${FIND} ${WRKSRC} -type f -print0 | ${XARGS} -0 ${SH} -c \
+ 'while [ $$# -gt 0 ]; do ${FILE} "$$1" | ${GREP} -q CRLF && \
+ ${REINPLACE_CMD} -i"" -e "s/`${PRINTF} \"\r\"`$$//" "$$1"; \
+ shift; done' sep
.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}
+ @${FILE} "${WRKSRC}/${f}" | ${GREP} -q CRLF && \
+ ${REINPLACE_CMD} -i"" -e "s/`${PRINTF} '\r'`$$//" "${WRKSRC}/${f}"
.endfor
.endif
.else
--- bsd.port.mk.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list