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/4fdda8b4648c
branches: trunk
changeset: 383138:4fdda8b4648c
user: rillig <rillig%pkgsrc.org@localhost>
date: Fri Aug 12 22:40:40 2022 +0000
description:
lintpkgsrc: fix parsing of comments in makefile lines
diffstat:
pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 15 +++++++++------
pkgtools/lintpkgsrc/files/t/parse_makefile.t | 8 +++-----
2 files changed, 12 insertions(+), 11 deletions(-)
diffs (58 lines):
diff -r c4703f060195 -r 4fdda8b4648c pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Fri Aug 12 22:32:21 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Fri Aug 12 22:40:40 2022 +0000
@@ -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 @@
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
diff -r c4703f060195 -r 4fdda8b4648c pkgtools/lintpkgsrc/files/t/parse_makefile.t
--- a/pkgtools/lintpkgsrc/files/t/parse_makefile.t Fri Aug 12 22:32:21 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/parse_makefile.t Fri Aug 12 22:40:40 2022 +0000
@@ -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 @@
'.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