Friday, March 06, 2020

Re: MSDOS line-ending [Re: [ports-gcc/all archs] fix lang/hashlink]

See below for my suggestion

On Fri, Mar 06, 2020 at 02:11:06PM +0100, Charlene Wendling wrote:
[...]
> Index: bin/portcheck
> ===================================================================
> RCS file: /cvs/ports/infrastructure/bin/portcheck,v
> retrieving revision 1.131
> diff -u -p -r1.131 portcheck
> --- bin/portcheck 26 Feb 2020 15:28:10 -0000 1.131
> +++ bin/portcheck 6 Mar 2020 13:08:23 -0000
> @@ -731,6 +731,14 @@ check_port_dir() {
> }
>
> # Checks made: obvious
> +check_dos_line_endings() {
> + grep -q "$(printf '\r\n')\$" "$1" &&
> + err "MS-DOS line endings in $1 --"\
> + "see ${portsdir}/infrastructure/templates/Makefile.template"\
> + "to fix them."
> +}
> +
> +# Checks made: obvious
> check_trailing_whitespace() {
> egrep -q '[[:space:]]+$' "$1" &&
> err "trailing whitespace in $1"
> @@ -1601,6 +1609,8 @@ check_patch() {
> else
> err "$F is empty and should be removed"
> fi
> +
> + check_dos_line_endings "$F"
> }
>
> # Checks made:
> Index: templates/Makefile.template
> ===================================================================
> RCS file: /cvs/ports/infrastructure/templates/Makefile.template,v
> retrieving revision 1.86
> diff -u -p -r1.86 Makefile.template
> --- templates/Makefile.template 19 Nov 2019 12:39:04 -0000 1.86
> +++ templates/Makefile.template 6 Mar 2020 13:08:23 -0000
> @@ -240,4 +240,8 @@ MASTER_SITES = ???
> #do-gen:
> # cd ${WRKSRC}; ${AUTOCONF_ENV} ./autogen.sh
>
> +# Fix dos line-endings in files needing patches
> +#pre-patch:
> +# @cd ${WRKSRC} && perl -i -pe 's/\r$$//' [...]
> +
> .include <bsd.port.mk>
>

would the following blanket solution be worthy considering?

#pre-patch:
# @cd ${WRKSRC} && find . -type f | xargs perl -i -pe 's/\r$$//'

No comments:

Post a Comment