Received: by mail.netbsd.org (Postfix, from userid 605) id 7EE2784EA0; Thu, 4 Aug 2022 05:50:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id B883284E85 for ; Thu, 4 Aug 2022 05:50:55 +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 iRPAsMqzSw4Y for ; Thu, 4 Aug 2022 05:50:54 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id ABEA484E6B for ; Thu, 4 Aug 2022 05:50:54 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id A5044FB1A; Thu, 4 Aug 2022 05:50:54 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1659592254284370" MIME-Version: 1.0 Date: Thu, 4 Aug 2022 05:50:54 +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: <20220804055054.A5044FB1A@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1659592254284370 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Thu Aug 4 05:50:54 UTC 2022 Modified Files: pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl pkgsrc/pkgtools/lintpkgsrc/files/t: pkgversion.t Log Message: lintpkgsrc: use single-quoted strings where possible To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl cvs rdiff -u -r1.9 -r1.10 pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1659592254284370 Content-Disposition: inline Content-Length: 8584 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.52 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.53 --- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.52 Thu Aug 4 05:45:15 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Thu Aug 4 05:50:54 2022 @@ -1,6 +1,6 @@ #!@PERL5@ -# $NetBSD: lintpkgsrc.pl,v 1.52 2022/08/04 05:45:15 rillig Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.53 2022/08/04 05:50:54 rillig Exp $ # Written by David Brownlee . # @@ -308,13 +308,13 @@ sub split_pkgversion($) { foreach my $elem (split(/(pl|pre|rc|beta|alpha|\D)/, $pkgversion)) { if ($elem =~ /\d/) { push(@temp, +$elem); - } elsif ($elem eq "pl" || $elem eq "." || $elem eq "_") { + } elsif ($elem eq 'pl' || $elem eq '.' || $elem eq '_') { push(@temp, 0); - } elsif ($elem eq "pre" || $elem eq "rc") { + } elsif ($elem eq 'pre' || $elem eq 'rc') { push(@temp, -1); - } elsif ($elem eq "beta") { + } elsif ($elem eq 'beta') { push(@temp, -2); - } elsif ($elem eq "alpha") { + } elsif ($elem eq 'alpha') { push(@temp, -3); } elsif ('a' le $elem && $elem le 'z') { push(@temp, 0); @@ -438,7 +438,7 @@ sub parse_eval_make_false($$) { if (!defined $false) { fail("Eval failed $line - $test"); } - debug("conditional: evaluated to " . ($false ? 0 : 1) . "\n"); + debug('conditional: evaluated to ' . ($false ? 0 : 1) . "\n"); } else { $false = 0; @@ -466,7 +466,7 @@ sub parse_makefile_vars($$) { $_; } ; close(FILE); - $incdirs{"."} = 1; + $incdirs{'.'} = 1; $incdirs{dirname($file)} = 1; # Some Makefiles depend on these being set @@ -588,7 +588,7 @@ sub parse_makefile_vars($$) { } verbose("$file: Cannot locate $incfile in " - . join(" ", sort keys %incdirs) + . join(' ', sort keys %incdirs) . "\n"); } else { @@ -637,12 +637,12 @@ sub parse_makefile_vars($$) { # Give python a little hand (XXX - do we wanna consider actually # implementing make .for loops, etc? # - if ($key eq "PYTHON_VERSIONS_ACCEPTED") { + if ($key eq 'PYTHON_VERSIONS_ACCEPTED') { my ($pv); foreach $pv (split(/\s+/, $vars{PYTHON_VERSIONS_ACCEPTED})) { - $vars{"_PYTHON_VERSION_FIRSTACCEPTED"} ||= $pv; - $vars{"_PYTHON_VERSION_${pv}_OK"} = "yes"; + $vars{'_PYTHON_VERSION_FIRSTACCEPTED'} ||= $pv; + $vars{"_PYTHON_VERSION_${pv}_OK"} = 'yes'; } } } @@ -1105,7 +1105,7 @@ sub parse_makefile_pkgsrc($) { print "\nBogus: PKGREVISION $vars->{PKGREVISION} (from $file)\n"; } elsif ($vars->{PKGREVISION}) { - $pkgname .= "nb"; + $pkgname .= 'nb'; $pkgname .= $vars->{PKGREVISION}; } } @@ -1155,7 +1155,7 @@ sub chdir_or_fail($) { sub load_pkgsrc_makefiles($) { my ($fname) = @_; - open(STORE, "<", $fname) + open(STORE, '<', $fname) or die("Cannot read pkgsrc store from $fname: $!\n"); my ($pkgver); $pkglist = PkgList->new; @@ -1228,7 +1228,7 @@ sub pkgsrc_check_depends() { my ($err, $msg); defined $pkgver->var('DEPENDS') || next; - foreach my $depend (split(" ", $pkgver->var('DEPENDS'))) { + foreach my $depend (split(' ', $pkgver->var('DEPENDS'))) { $depend =~ s/:.*// || next; @@ -1336,10 +1336,10 @@ sub scan_pkgsrc_distfiles_vs_distinfo($$ next; } - my $pid = open3(my $in, my $out, undef, "xargs", "digest", $sum); - defined($pid) || fail "fork"; + my $pid = open3(my $in, my $out, undef, 'xargs', 'digest', $sum); + defined($pid) || fail 'fork'; my $pid2 = fork(); - defined($pid2) || fail "fork"; + defined($pid2) || fail 'fork'; if ($pid2) { close($in); } else { @@ -1356,7 +1356,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($$ } close($out); waitpid($pid, 0) || fail "xargs digest $sum"; - waitpid($pid2, 0) || fail "pipe write to xargs"; + waitpid($pid2, 0) || fail 'pipe write to xargs'; } chdir_or_fail('/'); # Do not want to stay in $pkgdistdir } @@ -1366,7 +1366,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($$ sub store_pkgsrc_makefiles($) { my ($fname) = @_; - open(STORE, ">", $fname) + open(STORE, '>', $fname) or die("Cannot save pkgsrc store to $fname: $!\n"); my $prev = select(STORE); $pkglist->store(); @@ -1470,7 +1470,7 @@ sub check_prebuilt_packages() { sub debug_parse_makefiles(@) { foreach my $file (@_) { - -d $file and $file .= "/Makefile"; + -d $file and $file .= '/Makefile'; -f $file or fail("No such file: $file"); my ($pkgname, $vars) = parse_makefile_pkgsrc($file); @@ -1540,7 +1540,7 @@ sub remove_distfiles($$) { # distfiles downloaded on the current system my @tmpdistfiles = listdir("$pkgdistdir", undef); - my @dldistfiles = grep { $_ ne "pkg-vulnerabilities" } @tmpdistfiles; + my @dldistfiles = grep { $_ ne 'pkg-vulnerabilities' } @tmpdistfiles; # sort the two arrays to make searching a bit faster @dldistfiles = sort { $a cmp $b } @dldistfiles; Index: pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t:1.9 pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t:1.10 --- pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t:1.9 Thu Aug 4 05:45:15 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/t/pkgversion.t Thu Aug 4 05:50:54 2022 @@ -1,4 +1,4 @@ -# $NetBSD: pkgversion.t,v 1.9 2022/08/04 05:45:15 rillig Exp $ +# $NetBSD: pkgversion.t,v 1.10 2022/08/04 05:50:54 rillig Exp $ use strict; use warnings; @@ -14,20 +14,20 @@ ok(pkgversioncmp('3.4', '<=', '3.4'), 1) # See pkgtools/pkglint/files/pkgver/vercmp_test.go. my @split_version_tests = ( - [ "5.0", [ [ 5, 0, 0 ], 0 ] ], - [ "5.0nb5", [ [ 5, 0, 0 ], 5 ] ], - [ "0.0.1-SNAP", [ [ 0, 0, 0, 0, 1, 0, 19, 0, 14, 0, 1, 0, 16 ], 0 ] ], - [ "1.0alpha3", [ [ 1, 0, 0, -3, 3 ], 0 ] ], - [ "1_0alpha3", [ [ 1, 0, 0, -3, 3 ], 0 ] ], - [ "2.5beta", [ [ 2, 0, 5, -2 ], 0 ] ], - [ "20151110", [ [ 20151110 ], 0 ] ], - [ "0", [ [ 0 ], 0 ] ], - [ "nb1", [ [], 1 ] ], - [ "1.0.1a", [ [ 1, 0, 0, 0, 1, 0, 1 ], 0 ] ], - [ "1.1.1dnb2", [ [ 1, 0, 1, 0, 1, 0, 4 ], 2 ] ], - [ "1.0.1z", [ [ 1, 0, 0, 0, 1, 0, 26 ], 0 ] ], - [ "0pre20160620", [ [ 0, -1, 20160620 ], 0 ] ], - [ "3.5.DEV1710", [ [ 3, 0, 5, 0, 0, 4, 0, 5, 0, 22, 1710 ], 0 ] ], + [ '5.0', [ [ 5, 0, 0 ], 0 ] ], + [ '5.0nb5', [ [ 5, 0, 0 ], 5 ] ], + [ '0.0.1-SNAP', [ [ 0, 0, 0, 0, 1, 0, 19, 0, 14, 0, 1, 0, 16 ], 0 ] ], + [ '1.0alpha3', [ [ 1, 0, 0, -3, 3 ], 0 ] ], + [ '1_0alpha3', [ [ 1, 0, 0, -3, 3 ], 0 ] ], + [ '2.5beta', [ [ 2, 0, 5, -2 ], 0 ] ], + [ '20151110', [ [ 20151110 ], 0 ] ], + [ '0', [ [ 0 ], 0 ] ], + [ 'nb1', [ [], 1 ] ], + [ '1.0.1a', [ [ 1, 0, 0, 0, 1, 0, 1 ], 0 ] ], + [ '1.1.1dnb2', [ [ 1, 0, 1, 0, 1, 0, 4 ], 2 ] ], + [ '1.0.1z', [ [ 1, 0, 0, 0, 1, 0, 26 ], 0 ] ], + [ '0pre20160620', [ [ 0, -1, 20160620 ], 0 ] ], + [ '3.5.DEV1710', [ [ 3, 0, 5, 0, 0, 4, 0, 5, 0, 22, 1710 ], 0 ] ], ); foreach my $test (@split_version_tests) { @@ -44,34 +44,34 @@ foreach my $test (@split_version_tests) # See pkgtools/pkglint/files/pkgver/vercmp_test.go. my @versions = ( - [ "0pre20160620" ], - [ "0" ], - [ "0nb1", "0NB1", "0Nb1", "0nb00001" ], - [ "0.0.1-SNAPSHOT" ], - [ "1.0alpha" ], - [ "1.0alpha3" ], - [ "1", "1.0", "1.0.0" ], - [ "1.0nb1", "1nb1" ], - [ "1.0nb2", "1_0nb2" ], - [ "1.0.0.0.0.0.0.1" ], - [ "1.0.aa" ], - [ "1.0.a1" ], - [ "1.0.k" ], - [ "1.0.1a" ], - [ "1.0.1.2", "1.0ab" ], - [ "1.0.1z" ], - [ "1.0.11", "1.0k" ], - [ "2.0pre", "2.0rc" ], - [ "2.0", "2.0pl" ], - [ "2.0.1nb4" ], - [ "2.0.1nb17" ], - [ "2.5beta" ], - [ "5.0" ], - [ "5.0nb5" ], - [ "5.5", "5.005" ], - [ "2021.06.17", "2021.6.17" ], - [ "2021.12.01", "2021.12.1" ], - [ "20151110" ], + [ '0pre20160620' ], + [ '0' ], + [ '0nb1', '0NB1', '0Nb1', '0nb00001' ], + [ '0.0.1-SNAPSHOT' ], + [ '1.0alpha' ], + [ '1.0alpha3' ], + [ '1', '1.0', '1.0.0' ], + [ '1.0nb1', '1nb1' ], + [ '1.0nb2', '1_0nb2' ], + [ '1.0.0.0.0.0.0.1' ], + [ '1.0.aa' ], + [ '1.0.a1' ], + [ '1.0.k' ], + [ '1.0.1a' ], + [ '1.0.1.2', '1.0ab' ], + [ '1.0.1z' ], + [ '1.0.11', '1.0k' ], + [ '2.0pre', '2.0rc' ], + [ '2.0', '2.0pl' ], + [ '2.0.1nb4' ], + [ '2.0.1nb17' ], + [ '2.5beta' ], + [ '5.0' ], + [ '5.0nb5' ], + [ '5.5', '5.005' ], + [ '2021.06.17', '2021.6.17' ], + [ '2021.12.01', '2021.12.1' ], + [ '20151110' ], ); my $prev = $Test::TESTOUT; --_----------=_1659592254284370--