]> git.pld-linux.org Git - packages/perl.git/blame - perl-find-provides.patch
- use existing Group for -base
[packages/perl.git] / perl-find-provides.patch
CommitLineData
501bff1f 1diff -urN perl-5.6.1/find-perl-provides perl-5.6.1-grabba/find-perl-provides
2--- perl-5.6.1/find-perl-provides Thu Jan 1 00:00:00 1970
3+++ perl-5.6.1-grabba/find-perl-provides Sun Mar 3 14:41:39 2002
4@@ -0,0 +1,23 @@
281ecd9b 5+#!/bin/sh
6+ulimit -c 0
7+
8+export LD_LIBRARY_PATH="FPPATH"
9+
501bff1f 10+filelist=`sed "s/['\"]/\\\&/g"`
11+if [ -f __rpm_noautoprovfiles ] ; then
12+ for i in `cat __rpm_noautoprovfiles`; do
13+ filelist=`echo $filelist | sed "s![[:space:]]*$i[[:space:]]*!!g"`
14+ done
15+fi
16+
281ecd9b 17+
18+echo $filelist|/usr/lib/rpm/find-provides
a7b098ef 19+provides_perl=`FPPATH/find-perl.prov $filelist`
501bff1f 20+if [ -f __rpm_noautoprov ] ; then
21+ for i in `cat __rpm_noautoprov`; do
22+ provides_perl=`echo $provides_perl | sed "s!\<$i[[:space:]]*!!g"`
23+ done
24+fi
25+
a7b098ef 26+echo "$provides_perl" | grep -v '^perl(DynaLoader)$'
501bff1f 27+
28diff -urN perl-5.6.1/find-perl.prov perl-5.6.1-grabba/find-perl.prov
29--- perl-5.6.1/find-perl.prov Thu Jan 1 00:00:00 1970
30+++ perl-5.6.1-grabba/find-perl.prov Sun Mar 3 14:37:16 2002
31@@ -0,0 +1,177 @@
281ecd9b 32+#!FPPATH/perl
33+
501bff1f 34+# RPM (and it's source code) is covered under two separate licenses.
281ecd9b 35+
501bff1f 36+# The entire code base may be distributed under the terms of the GNU
37+# General Public License (GPL), which appears immediately below.
38+# Alternatively, all of the source code in the lib subdirectory of the
39+# RPM source code distribution as well as any code derived from that
40+# code may instead be distributed under the GNU Library General Public
41+# License (LGPL), at the choice of the distributor. The complete text
42+# of the LGPL appears at the bottom of this file.
281ecd9b 43+
501bff1f 44+# This alternative is allowed to enable applications to be linked
45+# against the RPM library (commonly called librpm) without forcing
46+# such applications to be distributed under the GPL.
47+
48+# Any questions regarding the licensing of RPM should be addressed to
49+# Erik Troan <ewt@redhat.com>.
50+
51+# a simple script to print the proper name for perl libraries.
52+
53+# To save development time I do not parse the perl grammmar but
54+# instead just lex it looking for what I want. I take special care to
55+# ignore comments and pod's.
281ecd9b 56+
57+# it would be much better if perl could tell us the proper name of a
58+# given script.
59+
501bff1f 60+# The filenames to scan are either passed on the command line or if
61+# that is empty they are passed via stdin.
62+
63+# If there are lines in the file which match the pattern
64+# (m/^\s*\$VERSION\s*=\s+/)
65+# then these are taken to be the version numbers of the modules.
66+# Special care is taken with a few known idioms for specifying version
67+# numbers of files under rcs/cvs control.
68+
69+# If there are strings in the file which match the pattern
70+# m/^\s*\$RPM_Provides\s*=\s*["'](.*)['"]/i
71+# then these are treated as additional names which are provided by the
72+# file and are printed as well.
73+
74+# I plan to rewrite this in C so that perl is not required by RPM at
75+# build time.
76+
77+# by Ken Estes Mail.com kestes@staff.mail.com
281ecd9b 78+
79+if ("@ARGV") {
80+ foreach (@ARGV) {
501bff1f 81+ if (! m=(/(doc|usr/src)/|\.(so|gz|ph|pod|h|html|al|ix)$)=) {
82+ process_file($_) if -f "$_";
9ca78239 83+ }
281ecd9b 84+ }
85+} else {
86+
87+ # notice we are passed a list of filenames NOT as common in unix the
88+ # contents of the file.
89+
90+ foreach (<>) {
501bff1f 91+ if (! m=(/(doc|usr/src)/|\.(so|gz|ph|pod|h|html|al|ix)$)=) {
92+ process_file($_) if -f "$_";
9ca78239 93+ }
281ecd9b 94+ }
95+}
96+
97+
98+foreach $module (sort keys %require) {
281ecd9b 99+ if (length($require{$module}) == 0) {
12b32ad1 100+ print "perl($module)\n";
281ecd9b 101+ } else {
281ecd9b 102+
501bff1f 103+ # I am not using rpm3.0 so I do not want spaces arround my
104+ # operators. Also I will need to change the processing of the
105+ # $RPM_* vairable when I upgrade.
281ecd9b 106+
501bff1f 107+ print "perl($module) = $require{$module}\n";
281ecd9b 108+ }
109+}
110+
111+exit 0;
112+
113+
114+
115+sub process_file {
116+
117+ my ($file) = @_;
118+ chomp $file;
119+
120+ open(FILE, "<$file")||
501bff1f 121+ die("$0: Could not open file: '$file' : $!\n");
281ecd9b 122+
123+ my ($package, $version) = ();
124+
125+ while (<FILE>) {
126+
127+ # skip the documentation
501bff1f 128+
129+ # we should not need to have item in this if statement (it
130+ # properly belongs in the over/back section) but people do not
131+ # read the perldoc.
132+
133+ if ( (m/^=(head1|head2|pod|item)/) .. (m/^=(cut)/ || eof) ) {
134+ next;
135+ }
136+
137+ if ( (m/^=(over)/) .. (m/^=(back)/ || eof) ) {
281ecd9b 138+ next;
139+ }
140+
141+ # skip the data section
142+ if (m/^__(DATA|END)__$/) {
143+ last;
144+ }
145+
146+ # not everyone puts the package name of the file as the first
147+ # package name so we report all namespaces as if they were
148+ # provided packages (really ugly).
149+
501bff1f 150+ if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/ && !$require{$1}) {
281ecd9b 151+ $package=$1;
152+ undef $version;
153+ $require{$package}=undef;
154+ }
155+
156+ # after we found the package name take the first assignment to
157+ # $VERSION as the version number. Exporter requires that the
158+ # variable be called VERSION so we are safe.
159+
160+ # here are examples of VERSION lines from the perl distribution
161+
162+ #FindBin.pm:$VERSION = $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
163+ #ExtUtils/Install.pm:$VERSION = substr q$Revision$, 10;
164+ #CGI/Apache.pm:$VERSION = (qw$Revision$)[1];
165+ #DynaLoader.pm:$VERSION = $VERSION = "1.03"; # avoid typo warning
501bff1f 166+ #Cwd.pm:our $VERSION = '2.04';
167+
168+ # here is example of VERSION line from RPC::PlClient module
169+
170+ # RPC/PlClient.pm:$RPC::PlClient::VERSION = '0.2016';
281ecd9b 171+
172+ if (
173+ ($package) &&
501bff1f 174+ (m/^\s*(our)?\s*\$(${package}::)?VERSION\s*=/)
281ecd9b 175+ ) {
176+
177+ # first see if the version string contains the string
178+ # '$Revision' this often causes bizzare strings and is the most
179+ # common method of non static numbering.
180+
181+ if (m/(\$Revision: (\d+[.0-9]+))/) {
182+ $version= $2;
183+ } elsif (m/[\'\"]?(\d+[.0-9]+)[\'\"]?/) {
184+
185+ # look for a static number hard coded in the script
186+
187+ $version= $1;
188+ }
189+ $require{$package}=$version;
190+ }
191+
501bff1f 192+ # Each keyword can appear multiple times. Don't
193+ # bother with datastructures to store these strings,
194+ # if we need to print it print it now.
195+
196+ if ( m/^\s*\$RPM_Provides\s*=\s*["'](.*)['"]/i) {
197+ foreach $_ (spit(/\s+/, $1)) {
198+ print "$_\n";
199+ }
200+ }
201+
281ecd9b 202+ }
203+
501bff1f 204+ close(FILE)||
205+ die("$0: Could not close file: '$file' : $!\n");
206+
281ecd9b 207+ return ;
208+}
This page took 0.41937 seconds and 4 git commands to generate.