From bb12d0bbb429c01add8cfe2e4780552e79b535b5 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Tue, 6 Dec 2011 09:44:29 -0500 Subject: [PATCH] Focusing on the first group of excluded list right now. --- find-not-in-dir.plx | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/find-not-in-dir.plx b/find-not-in-dir.plx index b025e92..10f8959 100644 --- a/find-not-in-dir.plx +++ b/find-not-in-dir.plx @@ -18,6 +18,8 @@ # along with this program in a file in the toplevel directory called # "GPLv3". If not, see . # +use strict; +use warnings; ###################################################################### sub FindAndSortOutput { @@ -43,8 +45,10 @@ sub FindAndSortOutput { find({ wanted => $buildList, no_chdir => 1}, $dir); - open(FILE_OUTPUT, ">$output") or - die "$0: unable to open temporary output file, $output: $!"; + if (defined $output) { + open(FILE_OUTPUT, ">$output") or + die "$0: unable to open temporary output file, $output: $!"; + } my @sortedChompedFiles; foreach my $file (sort {$a cmp $b } @files) { @@ -52,13 +56,40 @@ sub FindAndSortOutput { next if defined $ignoreRegex and $file =~ /$ignoreRegex/; next if defined $includeRegex and $file !~ /$includeRegex/; push(@sortedChompedFiles, $file); - print FILE_OUTPUT "$file\n"; + print FILE_OUTPUT "$file\n" if defined $output; } - close FILE_OUTPUT; + close FILE_OUTPUT if defined $output; + die "unable to write to output file: $output: $! ($?)" + if $? != 0 and defined $output; return @sortedChompedFiles; } ###################################################################### -my(@orgNonRegular) = FindAndSortOutput("FILES", $origDir, $origTempFile, - $ignoreRegex, "^/?($origDir|$comparedDir)/?"); +if (@ARGV < 2) { + print STDERR "usage: $0 ... \n"; + exit 1; +} +my $excludeDirectory = shift @ARGV; +my(@directories) = @ARGV; + + my($type, $dir, $output, $ignoreRegex, $includeRegex, $filterRewrite) = @_; + +my(@ignoredFiles) = FindAndSortOutput("FILES", $excludeDirectory, undef, + undef, undef, '.*/[^/]+$'); + +my %ignoredFiles; +foreach my $file (@ignoredFiles) { $ignoredFiles{$file} = 1; } + +foreach my $file (sort keys %ignoredFiles) { print "IGNORING: $file\n"; } + +my @files; + +foreach my $dir (@directories) { + push(@files, FindAndSortOutput("FILES", $dir)); +} +############################################################################### +# +# Local variables: +# compile-command: "perl -c find-not-in-dir.plx" +# End: