]>
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 | + | |
9 | +filelist=`sed "s/['\"]/\\\&/g"` | |
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 | |
16 | @@ -0,0 +1,113 @@ | |
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) { | |
32 | + process_file($_); | |
33 | + } | |
34 | +} else { | |
35 | + | |
36 | + # notice we are passed a list of filenames NOT as common in unix the | |
37 | + # contents of the file. | |
38 | + | |
39 | + foreach (<>) { | |
40 | + process_file($_); | |
41 | + } | |
42 | +} | |
43 | + | |
44 | + | |
45 | +foreach $module (sort keys %require) { | |
46 | + ($mod = $module) =~ s/::/-/g; | |
47 | + if (length($require{$module}) == 0) { | |
48 | + print "perl($mod)\n"; | |
49 | + } else { | |
50 | + print "perl($mod) = $require{$module}\n"; | |
51 | + | |
52 | + # we need to print it without the version number until the | |
53 | + # requires syntax accepts version numbers correctly. | |
54 | + | |
55 | +# print "perl($module)\n"; | |
56 | + } | |
57 | +} | |
58 | + | |
59 | +exit 0; | |
60 | + | |
61 | + | |
62 | + | |
63 | +sub process_file { | |
64 | + | |
65 | + my ($file) = @_; | |
66 | + chomp $file; | |
67 | + | |
68 | + open(FILE, "<$file")|| | |
69 | + die("Could not open file: '$file' : $!\n"); | |
70 | + | |
71 | + my ($package, $version) = (); | |
72 | + | |
73 | + while (<FILE>) { | |
74 | + | |
75 | + # skip the documentation | |
76 | + if ( (m/^=(head1|head2|pod)/) .. (m/^=(cut)/) ) { | |
77 | + next; | |
78 | + } | |
79 | + | |
80 | + # skip the data section | |
81 | + if (m/^__(DATA|END)__$/) { | |
82 | + last; | |
83 | + } | |
84 | + | |
85 | + # not everyone puts the package name of the file as the first | |
86 | + # package name so we report all namespaces as if they were | |
87 | + # provided packages (really ugly). | |
88 | + | |
89 | + if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/) { | |
90 | + $package=$1; | |
91 | + undef $version; | |
92 | + $require{$package}=undef; | |
93 | + } | |
94 | + | |
95 | + # after we found the package name take the first assignment to | |
96 | + # $VERSION as the version number. Exporter requires that the | |
97 | + # variable be called VERSION so we are safe. | |
98 | + | |
99 | + # here are examples of VERSION lines from the perl distribution | |
100 | + | |
101 | + #FindBin.pm:$VERSION = $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); | |
102 | + #ExtUtils/Install.pm:$VERSION = substr q$Revision$, 10; | |
103 | + #CGI/Apache.pm:$VERSION = (qw$Revision$)[1]; | |
104 | + #DynaLoader.pm:$VERSION = $VERSION = "1.03"; # avoid typo warning | |
105 | + | |
106 | + if ( | |
107 | + ($package) && | |
108 | + (m/^\s*\$VERSION\s+=\s+/) | |
109 | + ) { | |
110 | + | |
111 | + # first see if the version string contains the string | |
112 | + # '$Revision' this often causes bizzare strings and is the most | |
113 | + # common method of non static numbering. | |
114 | + | |
115 | + if (m/(\$Revision: (\d+[.0-9]+))/) { | |
116 | + $version= $2; | |
117 | + } elsif (m/[\'\"]?(\d+[.0-9]+)[\'\"]?/) { | |
118 | + | |
119 | + # look for a static number hard coded in the script | |
120 | + | |
121 | + $version= $1; | |
122 | + } | |
123 | + $require{$package}=$version; | |
124 | + } | |
125 | + | |
126 | + } | |
127 | + | |
128 | + return ; | |
129 | +} |