diff options
author | rillig <rillig@pkgsrc.org> | 2022-08-12 22:32:21 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2022-08-12 22:32:21 +0000 |
commit | d0369fc987e4265f56c9072b69103f5a84d3ad48 (patch) | |
tree | 6622fbf16f578ab3d128dd1d532ce4f34f4c46e6 | |
parent | ed6d6215ec64199bc05c81bc0ff67258743cc41e (diff) | |
download | pkgsrc-d0369fc987e4265f56c9072b69103f5a84d3ad48.tar.gz |
lintpkgsrc: fix parsing of continuation lines in makefiles
-rwxr-xr-x | pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 7 | ||||
-rw-r--r-- | pkgtools/lintpkgsrc/files/t/parse_makefile.t | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl index a650db497d6..aecbe904471 100755 --- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl +++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl @@ -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>. # @@ -527,8 +527,11 @@ sub parse_makefile_vars($file, $cwd = undef) { 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 --git a/pkgtools/lintpkgsrc/files/t/parse_makefile.t b/pkgtools/lintpkgsrc/files/t/parse_makefile.t index 5c76ab41a7a..fa92e2130fc 100644 --- a/pkgtools/lintpkgsrc/files/t/parse_makefile.t +++ b/pkgtools/lintpkgsrc/files/t/parse_makefile.t @@ -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'); } |