line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package Perl::Installed; |
3
|
|
|
|
|
|
|
########################################### |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
24276
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
7
|
|
|
|
|
|
|
#use Log::Log4perl qw(:easy); |
8
|
1
|
|
|
1
|
|
6
|
use File::Spec; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
664
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
########################################### |
13
|
|
|
|
|
|
|
sub new { |
14
|
|
|
|
|
|
|
########################################### |
15
|
2
|
|
|
2
|
1
|
1377
|
my($class, %options) = @_; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
8
|
my $self = { |
18
|
|
|
|
|
|
|
%options, |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
2
|
100
|
|
|
|
9
|
if(! exists $self->{prefix}) { |
22
|
1
|
|
|
|
|
11
|
die "Mandatory parameter 'prefix' missing"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
|
|
|
30
|
if(! -d $self->{prefix}) { |
26
|
0
|
|
|
|
|
0
|
die "Mandatory parameter 'prefix' not a directory"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
37
|
$self->{bindir} = File::Spec->catfile($self->{prefix}, "bin"); |
30
|
1
|
|
|
|
|
14
|
$self->{perldoc} = File::Spec->catfile($self->{bindir}, "perldoc"); |
31
|
1
|
|
|
|
|
11
|
$self->{perl} = File::Spec->catfile($self->{bindir}, "perl"); |
32
|
|
|
|
|
|
|
|
33
|
1
|
50
|
|
|
|
26
|
if(! -f $self->{perl}) { |
34
|
0
|
|
|
|
|
0
|
die "perl not found under prefix $self->{prefix}/bin"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
3
|
bless $self, $class; |
38
|
1
|
|
|
|
|
5
|
$self->_config_init(); |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
24
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
########################################### |
44
|
|
|
|
|
|
|
sub _config_init { |
45
|
|
|
|
|
|
|
########################################### |
46
|
1
|
|
|
1
|
|
3
|
my($self) = @_; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
9
|
my $cmd = |
49
|
|
|
|
|
|
|
qq#$self->{perl} -MConfig -l0e'print "\$_\\0\$Config{\$_}" # . |
50
|
|
|
|
|
|
|
qq#for keys %Config'#; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
85569
|
my $data = `$cmd`; |
53
|
1
|
|
|
|
|
4299
|
my %config = split /\0/, $data; |
54
|
1
|
|
|
|
|
145
|
$self->{config} = \%config; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
29
|
$self->{packlistfile} = File::Spec->catfile($self->{config}->{archlib}, |
57
|
|
|
|
|
|
|
".packlist"); |
58
|
|
|
|
|
|
|
|
59
|
1
|
50
|
|
|
|
31
|
if($self->{config}->{version} !~ /\d/) { |
60
|
0
|
|
|
|
|
0
|
die "Loading config failed"; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
########################################### |
65
|
|
|
|
|
|
|
sub config { |
66
|
|
|
|
|
|
|
########################################### |
67
|
1
|
|
|
1
|
1
|
11
|
my($self) = @_; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
11
|
return $self->{config}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
########################################### |
73
|
|
|
|
|
|
|
sub files { |
74
|
|
|
|
|
|
|
########################################### |
75
|
1
|
|
|
1
|
1
|
1413
|
my($self) = @_; |
76
|
|
|
|
|
|
|
|
77
|
1
|
50
|
|
|
|
63
|
if(! -f $self->{packlistfile}) { |
78
|
|
|
|
|
|
|
#ERROR "Package file $packfile doesn't exist"; |
79
|
1
|
|
|
|
|
3
|
return undef; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my @packlist; |
83
|
|
|
|
|
|
|
# Read a .packlist file of an installed perl distribution |
84
|
|
|
|
|
|
|
# and generate the necessary yicf file/symlink lines from |
85
|
|
|
|
|
|
|
# it. |
86
|
|
|
|
|
|
|
# |
87
|
|
|
|
|
|
|
# A perl packlist looks like this: |
88
|
|
|
|
|
|
|
# /home/y/bin/libnetcfg type=file |
89
|
|
|
|
|
|
|
# /home/y/bin/perl from=/home/y/bin/perl5.10.1 type=link |
90
|
0
|
0
|
|
|
|
|
open FILE, "<$self->{packlistfile}" or |
91
|
|
|
|
|
|
|
die "Cannot open $self->{packlistfile} ($!)"; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
while() { |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my %opts; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my($file, @options) = split ' ', $_; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
for my $opt (@options) { |
100
|
0
|
|
|
|
|
|
my($key, $value) = split /=/, $opt; |
101
|
0
|
|
|
|
|
|
$opts{$key} = $value; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
push @packlist, {path => $file, %opts}; |
105
|
|
|
|
|
|
|
} |
106
|
0
|
|
|
|
|
|
close FILE; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return \@packlist; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
########################################### |
112
|
|
|
|
|
|
|
sub packlistfile { |
113
|
|
|
|
|
|
|
########################################### |
114
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
return $self->{packlistfile}; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
__END__ |