Received: by mail.netbsd.org (Postfix, from userid 605) id A23CA84F63; Tue, 16 Aug 2022 18:58:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id DBE1984D28 for ; Tue, 16 Aug 2022 18:58:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id TfUNGylSTZel for ; Tue, 16 Aug 2022 18:58:00 +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 5604884D22 for ; Tue, 16 Aug 2022 18:58:00 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 4A062FB1A; Tue, 16 Aug 2022 18:58:00 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_166067628016430" MIME-Version: 1.0 Date: Tue, 16 Aug 2022 18:58:00 +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: <20220816185800.4A062FB1A@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_166067628016430 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Tue Aug 16 18:58:00 UTC 2022 Modified Files: pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl Log Message: lintpkgsrc: clean up loading distfiles for installed package To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 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. --_----------=_166067628016430 Content-Disposition: inline Content-Length: 2248 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.98 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.99 --- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.98 Tue Aug 16 18:47:50 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Tue Aug 16 18:58:00 2022 @@ -1,5 +1,5 @@ #!@PERL5@ -# $NetBSD: lintpkgsrc.pl,v 1.98 2022/08/16 18:47:50 rillig Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.99 2022/08/16 18:58:00 rillig Exp $ # Written by David Brownlee . # @@ -1405,29 +1405,18 @@ sub remove_distfiles($pkgsrcdir, $pkgdis my (%distfiles, @pkgdistfiles); foreach my $pkgver (sort @installed) { my $pkgpath = $pkgver->var('dir'); - next unless open(DISTINFO, "$pkgsrcdir/$pkgpath/distinfo"); - while () { - next unless m/^(\w+) ?\(([^\)]+)\) = (\S+)/; - my $dn = $2; - next if $dn =~ /^patch-[\w.+\-]+$/; - # Strip leading ./ which sometimes gets added - # because of DISTSUBDIR=. - $dn =~ s/^(\.\/)*//; - if (!defined $distfiles{$dn}) { - $distfiles{$dn}{name} = $dn; - push @pkgdistfiles, $dn; - } + foreach my $entry (load_distinfo("$pkgsrcdir/$pkgpath")) { + my $distfile = $entry->{distfile}; + next if $distfile =~ /^patch-[\w.+\-]+$/; + next if defined $distfiles{$distfile}; + $distfiles{$distfile}->{name} = $distfile; + push @pkgdistfiles, $distfile; } - close(DISTINFO); } # distfiles downloaded on the current system - my @tmpdistfiles = listdir("$pkgdistdir", undef); - my @dldistfiles = grep { $_ ne 'pkg-vulnerabilities' } @tmpdistfiles; - - # sort the two arrays to make searching a bit faster - @dldistfiles = sort @dldistfiles; - @pkgdistfiles = sort @pkgdistfiles; + my @dldistfiles = sort grep { $_ ne 'pkg-vulnerabilities' } + listdir("$pkgdistdir", undef); if ($opt{y}) { # looking for files that are downloaded on the current system @@ -1461,7 +1450,7 @@ sub remove_distfiles($pkgsrcdir, $pkgdis # but belong to a currently installed package i.e. parented my $found = 0; my @parent; - foreach my $pkgdf (@pkgdistfiles) { + foreach my $pkgdf (sort @pkgdistfiles) { foreach my $dldf (@dldistfiles) { if ($pkgdf eq $dldf) { $found = 1; --_----------=_166067628016430--