diff options
author | mspo <mspo> | 2012-09-09 15:47:35 +0000 |
---|---|---|
committer | mspo <mspo> | 2012-09-09 15:47:35 +0000 |
commit | 509e81306744acb5a775bafec0388c5b620370d0 (patch) | |
tree | 1dc4033784cda7a8b18ce4febda759ec3072bf88 /pkgtools | |
parent | 8ffcc06ce82ed92bb33d4635ea92348fa22602dd (diff) | |
download | pkgsrc-509e81306744acb5a775bafec0388c5b620370d0.tar.gz |
use file::find to save memory in lintpkgsrc- should never grow more than 25MB now -- makes no effort to clean up empty directories, so that is still fixable
Diffstat (limited to 'pkgtools')
-rwxr-xr-x | pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl index 797e805bf9c..29928926c10 100755 --- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl +++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl @@ -1,6 +1,6 @@ #! @PERL@ -# $NetBSD: lintpkgsrc.pl,v 1.1 2012/07/13 21:12:07 abs Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.2 2012/09/09 15:47:35 mspo Exp $ # Written by David Brownlee <abs@netbsd.org>. # @@ -601,6 +601,8 @@ sub invalid_version($) { # List (recursive) non directory contents of specified directory # +#TODO this entire sub should be replaced with direct calls to +# File::Find sub listdir($$) { my ( $base, $dir ) = @_; my ($thisdir); @@ -1506,19 +1508,38 @@ sub scan_pkgsrc_distfiles_vs_distinfo($$$$) { sum => 'IGNORE' }; - foreach my $file ( listdir( "$pkgdistdir", undef ) ) { - my ($dist); - - if ( !defined( $dist = $distfiles{$file} ) ) { - $bad_distfiles{$file} = 1; - - } - else { - if ( $dist->{sum} ne 'IGNORE' ) { - push( @{ $sumfiles{ $dist->{sumtype} } }, $file ); +# bad for memory +# foreach my $file ( listdir( "$pkgdistdir", undef ) ) { +# my ($dist); +# +# if ( !defined( $dist = $distfiles{$file} ) ) { +# $bad_distfiles{$file} = 1; +# +# } +# else { +# if ( $dist->{sum} ne 'IGNORE' ) { +# push( @{ $sumfiles{ $dist->{sumtype} } }, $file ); +# } +# } +# } +# check each file in $pkgdistdir + find ( { wanted => sub { + my ($dist); + if ( -f $File::Find::name ) + { + my $distn = $File::Find::name; + $distn =~ s/$pkgdistdir\/?//g; + if ( !defined ($dist = $distfiles{$distn} ) ) { + $bad_distfiles{$distn} = 1; + } + else { + if ( $dist->{sum} ne 'IGNORE' ) { + push( @{ $sumfiles{ $dist->{sumtype} } }, $distn ); + } + } } - } - } + } }, + ($pkgdistdir) ); if ( $check_unref && %bad_distfiles ) { verbose( scalar( keys %bad_distfiles ), |