]>
Commit | Line | Data |
---|---|---|
281ecd9b | 1 | --- perl5.005_03/find-perl-provides Thu Jan 1 01:00:00 1970 |
2 | +++ perl5.005_03.new/find-perl-provides Fri Oct 22 17:43:47 1999 | |
3 | @@ -0,0 +1,10 @@ | |
4 | +#!/bin/sh | |
5 | +ulimit -c 0 | |
6 | + | |
7 | +export LD_LIBRARY_PATH="FPPATH" | |
8 | + | |
d0b1ca50 | 9 | +filelist=`sed "s/['\"]/\\\&/g"|egrep -v "\.(ph|pod|gz)$"` |
281ecd9b | 10 | + |
11 | +echo $filelist|/usr/lib/rpm/find-provides | |
12 | +FPPATH/find-perl.prov $filelist | |
13 | + | |
14 | --- perl5.005_03/find-perl.prov Thu Jan 1 01:00:00 1970 | |
15 | +++ perl5.005_03.new/find-perl.prov Fri Oct 22 17:44:18 1999 | |
9ca78239 | 16 | @@ -0,0 +1,116 @@ |
281ecd9b | 17 | +#!FPPATH/perl |
18 | + | |
19 | +# a simple script to print the proper name for perl libraries. | |
20 | + | |
21 | +# I plan to rewrite this in C so that perl is not required by RPM at | |
22 | +# build time. | |
23 | + | |
24 | +# by Ken Estes Mail.com kestes@staff.mail.com | |
25 | + | |
26 | +# it would be much better if perl could tell us the proper name of a | |
27 | +# given script. | |
28 | + | |
29 | + | |
30 | +if ("@ARGV") { | |
31 | + foreach (@ARGV) { | |
9ca78239 | 32 | + if (! m=\.(so|gz|ph|pod)$=) { |
33 | + process_file($_); | |
34 | + } | |
281ecd9b | 35 | + } |
36 | +} else { | |
37 | + | |
38 | + # notice we are passed a list of filenames NOT as common in unix the | |
39 | + # contents of the file. | |
40 | + | |
41 | + foreach (<>) { | |
9ca78239 | 42 | + if (! m=\.(so|gz|ph|pod)$=) { |
281ecd9b | 43 | + process_file($_); |
9ca78239 | 44 | + } |
281ecd9b | 45 | + } |
46 | +} | |
47 | + | |
48 | + | |
49 | +foreach $module (sort keys %require) { | |
281ecd9b | 50 | + if (length($require{$module}) == 0) { |
12b32ad1 | 51 | + print "perl($module)\n"; |
281ecd9b | 52 | + } else { |
12b32ad1 | 53 | + print "perl($module) = $require{$module}\n"; |
281ecd9b | 54 | + |
55 | + # we need to print it without the version number until the | |
56 | + # requires syntax accepts version numbers correctly. | |
57 | + | |
58 | +# print "perl($module)\n"; | |
59 | + } | |
60 | +} | |
61 | + | |
62 | +exit 0; | |
63 | + | |
64 | + | |
65 | + | |
66 | +sub process_file { | |
67 | + | |
68 | + my ($file) = @_; | |
69 | + chomp $file; | |
70 | + | |
71 | + open(FILE, "<$file")|| | |
72 | + die("Could not open file: '$file' : $!\n"); | |
73 | + | |
74 | + my ($package, $version) = (); | |
75 | + | |
76 | + while (<FILE>) { | |
77 | + | |
78 | + # skip the documentation | |
79 | + if ( (m/^=(head1|head2|pod)/) .. (m/^=(cut)/) ) { | |
80 | + next; | |
81 | + } | |
82 | + | |
83 | + # skip the data section | |
84 | + if (m/^__(DATA|END)__$/) { | |
85 | + last; | |
86 | + } | |
87 | + | |
88 | + # not everyone puts the package name of the file as the first | |
89 | + # package name so we report all namespaces as if they were | |
90 | + # provided packages (really ugly). | |
91 | + | |
92 | + if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/) { | |
93 | + $package=$1; | |
94 | + undef $version; | |
95 | + $require{$package}=undef; | |
96 | + } | |
97 | + | |
98 | + # after we found the package name take the first assignment to | |
99 | + # $VERSION as the version number. Exporter requires that the | |
100 | + # variable be called VERSION so we are safe. | |
101 | + | |
102 | + # here are examples of VERSION lines from the perl distribution | |
103 | + | |
104 | + #FindBin.pm:$VERSION = $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); | |
105 | + #ExtUtils/Install.pm:$VERSION = substr q$Revision$, 10; | |
106 | + #CGI/Apache.pm:$VERSION = (qw$Revision$)[1]; | |
107 | + #DynaLoader.pm:$VERSION = $VERSION = "1.03"; # avoid typo warning | |
108 | + | |
109 | + if ( | |
110 | + ($package) && | |
111 | + (m/^\s*\$VERSION\s+=\s+/) | |
112 | + ) { | |
113 | + | |
114 | + # first see if the version string contains the string | |
115 | + # '$Revision' this often causes bizzare strings and is the most | |
116 | + # common method of non static numbering. | |
117 | + | |
118 | + if (m/(\$Revision: (\d+[.0-9]+))/) { | |
119 | + $version= $2; | |
120 | + } elsif (m/[\'\"]?(\d+[.0-9]+)[\'\"]?/) { | |
121 | + | |
122 | + # look for a static number hard coded in the script | |
123 | + | |
124 | + $version= $1; | |
125 | + } | |
126 | + $require{$package}=$version; | |
127 | + } | |
128 | + | |
129 | + } | |
130 | + | |
131 | + return ; | |
132 | +} |