]>
Commit | Line | Data |
---|---|---|
49deaedf AM |
1 | diff -urN rpm-4.3.org/configure.ac rpm-4.3/configure.ac |
2 | --- rpm-4.3.org/configure.ac 2004-01-07 01:51:35.251160244 +0100 | |
3 | +++ rpm-4.3/configure.ac 2004-01-07 01:55:53.198560246 +0100 | |
4 | @@ -1196,6 +1196,7 @@ | |
5 | AC_CONFIG_SUBDIRS(popt beecrypt zlib elfutils file db3) | |
6 | ||
7 | AC_CONFIG_FILES([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec | |
8 | + scripts/perl.req scripts/perl.prov | |
9 | rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile | |
10 | scripts/Makefile scripts/brp-redhat | |
11 | scripts/macros.perl scripts/macros.php scripts/macros.python | |
12 | diff -urN rpm-4.3.org/scripts/perl.req rpm-4.3/scripts/perl.req | |
13 | --- rpm-4.3.org/scripts/perl.req 2004-01-07 01:51:04.911464416 +0100 | |
14 | +++ rpm-4.3/scripts/perl.req 2004-01-07 01:55:17.030076058 +0100 | |
2fa5aec3 AF |
15 | @@ -1,4 +1,4 @@ |
16 | -#!/usr/bin/perl | |
5b0f0ac9 | 17 | +#!@__PERL@ |
4703c2f4 AF |
18 | |
19 | # RPM (and it's source code) is covered under two separate licenses. | |
20 | ||
21 | @@ -41,7 +41,11 @@ | |
2fa5aec3 AF |
22 | |
23 | if ("@ARGV") { | |
24 | foreach (@ARGV) { | |
25 | - process_file($_); | |
20a6d548 | 26 | + if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) { |
2eb651d8 | 27 | + if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) { |
2fa5aec3 AF |
28 | + process_file($_); |
29 | + } | |
30 | + } | |
31 | } | |
32 | } else { | |
33 | ||
4703c2f4 | 34 | @@ -49,14 +53,22 @@ |
2fa5aec3 AF |
35 | # contents of the file. |
36 | ||
37 | foreach (<>) { | |
38 | - process_file($_); | |
4703c2f4 AF |
39 | + if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) { |
40 | + if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) { | |
41 | + process_file($_); | |
42 | + } | |
43 | + } | |
2fa5aec3 AF |
44 | } |
45 | } | |
edf87823 | 46 | |
47 | ||
48 | foreach $module (sort keys %require) { | |
edf87823 | 49 | if (length($require{$module}) == 0) { |
50 | - print "perl($module)\n"; | |
4703c2f4 AF |
51 | + if ($module =~ /^[0-9._]+$/) { |
52 | + print "perl >= $module\n"; | |
53 | + } else { | |
54 | + print "perl($module)\n"; | |
55 | + } | |
edf87823 | 56 | } else { |
2fa5aec3 | 57 | |
4703c2f4 | 58 | # I am not using rpm3.0 so I do not want spaces arround my |
49deaedf | 59 | @@ -219,7 +231,31 @@ |
3ce8984f | 60 | # will be included with the name sys/systeminfo.ph so only use the |
61 | # basename of *.ph files | |
62 | ||
5b0f0ac9 | 63 | - ($module =~ m/\.ph$/) && next; |
3ce8984f | 64 | + # ($module =~ m/\.ph$/) && ($module =~ s!.*/!!g ); |
5b0f0ac9 | 65 | + |
852c3a98 | 66 | + # there is no need to generate dependencies for ph, pl or test files |
4a19987c | 67 | + # so let's just skip them. |
4703c2f4 | 68 | + |
852c3a98 | 69 | + ($module =~ m/\.(ph|pl|t)$/) && next; |
cfd811fa | 70 | + |
4a19987c | 71 | + # skip all modules for platforms other than linux. |
92b19143 | 72 | + |
73 | + ($module =~ m/Mac|OS2|MSDOS|Win32|VMS|vmsish/) && next; | |
74 | + | |
4a19987c | 75 | + # if the module name starts in a dot it is not a module name. |
4d8fb4e3 | 76 | + |
77 | + ($module =~ m/^\./) && next; | |
78 | + | |
4a19987c | 79 | + # if the module ends with .pm strip it to leave only basename. |
5e855029 | 80 | + |
4a19987c | 81 | + $module =~ s/\.pm$//; |
5e855029 | 82 | + |
cb87a980 | 83 | + $module =~ s/\//::/; |
84 | + | |
4a19987c | 85 | + # trim off trailing parenthesis if any. Sometimes people pass |
86 | + # the module an empty list. | |
87 | + | |
88 | + $module =~ s/\(\s*\)$//; | |
cfd811fa | 89 | |
3ce8984f | 90 | $require{$module}=$version; |
5b0f0ac9 | 91 | $line{$module}=$_; |
49deaedf AM |
92 | diff -urN rpm-4.3.org/scripts/perl.req.orig rpm-4.3/scripts/perl.req.orig |
93 | --- rpm-4.3.org/scripts/perl.req.orig 1970-01-01 01:00:00.000000000 +0100 | |
94 | +++ rpm-4.3/scripts/perl.req.orig 2004-01-04 03:13:09.000000000 +0100 | |
95 | @@ -0,0 +1,234 @@ | |
96 | +#!/usr/bin/perl | |
97 | + | |
98 | +# RPM (and it's source code) is covered under two separate licenses. | |
99 | + | |
100 | +# The entire code base may be distributed under the terms of the GNU | |
101 | +# General Public License (GPL), which appears immediately below. | |
102 | +# Alternatively, all of the source code in the lib subdirectory of the | |
103 | +# RPM source code distribution as well as any code derived from that | |
104 | +# code may instead be distributed under the GNU Library General Public | |
105 | +# License (LGPL), at the choice of the distributor. The complete text | |
106 | +# of the LGPL appears at the bottom of this file. | |
107 | + | |
108 | +# This alternatively is allowed to enable applications to be linked | |
109 | +# against the RPM library (commonly called librpm) without forcing | |
110 | +# such applications to be distributed under the GPL. | |
111 | + | |
112 | +# Any questions regarding the licensing of RPM should be addressed to | |
113 | +# Erik Troan <ewt@redhat.com>. | |
114 | + | |
115 | +# a simple makedepends like script for perl. | |
116 | + | |
117 | +# To save development time I do not parse the perl grammmar but | |
118 | +# instead just lex it looking for what I want. I take special care to | |
119 | +# ignore comments and pod's. | |
120 | + | |
121 | +# It would be much better if perl could tell us the dependencies of a | |
122 | +# given script. | |
123 | + | |
124 | +# The filenames to scan are either passed on the command line or if | |
125 | +# that is empty they are passed via stdin. | |
126 | + | |
127 | +# If there are strings in the file which match the pattern | |
128 | +# m/^\s*\$RPM_Requires\s*=\s*["'](.*)['"]/i | |
129 | +# then these are treated as additional names which are required by the | |
130 | +# file and are printed as well. | |
131 | + | |
132 | +# I plan to rewrite this in C so that perl is not required by RPM at | |
133 | +# build time. | |
134 | + | |
135 | +# by Ken Estes Mail.com kestes@staff.mail.com | |
136 | + | |
137 | +if ("@ARGV") { | |
138 | + foreach (@ARGV) { | |
139 | + process_file($_); | |
140 | + } | |
141 | +} else { | |
142 | + | |
143 | + # notice we are passed a list of filenames NOT as common in unix the | |
144 | + # contents of the file. | |
145 | + | |
146 | + foreach (<>) { | |
147 | + process_file($_); | |
148 | + } | |
149 | +} | |
150 | + | |
151 | + | |
152 | +foreach $module (sort keys %require) { | |
153 | + if (length($require{$module}) == 0) { | |
154 | + print "perl($module)\n"; | |
155 | + } else { | |
156 | + | |
157 | + # I am not using rpm3.0 so I do not want spaces arround my | |
158 | + # operators. Also I will need to change the processing of the | |
159 | + # $RPM_* vairable when I upgrage. | |
160 | + | |
161 | + print "perl($module) >= $require{$module}\n"; | |
162 | + } | |
163 | +} | |
164 | + | |
165 | +exit 0; | |
166 | + | |
167 | + | |
168 | + | |
169 | +sub process_file { | |
170 | + | |
171 | + my ($file) = @_; | |
172 | + chomp $file; | |
173 | + | |
174 | + open(FILE, "<$file") || return; | |
175 | + | |
176 | + while (<FILE>) { | |
177 | + | |
178 | + # skip the "= <<" block | |
179 | + | |
180 | + if ( ( m/^\s*\$(.*)\s*=\s*<<\s*["'](.*)['"]/i) || | |
181 | + ( m/^\s*\$(.*)\s*=\s*<<\s*(.*);/i) ) { | |
182 | + $tag = $2; | |
183 | + while (<FILE>) { | |
184 | + ( $_ =~ /^$tag/) && last; | |
185 | + } | |
186 | + } | |
187 | + | |
188 | + # skip the documentation | |
189 | + | |
190 | + # we should not need to have item in this if statement (it | |
191 | + # properly belongs in the over/back section) but people do not | |
192 | + # read the perldoc. | |
193 | + | |
194 | + if ( (m/^=(head1|head2|pod|item)/) .. (m/^=(cut)/) ) { | |
195 | + next; | |
196 | + } | |
197 | + | |
198 | + if ( (m/^=(over)/) .. (m/^=(back)/) ) { | |
199 | + next; | |
200 | + } | |
201 | + | |
202 | + # skip the data section | |
203 | + if (m/^__(DATA|END)__$/) { | |
204 | + last; | |
205 | + } | |
206 | + | |
207 | + # Each keyword can appear multiple times. Don't | |
208 | + # bother with datastructures to store these strings, | |
209 | + # if we need to print it print it now. | |
210 | + | |
211 | + if ( m/^\s*\$RPM_Requires\s*=\s*["'](.*)['"]/i) { | |
212 | + foreach $_ (split(/\s+/, $1)) { | |
213 | + print "$_\n"; | |
214 | + } | |
215 | + } | |
216 | + | |
217 | + if ( | |
218 | + | |
219 | +# ouch could be in a eval, perhaps we do not want these since we catch | |
220 | +# an exception they must not be required | |
221 | + | |
222 | +# eval { require Term::ReadLine } or die $@; | |
223 | +# eval "require Term::Rendezvous;" or die $@; | |
224 | +# eval { require Carp } if defined $^S; # If error/warning during compilation, | |
225 | + | |
226 | + | |
227 | + (m/^(\s*) # we hope the inclusion starts the line | |
228 | + (require|use)\s+(?!\{) # do not want 'do {' loops | |
229 | + # quotes around name are always legal | |
230 | + [\'\"]?([^\;\ \'\"\t]*)[\'\"]?[\t\;\ ] | |
231 | + # the syntax for 'use' allows version requirements | |
232 | + \s*([.0-9]*) | |
233 | + /x) | |
234 | + ) { | |
235 | + my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4); | |
236 | + | |
237 | + # we only consider require statements that are flush against | |
238 | + # the left edge. any other require statements give too many | |
239 | + # false positives, as they are usually inside of an if statement | |
240 | + # as a fallback module or a rarely used option | |
241 | + | |
242 | + ($whitespace ne "" && $statement eq "require") && next; | |
243 | + | |
244 | + # if there is some interpolation of variables just skip this | |
245 | + # dependency, we do not want | |
246 | + # do "$ENV{LOGDIR}/$rcfile"; | |
247 | + | |
248 | + ($module =~ m/\$/) && next; | |
249 | + | |
250 | + # skip if the phrase was "use of" -- shows up in gimp-perl, et al | |
251 | + next if $module eq 'of'; | |
252 | + | |
253 | + # if the module ends in a comma we probaly caught some | |
254 | + # documentation of the form 'check stuff,\n do stuff, clean | |
255 | + # stuff.' there are several of these in the perl distribution | |
256 | + | |
257 | + ($module =~ m/[,>]$/) && next; | |
258 | + | |
259 | + # if the module name starts in a dot it is not a module name. | |
260 | + # Is this necessary? Please give me an example if you turn this | |
261 | + # back on. | |
262 | + | |
263 | + # ($module =~ m/^\./) && next; | |
264 | + | |
265 | + # if the module ends with .pm strip it to leave only basename. | |
266 | + # starts with /, which means its an absolute path to a file | |
267 | + if ($module =~ m(^/)) { | |
268 | + print "$module\n"; | |
269 | + next; | |
270 | + } | |
271 | + | |
272 | + # sometimes people do use POSIX qw(foo), or use POSIX(qw(foo)) etc | |
273 | + # we can strip qw.*$, as well as (.*$: | |
274 | + $module =~ s/qw.*$//; | |
275 | + $module =~ s/\(.*$//; | |
276 | + | |
277 | + $module =~ s/\.pm$//; | |
278 | + | |
279 | + # some perl programmers write 'require URI/URL;' when | |
280 | + # they mean 'require URI::URL;' | |
281 | + | |
282 | + $module =~ s/\//::/; | |
283 | + | |
284 | + # trim off trailing parenthesis if any. Sometimes people pass | |
285 | + # the module an empty list. | |
286 | + | |
287 | + $module =~ s/\(\s*\)$//; | |
288 | + | |
289 | + if ( $module =~ m/^[0-9._]+$/ ) { | |
290 | + # if module is a number then both require and use interpret that | |
291 | + # to mean that a particular version of perl is specified | |
292 | + | |
293 | + if ($module =~ /5.00/) { | |
294 | + print "perl >= 0:$module\n"; | |
295 | + next; | |
296 | + } | |
297 | + else { | |
298 | + print "perl >= 1:$module\n"; | |
299 | + next; | |
300 | + } | |
301 | + | |
302 | + }; | |
303 | + | |
304 | + # ph files do not use the package name inside the file. | |
305 | + # perlmodlib documentation says: | |
306 | + | |
307 | + # the .ph files made by h2ph will probably end up as | |
308 | + # extension modules made by h2xs. | |
309 | + | |
310 | + # so do not expend much effort on these. | |
311 | + | |
312 | + | |
313 | + # there is no easy way to find out if a file named systeminfo.ph | |
314 | + # will be included with the name sys/systeminfo.ph so only use the | |
315 | + # basename of *.ph files | |
316 | + | |
317 | + ($module =~ m/\.ph$/) && next; | |
318 | + | |
319 | + $require{$module}=$version; | |
320 | + $line{$module}=$_; | |
321 | + } | |
322 | + | |
323 | + } | |
324 | + | |
325 | + close(FILE) || | |
326 | + die("$0: Could not close file: '$file' : $!\n"); | |
327 | + | |
328 | + return ; | |
329 | +} |