]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- better perl files detection patch and test script
authormis <mis@pld-linux.org>
Mon, 11 Dec 2000 12:32:25 +0000 (12:32 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm-perl-req-perlfile.patch -> 1.1

rpm-perl-req-perlfile.patch [new file with mode: 0644]

diff --git a/rpm-perl-req-perlfile.patch b/rpm-perl-req-perlfile.patch
new file mode 100644 (file)
index 0000000..45043f7
--- /dev/null
@@ -0,0 +1,76 @@
+--- rpm-4.0/scripts/perl.req   Wed Jul  5 14:26:37 2000
++++ rpm-4.0.new/scripts/perl.req       Wed Nov 15 21:31:03 2000
+@@ -82,6 +82,53 @@
+ exit 0;
++sub is_perlfile {
++    my $file = shift;
++    my $fh = shift;
++    
++    my $fl = <$fh>;
++
++    my $is_perl = 0;
++  
++    my $nw = 0;
++
++    if ($file =~ /\.(so|ph|h|html|pod|gz|bz2|png|gif|jpg|xpm|a|patch|o|mo)$/) {
++      $is_perl = 0;
++      
++      # .al, .pl, .pm and .plx (perl-Font-TTF contains *.plx files)
++    } elsif ($file =~ /\.p[lm]x?$/ || $file =~ /\.al$/) {     
++      $is_perl = 1;
++      #print STDERR "$file PERL by ext\n";
++    } elsif ($fl =~ m|bin/perl| or $fl =~ m|env\s+perl| or $fl =~ m|exec\s+perl|) {
++      $is_perl = 1;
++      #print STDERR "$file PERL by perl\n";
++    } elsif ($fl =~ m|bin/sh|) {
++      while (<$fh>) {
++          if (/eval/ && /perl/) {
++              $is_perl = 1;
++              last;
++          }
++          $nw++ if (/^\s*BEGIN/); 
++          $nw++ if (/^\s*sub\s+/);
++          $nw++ if (/^\s*package\s+/);
++          $nw++ if (/^\s*use\s+strict\s+;/);
++          $nw++ if (/^\s*use\s+vars\s*qw/);
++          last if ($. > 30);
++      }
++    }
++    
++    seek($fh, 0, 0);
++    
++    $is_perl = 1 if ($nw > 1);  # propably perl file
++    
++    #if (!$is_perl) {
++    #   print STDERR "NOPERL $file\n";
++    #   return 0;
++    #}        
++    #print STDERR "PERL $file\n" if ($is_perl);
++    return $is_perl;
++}
++
+ sub process_file {
+   
+@@ -90,6 +137,8 @@
+   
+   open(FILE, "<$file")||
+     die("$0: Could not open file: '$file' : $!\n");
++
++  return if (!is_perlfile($file, \*FILE));
+   
+   while (<FILE>) {
+     
+@@ -209,6 +258,10 @@
+       # if the module name starts in a dot it is not a module name.
+       ($module =~ m/^\./) && next;
++
++      # name starts in a non alphanumeric character it is not a module 
++      # name.
++      ($module =~ m/^\W/) && next;
+       # if the module ends with .pm strip it to leave only basename.
This page took 0.04552 seconds and 4 git commands to generate.