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:40:40 UTC 2022
Modified Files:
pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl
pkgsrc/pkgtools/lintpkgsrc/files/t: parse_makefile.t
Log Message:
lintpkgsrc: fix parsing of comments in makefile lines
To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
cvs rdiff -u -r1.8 -r1.9 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.79 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.80
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.79 Fri Aug 12 22:32:21 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Fri Aug 12 22:40:40 2022
@@ -1,6 +1,6 @@
#!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.79 2022/08/12 22:32:21 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.80 2022/08/12 22:40:40 rillig Exp $
# Written by David Brownlee <abs%netbsd.org@localhost>.
#
@@ -523,15 +523,18 @@ sub parse_makefile_vars($file, $cwd = un
print "$file\n";
}
- while (defined($_ = shift(@lines))) {
- s/\s*[^\\]#.*//;
+ while (defined($_ = shift @lines)) {
+ s/(*negative_lookbehind:\\)#.*//;
+ s/\s+$//;
# Join continuation lines.
# See devel/bmake/files/parse.c, 'replace following'.
while (substr($_, -1) eq "\\" && @lines > 0) {
- my $line = shift @lines;
- $line =~ s,^\s*, ,;
- substr($_, -1) = $line;
+ my $cont = shift @lines;
+ $cont =~ s,^\s*, ,;
+ $cont =~ s/(*negative_lookbehind:\\)#.*//;
+ $cont =~ s/\s+$//;
+ substr($_, -1) = $cont;
}
# Conditionals
Index: pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.8 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.9
--- pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.8 Fri Aug 12 22:32:21 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t Fri Aug 12 22:40:40 2022
@@ -1,4 +1,4 @@
-# $NetBSD: parse_makefile.t,v 1.8 2022/08/12 22:32:21 rillig Exp $
+# $NetBSD: parse_makefile.t,v 1.9 2022/08/12 22:40:40 rillig Exp $
use strict;
use warnings;
@@ -58,11 +58,9 @@ sub test_parse_makefile_vars() {
'.CURDIR, BSD_PKG_MK, COMMENT, MULTI, VAR');
ok($vars->{BSD_PKG_MK}, 'YES');
- # FIXME: must be 'value'
- ok($vars->{COMMENT}, 'valu');
+ ok($vars->{COMMENT}, 'value');
- # FIXME: must be 'one two three'
- ok($vars->{MULTI}, "one two three#comment");
+ ok($vars->{MULTI}, 'one two three');
ok($vars->{VAR}, 'value');
}
Home |
Main Index |
Thread Index |
Old Index