]> git.pld-linux.org Git - packages/rpm.git/commitdiff
This commit was manufactured by cvs2git to create tag 'rpm-4_0_2-110'. rpm-4_0_2-110
authorcvs2git <feedback@pld-linux.org>
Tue, 2 Sep 2003 00:01:48 +0000 (00:01 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Sprout from RA-branch 2003-07-16 08:41:19 UTC trojan <trojan@pld-linux.org> '- typo in rpmbuild(macro)'
Cherrypick from RA-branch 2003-09-02 00:01:48 UTC cvs2git <feedback@pld-linux.org> 'This commit was manufactured by cvs2git to create branch 'RA-branch'.':
    perl.prov -> 1.7
Delete:
    rpm-perlprov-perl5.6.patch
    rpm-perlprov.patch

perl.prov [new file with mode: 0644]
rpm-perlprov-perl5.6.patch [deleted file]
rpm-perlprov.patch [deleted file]

diff --git a/perl.prov b/perl.prov
new file mode 100644 (file)
index 0000000..2319092
--- /dev/null
+++ b/perl.prov
@@ -0,0 +1,119 @@
+#!/usr/bin/perl
+use Safe;
+use strict;
+
+# perl.prov - find information about perl modules for RPM
+# $Id$
+
+# It's questionable if we should provide perl(Foo::Bar) for modules
+# from outside @INC (possibly shipped with some applications).
+# I think we should not, and provide them only for the perl.req script,
+# while it scans files in that particular application.
+
+# This shoud be provided as a library -- the same functionality is
+# needed by the perl.req script.
+
+my %provide;
+my @inc = sort { length $b cmp length $a } grep m#^/.+#, @INC;
+my $safe = new Safe;
+
+# process @ARGV or STDIN
+foreach ( @ARGV ? @ARGV : <> ) {
+       chomp;
+       next if !-f || -l;                # skip non-files and symlinks
+       next if m#/usr/(?:doc|src)/#;     # lot of false alarms; warning: we ignore ^ here
+       next if !m#\.p[ml]$#;             # we only care about *.pm and *.pl files
+       process_file($_) if -f;
+}
+
+# print out what we found
+for ( sort keys %provide ) {
+       print "perl($_)" . ( length $provide{$_} ? " = $provide{$_}" : '' ) . "\n";
+#      warn  "perl($_)" . ( length $provide{$_} ? " = $provide{$_}" : '' ) . "\n";
+}
+
+############################################################
+#####   functions                                      #####
+############################################################
+
+sub process_file {
+       my $file = shift;
+       my ( $package, $version );
+
+       # if the file lives under @INC, we can
+       # obtain the package name from it's path
+       for (@inc) {
+               if ( $file =~ m#\Q$_\E/?(.+)$# ) { # warning: we ignore ^ here
+                       $package = $1;
+
+                       if ( $package !~ s/\.pm$// ) {    # it's a *.pl
+                               # $package =~ m#([^/]+)$#;
+                               # $provide{$1} = '';
+                               return 1;
+                       }
+
+                       $package =~ s#/#::#g;
+                       last;
+               }
+       }
+
+       # it can be a *.pl oustide @INC
+       return if /\.pl$/;
+
+       open FILE, $file or die "$0: cannot open file `$file': $!";
+
+       while (<FILE>) {
+
+               # skip the documentation
+               next
+                 if m/^=(?:head1|head2|pod|item|begin|for|over)\b/
+                    ... ( m/^=(?:cut|end)\b/ || $. == 1 );
+
+               # skip the data section
+               last if m/^__(?:DATA|END)__$/;
+
+               # search for the package name
+               if (
+                       !defined $package
+                       && ( my ($pack) = m/^\s*(?:\{\s*)?package\s+([_:a-zA-Z0-9]+?):*\s*;/ )
+                       && $1 ne 'main'
+                       && match_the_path( $file, $1 )
+                 )
+               {
+                       $package = $pack;
+               }
+
+               if ( !defined $version && /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/ ) {
+                       ( $version = $safe->reval($_) ) =~ s/^\s+|alpha|beta|\s+$//g;
+                       if ( defined $version
+                               && length $version
+                               && $version =~ /[^\d\._abcdefgh]/ )
+                       {
+                               warn "$0: weird version number in $file: [$version]\n";
+                               $version = '';
+                       }
+               }
+       }
+
+       unless ( defined $package ) {
+               warn "$0: weird, cannot determine the package name for `$file'\n";
+               return 0;
+       }
+
+       $provide{$package} = $version;
+
+       close FILE or die "$0: cannot close file `$file': $!";
+
+       1;
+}
+
+
+# Returns true if the package name matches the patch,
+# so you can use() it.  False otherwise.
+sub match_the_path {
+       my ( $file, $pack ) = @_;
+       $pack =~ s#::#/#g;
+       $file =~ /\Q$pack\E(?:\.pm)?$/;
+}
+
+# vim: ts=4 sw=4 noet noai nosi cin
diff --git a/rpm-perlprov-perl5.6.patch b/rpm-perlprov-perl5.6.patch
deleted file mode 100644 (file)
index 25a8e39..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-diff -urN rpm-4.0.2/scripts/perl.prov rpm-4.0.2-grabba/scripts/perl.prov
---- rpm-4.0.2/scripts/perl.prov        Wed Mar  6 16:30:05 2002
-+++ rpm-4.0.2-grabba/scripts/perl.prov Wed Mar  6 16:31:52 2002
-@@ -47,7 +47,7 @@
- if ("@ARGV") {
-   foreach (@ARGV) {
--     if (! m=(/(doc|usr/src)/|\.(so|gz|ph|pod|h|html)$)=) {
-+     if (! m=(/(doc|usr/src)/|\.(so|gz|ph|pod|h|html|al|ix)$)=) {
-       process_file($_) if -f "$_";
-     }
-   }
-@@ -57,7 +57,7 @@
-   # contents of the file.
-   foreach (<>) {
--     if (! m=(/(doc|usr/src)/|\.(so|gz|ph|pod|h|html)$)=) {
-+     if (! m=(/(doc|usr/src)/|\.(so|gz|ph|pod|h|html|al|ix)$)=) {
-       process_file($_) if -f "$_";
-     }
-   }
-@@ -116,7 +116,7 @@
-     # package name so we report all namespaces as if they were
-     # provided packages (really ugly).
--    if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/) {
-+    if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/ && $1 ne 'main' && !$require{$1}) {
-       $package=$1;
-       undef $version;
-       $require{$package}=undef;
-@@ -132,10 +132,15 @@
-     #ExtUtils/Install.pm:$VERSION = substr q$Revision$, 10;
-     #CGI/Apache.pm:$VERSION = (qw$Revision$)[1];
-     #DynaLoader.pm:$VERSION = $VERSION = "1.03";     # avoid typo warning
-+    #Cwd.pm:our $VERSION = '2.04';
-+
-+    # here is example of VERSION line from RPC::PlClient module
-+
-+    # RPC/PlClient.pm:$RPC::PlClient::VERSION = '0.2016';
-     if ( 
-       ($package) && 
--      (m/^\s*\$VERSION\s*=\s+/)
-+      (m/^\s*(our)?\s*\$(${package}::)?VERSION\s*=/)
-        ) {
-       # first see if the version string contains the string
diff --git a/rpm-perlprov.patch b/rpm-perlprov.patch
deleted file mode 100644 (file)
index 63cd4ec..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -Naur rpm-4.0.2/scripts/perl.prov rpm-4.0.2-p/scripts/perl.prov
---- rpm-4.0.2/scripts/perl.prov        Fri Jun 22 16:03:59 2001
-+++ rpm-4.0.2-p/scripts/perl.prov      Fri Jun 22 16:03:46 2001
-@@ -99,11 +99,11 @@
-     # properly belongs in the over/back section) but people do not
-     # read the perldoc.
--    if ( (m/^=(head1|head2|pod|item)/) .. (m/^=(cut)/) ) {
-+    if ( (m/^=(head1|head2|pod|item)/) .. (m/^=(cut)/ || eof) ) {
-       next;
-     }
-     
--    if ( (m/^=(over)/) .. (m/^=(back)/) ) {
-+    if ( (m/^=(over)/) .. (m/^=(back)/ || eof) ) {
-       next;
-     }
-     
This page took 0.054039 seconds and 4 git commands to generate.