On Fri, 6 Mar 2020 10:54:36 +0000
Stuart Henderson wrote:

> On 2020/03/06 08:29, Theo Buehler wrote:
> > While the diff reads fine, it doesn't apply, probably due to the
> > MSDOS line endings. Can you send it as an attachment or host it
> > somewhere, please?
> 
> Gah, another one... If anyone is feeling bored it would be really nice
> if portcheck was taught to whine about these!
> 

Here is an attempt to do so, i've moved the perl call to pre-patch as
you hinted.

Charlène.

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>

Reply via email to