line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::Admin::ScanDeps; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1680
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
12
|
use Module::Install::Base (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw{$VERSION @ISA}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
BEGIN { |
7
|
1
|
|
|
1
|
|
4
|
$VERSION = '1.21'; |
8
|
1
|
|
|
|
|
688
|
@ISA = qw(Module::Install::Base); |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub scan_dependencies { |
12
|
0
|
|
|
0
|
0
|
|
my ($self, $pkg, $perl_version, $pkg_version) = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
return if $pkg eq 'perl'; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
0
|
|
|
|
$perl_version ||= $self->perl_version or die <<'END_MESSAGE'; |
17
|
|
|
|
|
|
|
Please first specify a required perl version, like this: |
18
|
|
|
|
|
|
|
perl_version('5.005'); |
19
|
|
|
|
|
|
|
END_MESSAGE |
20
|
0
|
|
|
|
|
|
$perl_version =~ s{^(\d+)\.(\d+)\.(\d+)}{$1 + $2/1_000 + $3/1_000_000}e; |
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
require Module::ScanDeps; |
23
|
0
|
|
|
|
|
|
require Module::CoreList; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
die "Module::CoreList has no information on perl $perl_version" |
26
|
0
|
0
|
|
|
|
|
unless exists $Module::CoreList::version{$perl_version}; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if (my $min_version = Module::CoreList->first_release($pkg, $pkg_version)) { |
29
|
0
|
0
|
|
|
|
|
return if $min_version <= $perl_version; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# We only need the first one in the @INC here |
33
|
0
|
0
|
|
|
|
|
my $file = $self->admin->find_in_inc($pkg) |
34
|
|
|
|
|
|
|
or die "Cannot find $pkg in \@INC"; |
35
|
0
|
|
|
|
|
|
my %result = ($pkg => $file); |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my @files = ($file); |
38
|
0
|
|
|
|
|
|
while (@files) { |
39
|
0
|
|
|
|
|
|
my $deps = Module::ScanDeps::scan_deps( |
40
|
|
|
|
|
|
|
files => \@files, |
41
|
|
|
|
|
|
|
recurse => 0, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
@files = (); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
foreach my $key (keys %$deps) { |
47
|
0
|
0
|
|
|
|
|
if ($deps->{$key}{type} eq 'shared') { |
48
|
0
|
|
|
|
|
|
foreach my $used_by (@{$deps->{$key}{used_by}}) { |
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$used_by =~ s!/!::!g; |
50
|
0
|
0
|
|
|
|
|
$used_by =~ s!\.pm\Z!!i or next; |
51
|
0
|
0
|
|
|
|
|
next if exists $result{$used_by}; |
52
|
0
|
|
|
|
|
|
$result{$used_by} = undef; |
53
|
0
|
|
|
|
|
|
my $min_version = Module::CoreList->first_release($used_by); |
54
|
0
|
0
|
0
|
|
|
|
print "skipped $used_by (needs shared library)\n" |
55
|
|
|
|
|
|
|
unless !$min_version || $min_version <= $perl_version; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
foreach my $key (keys %$deps) { |
61
|
0
|
|
|
|
|
|
my $dep_pkg = $key; |
62
|
0
|
|
|
|
|
|
$dep_pkg =~ s!/!::!g; |
63
|
0
|
0
|
|
|
|
|
$dep_pkg =~ s!\.pm\Z!!i or next; |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
if (my $min_version = Module::CoreList->first_release($dep_pkg)) { |
66
|
0
|
0
|
|
|
|
|
next if $min_version <= $perl_version; |
67
|
|
|
|
|
|
|
} |
68
|
0
|
0
|
|
|
|
|
next if $dep_pkg =~ /^(?:DB|(?:Auto|Dyna|XS)Loader|threads|warnings)\b/i; |
69
|
0
|
0
|
|
|
|
|
next if exists $result{$dep_pkg}; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$result{$dep_pkg} = $deps->{$key}{file}; |
72
|
0
|
|
|
|
|
|
push @files, $deps->{$key}{file}; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
while (my($k,$v) = each %result) { |
77
|
0
|
0
|
|
|
|
|
delete $result{$k} unless defined $v; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
return \%result; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |