Received: by mail.netbsd.org (Postfix, from userid 605) id 1BB5284E90; Fri, 12 Aug 2022 22:40:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 5668B84E60 for ; Fri, 12 Aug 2022 22:40:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id f7nSmUcorEjJ for ; Fri, 12 Aug 2022 22:40:40 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id C404A84DA5 for ; Fri, 12 Aug 2022 22:40:40 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id BD25BFB1A; Fri, 12 Aug 2022 22:40:40 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1660344040112620" MIME-Version: 1.0 Date: Fri, 12 Aug 2022 22:40:40 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/lintpkgsrc/files To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20220812224040.BD25BFB1A@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1660344040112620 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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. --_----------=_1660344040112620 Content-Disposition: inline Content-Length: 2104 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii 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 . # @@ -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'); } --_----------=_1660344040112620--