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