Received: by mail.netbsd.org (Postfix, from userid 605) id BD42E84ECE; Sun, 14 Aug 2022 03:12:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 006F184D51 for ; Sun, 14 Aug 2022 03:12:04 +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 mNP9IFsUHYVv for ; Sun, 14 Aug 2022 03:12:03 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 2164384CDC for ; Sun, 14 Aug 2022 03:12:03 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 0EBC9FB1A; Sun, 14 Aug 2022 03:12:03 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_166044672344860" MIME-Version: 1.0 Date: Sun, 14 Aug 2022 03:12:03 +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: <20220814031203.0EBC9FB1A@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_166044672344860 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Sun Aug 14 03:12:02 UTC 2022 Modified Files: pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl Log Message: lintpkgsrc: clean up variable names and verbose/debug log messages To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_166044672344860 Content-Disposition: inline Content-Length: 4654 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.89 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.90 --- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.89 Sun Aug 14 03:06:41 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Sun Aug 14 03:12:02 2022 @@ -1,5 +1,5 @@ #!@PERL5@ -# $NetBSD: lintpkgsrc.pl,v 1.89 2022/08/14 03:06:41 rillig Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.90 2022/08/14 03:12:02 rillig Exp $ # Written by David Brownlee . # @@ -307,36 +307,35 @@ sub eval_mk_cond_func($func, $arg, $vars } sub eval_mk_cond($line, $vars) { - my $test = expand_exprs($line, $vars); + my $cond = expand_exprs($line, $vars); # XXX This is _so_ wrong - need to parse this correctly - $test =~ s/""/\r/g; - $test =~ s/"//g; - $test =~ s/\r/""/g; + $cond =~ s/""/\r/g; + $cond =~ s/"//g; + $cond =~ s/\r/""/g; - debug("conditional: $test"); + debug("conditional: $cond"); - while ($test =~ /(target|empty|make|defined|exists)\s*\(([^()]+)\)/) { + while ($cond =~ /(target|empty|make|defined|exists)\s*\(([^()]+)\)/) { my ($func, $arg) = ($1, $2); my $result = eval_mk_cond_func($func, $arg, $vars); - $test =~ s/$func\s*\([^()]+\)/$result/; - debug("conditional: update to $test"); + $cond =~ s/$func\s*\([^()]+\)/$result/; + debug("conditional: update to $cond"); } - while ($test =~ /([^\s()\|\&]+) \s+ (!=|==) \s+ ([^\s()]+)/x) { + while ($cond =~ /([^\s()\|\&]+) \s+ (!=|==) \s+ ([^\s()]+)/x) { my $result = 0 + (($2 eq '==') ? ($1 eq $3) : ($1 ne $3)); - $test =~ s/[^\s()\|\&]+ \s+ (!=|==) \s+ [^\s()]+/$result/x; + $cond =~ s/[^\s()\|\&]+ \s+ (!=|==) \s+ [^\s()]+/$result/x; } - if ($test =~ /^[ <> \d () \s & | . ! ]+$/xx) { - debug("eval test $test"); - my $result = eval "($test) ? 1 : 0"; - defined $result or fail("Eval '$test' failed in '$line': $@"); + if ($cond =~ /^[ <> \d () \s & | . ! ]+$/xx) { + my $result = eval "($cond) ? 1 : 0"; + defined $result or fail("Eval '$cond' failed in '$line': $@"); debug("conditional: evaluated to " . ($result ? 'true' : 'false')); $result; } else { - debug("conditional: defaulting '$test' to true"); + debug("conditional: defaulting '$cond' to true"); 1; } } @@ -1146,7 +1145,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p $check_distinfo) { my (@categories); my (%distfiles, %sumfiles, @distwarn, $numpkg); - my (%bad_distfiles); + my (%unref_distfiles); @categories = list_pkgsrc_categories($pkgsrcdir); @@ -1172,7 +1171,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p return if $distn =~ m/^\.cvsignore/; return if $distn =~ m/^CVS\//; if (!defined($dist = $distfiles{$distn})) { - $bad_distfiles{$distn} = 1; + $unref_distfiles{$distn} = 1; } elsif ($dist->{sum} ne 'IGNORE') { push @{$sumfiles{ $dist->{sumtype} }}, $distn; } @@ -1180,10 +1179,10 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p } }, ($pkgdistdir)); - if ($check_unref && %bad_distfiles) { - verbose(scalar(keys %bad_distfiles), + if ($check_unref && %unref_distfiles) { + verbose(scalar(keys %unref_distfiles), " unreferenced file(s) in '$pkgdistdir':\n"); - print join("\n", sort keys %bad_distfiles), "\n"; + print join("\n", sort keys %unref_distfiles), "\n"; } if ($check_distinfo) { @@ -1198,7 +1197,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p foreach my $file (@{$sumfiles{$sum}}) { if (!-f $file || -S $file != $distfiles{$file}{sum}) { print $file, " (Size)\n"; - $bad_distfiles{$file} = 1; + $unref_distfiles{$file} = 1; } } next; @@ -1218,7 +1217,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p if (m/^$sum ?\(([^\)]+)\) = (\S+)/) { if ($distfiles{$1}{sum} ne $2) { print $1, " ($sum)\n"; - $bad_distfiles{$1} = 1; + $unref_distfiles{$1} = 1; } } } @@ -1229,7 +1228,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p chdir_or_fail('/'); # Do not want to stay in $pkgdistdir } - sort keys %bad_distfiles; + sort keys %unref_distfiles; } sub store_pkgdb_in_cache($db, $fname) { @@ -1370,12 +1369,12 @@ sub debug_parse_makefiles(@args) { } sub check_distfiles($pkgsrcdir, $pkgdistdir) { - my @baddist = scan_pkgsrc_distfiles_vs_distinfo( + my @unref_distfiles = scan_pkgsrc_distfiles_vs_distinfo( $pkgsrcdir, $pkgdistdir, $opt{o}, $opt{m}); return unless $opt{r}; - verbose("Unlinking 'bad' distfiles\n"); - foreach my $distfile (@baddist) { + verbose("Unlinking unreferenced distfiles\n"); + foreach my $distfile (@unref_distfiles) { unlink("$pkgdistdir/$distfile"); } } --_----------=_166044672344860--