pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/lintpkgsrc/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Fri Aug 12 22:32:21 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl
        pkgsrc/pkgtools/lintpkgsrc/files/t: parse_makefile.t

Log Message:
lintpkgsrc: fix parsing of continuation lines in makefiles


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
cvs rdiff -u -r1.7 -r1.8 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.78 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.79
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.78 Fri Aug 12 22:18:35 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Fri Aug 12 22:32:21 2022
@@ -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 @@ sub parse_makefile_vars($file, $cwd = un
                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

Index: pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.7 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.8
--- pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.7     Fri Aug 12 22:18:35 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t Fri Aug 12 22:32:21 2022
@@ -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 @@ sub test_parse_makefile_vars() {
        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