aboutsummaryrefslogtreecommitdiffstats
path: root/perl.req
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-10-17 10:25:17 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-10-17 10:25:17 +0000
commit39931bc4213bb8a6b4fd93a17399151cf1518d40 (patch)
treead0329e5c81bea3256962512fc381763decfe13a /perl.req
parent40ada8d8a1f095a374813de16aa6a0e983af9ee4 (diff)
downloadrpm-setup-39931bc4213bb8a6b4fd93a17399151cf1518d40.tar
rpm-setup-39931bc4213bb8a6b4fd93a17399151cf1518d40.tar.gz
rpm-setup-39931bc4213bb8a6b4fd93a17399151cf1518d40.tar.bz2
rpm-setup-39931bc4213bb8a6b4fd93a17399151cf1518d40.tar.xz
rpm-setup-39931bc4213bb8a6b4fd93a17399151cf1518d40.zip
Get correctly the Perl dependencies from "use base"
Diffstat (limited to 'perl.req')
-rwxr-xr-xperl.req71
1 files changed, 32 insertions, 39 deletions
diff --git a/perl.req b/perl.req
index 007b501..fd801f7 100755
--- a/perl.req
+++ b/perl.req
@@ -139,7 +139,7 @@ sub process_file {
) {
my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4);
my $usebase;
-
+
# we only consider require statements that are flush against
# the left edge. any other require statements give too many
# false positives, as they are usually inside of an if statement
@@ -150,7 +150,7 @@ sub process_file {
# if there is some interpolation of variables just skip this
# dependency, we do not want
# do "$ENV{LOGDIR}/$rcfile";
-
+
($module =~ m/\$/) && next;
# skip if the phrase was "use of" -- shows up in gimp-perl, et al
@@ -175,16 +175,16 @@ sub process_file {
next;
}
- # as seen in some perl script
+ # as seen in some perl scripts
# use base qw(App::CLI Class::Accessor::Chained::Fast App::CLI::Command);
if ($module eq 'base') {
- $require{$module}=$version;
- $line{$module}=$current_line;
-
- ($module = $_) =~ s/use\s*base\S*//;
- $module =~ s/qw\((.*)\);/$1/;
- $usebase = 1;
-
+ $require{$module} = $version;
+ $line{$module} = $current_line;
+ ($module = $_) =~ s/use\s*base\s*//;
+ $module =~ s/qw\((.*)\)\s*;/$1/;
+ $module =~ s/qw(.)(.*)\1\s*;/$2/;
+ $module =~ s/\s*;$//;
+ $usebase = 1;
}
# sometimes people do use POSIX qw(foo), or use POSIX(qw(foo)) etc
# we can strip qw.*$, as well as (.*$:
@@ -204,28 +204,24 @@ sub process_file {
$module =~ s/\(\s*\)$//;
if ( $module =~ m/^[0-9._]+$/ ) {
- # if module is a number then both require and use interpret that
- # to mean that a particular version of perl is specified
-
- if ($module =~ /5.00/) {
- print "perl >= 0:$module\n";
- next;
- }
- else {
- print "perl >= 1:$module\n";
- next;
- }
-
+ # if module is a number then both require and use interpret that
+ # to mean that a particular version of perl is specified
+
+ if ($module =~ /5.00/) {
+ print "perl >= 0:$module\n";
+ next;
+ }
+ else {
+ print "perl >= 1:$module\n";
+ next;
+ }
};
# ph files do not use the package name inside the file.
# perlmodlib documentation says:
-
# the .ph files made by h2ph will probably end up as
# extension modules made by h2xs.
-
- # so do not expend much effort on these.
-
+ # so do not spend much effort on these.
# there is no easy way to find out if a file named systeminfo.ph
# will be included with the name sys/systeminfo.ph so only use the
@@ -234,25 +230,22 @@ sub process_file {
($module =~ m/\.ph$/) && next;
# if the module was loaded trough base, we need to split the list
- if ($usebase)
- {
- my $current_line=$_;
- foreach(split(/\s+/,$module))
- {
+ if ($usebase) {
+ my $current_line = $_;
+ foreach (split(/\s+/, $module)) {
next unless $_;
- $require{$_}=$version;
- $line{$_}=$current_line;
- }
+ $require{$_} = $version;
+ $line{$_} = $current_line;
+ }
} else {
- $require{$module}=$version;
- $line{$module}=$current_line;
+ $require{$module}=$version;
+ $line{$module}=$current_line;
}
}
-
}
close(FILE) ||
die("$0: Could not close file: '$file' : $!\n");
-
- return ;
+
+ return ;
}