pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: fix parsing of c...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c4703f060195
branches:  trunk
changeset: 383137:c4703f060195
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Aug 12 22:32:21 2022 +0000

description:
lintpkgsrc: fix parsing of continuation lines in makefiles

diffstat:

 pkgtools/lintpkgsrc/files/lintpkgsrc.pl      |  7 +++++--
 pkgtools/lintpkgsrc/files/t/parse_makefile.t |  4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 25dec612258a -r c4703f060195 pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Fri Aug 12 22:18:35 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Fri Aug 12 22:32:21 2022 +0000
@@ -1,6 +1,6 @@
 #!@PERL5@
 
-# $NetBSD: lintpkgsrc.pl,v 1.78 2022/08/12 22:18:35 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.79 2022/08/12 22:32:21 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -527,8 +527,11 @@
                s/\s*[^\\]#.*//;
 
                # Join continuation lines.
+               # See devel/bmake/files/parse.c, 'replace following'.
                while (substr($_, -1) eq "\\" && @lines > 0) {
-                       substr($_, -2) = shift @lines;
+                       my $line = shift @lines;
+                       $line =~ s,^\s*, ,;
+                       substr($_, -1) = $line;
                }
 
                # Conditionals
diff -r 25dec612258a -r c4703f060195 pkgtools/lintpkgsrc/files/t/parse_makefile.t
--- a/pkgtools/lintpkgsrc/files/t/parse_makefile.t      Fri Aug 12 22:18:35 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/parse_makefile.t      Fri Aug 12 22:32:21 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: parse_makefile.t,v 1.7 2022/08/12 22:18:35 rillig Exp $
+# $NetBSD: parse_makefile.t,v 1.8 2022/08/12 22:32:21 rillig Exp $
 
 use strict;
 use warnings;
@@ -62,7 +62,7 @@
        ok($vars->{COMMENT}, 'valu');
 
        # FIXME: must be 'one two three'
-       ok($vars->{MULTI}, "on\ttwthree#comment");
+       ok($vars->{MULTI}, "one two three#comment");
 
        ok($vars->{VAR}, 'value');
 }



Home | Main Index | Thread Index | Old Index