summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authormspo <mspo@pkgsrc.org>2012-09-09 15:47:35 +0000
committermspo <mspo@pkgsrc.org>2012-09-09 15:47:35 +0000
commitc5c23f81609cfd2189353a5accf370d42661e05d (patch)
tree1dc4033784cda7a8b18ce4febda759ec3072bf88 /pkgtools
parentadc0eac816b745cab59224a5b12168108f04511c (diff)
downloadpkgsrc-c5c23f81609cfd2189353a5accf370d42661e05d.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-xpkgtools/lintpkgsrc/files/lintpkgsrc.pl47
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 ),