--- perl.req 2002-10-11 14:31:38 +0400 +++ perl.req 2002-10-31 00:52:07 +0300 @@ -39,9 +39,43 @@ # by Ken Estes Mail.com kestes@staff.mail.com # modified by Mikhail Zabaluev +# modified by Alexey Tourbin + +use 5.005; # qr +use Getopt::Long; +GetOptions("debug" => \my $debug); +if ($debug) { + require IO::Handle; + STDOUT->autoflush(1); + STDERR->autoflush(1); + warn "debug mode enabled\n"; +} require File::Spec; +my @ignore_files = ( + qr(/usr/share/doc/), + qr(/[Dd]emos?/), +); +my @ignore_reqs = ( + qr(^Makefile\b), +# OS-specific + qr(^machine/ansi\b), + qr(^sys/systeminfo\b), + qr(^vmsish\b), + qr(^MacPerl\b), + qr(^VMS/), + qr(^OS2/), + qr(^Mac/), + qr(^ExtUtils/XSSymSet\b), + qr(^Convert/EBCDIC\b), +# old names + qr(^Digest/Perl/MD5\b), + qr(^Pod/PlainText\b), +# wrong names + qr(/\.), + qr(\$), +); if (@ARGV) { foreach (@ARGV) { @@ -57,35 +91,14 @@ } } - -# obtain the list of library directories. If not provided, use @INC - -if (exists $ENV{RPM_PERL_LIB_PATH}) { - @perl_inc = split(/[:,\s]+/, $ENV{RPM_PERL_LIB_PATH}); -} -else { - @perl_inc = grep { m|^/| } @INC; -} - -# add installation mirrors to the library search list - -my $buildroot = $ENV{RPM_BUILD_ROOT}; -push @perl_inc, map { "${buildroot}$_" } @perl_inc; - - +MODULE: foreach $module (sort keys %require) { - - # search for the file to be installed in the system or in this same package - - my $found = 0; - for (@perl_inc) { - if (-e "$_/$module") { - $found = 1; - last; - } + for my $re (@ignore_reqs) { + if ($module =~ $re) { + warn "module $module matches $re; skip\n" if $debug; + next MODULE; + } } - next unless $found; - if (length($require{$module}) == 0) { print "perl($module)\n"; } else { @@ -104,6 +117,13 @@ return if $file eq ''; + foreach my $re (@ignore_files) { + if ($file =~ $re) { + warn "file $file matches $re; skip\n" if $debug; + return; + } + } + open(FILE, "<$file")|| die("$0: Could not open file: '$file' : $!\n");