line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Packager::ConflictionChecker; |
2
|
3
|
|
|
3
|
|
13696
|
use Mouse; |
|
3
|
|
|
|
|
62151
|
|
|
3
|
|
|
|
|
1359
|
|
3
|
3
|
|
|
3
|
|
1177
|
use Config; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
118
|
|
4
|
3
|
|
|
3
|
|
4045
|
use Module::CoreList; |
|
3
|
|
|
|
|
67852
|
|
|
3
|
|
|
|
|
34
|
|
5
|
3
|
|
|
3
|
|
1939
|
use FileHandle; |
|
3
|
|
|
|
|
15425
|
|
|
3
|
|
|
|
|
25
|
|
6
|
3
|
|
|
3
|
|
2643
|
use Log::Log4perl qw(:easy); |
|
3
|
|
|
|
|
65882
|
|
|
3
|
|
|
|
|
30
|
|
7
|
3
|
|
|
3
|
|
2938
|
use CPAN::Packager::ListUtil qw(uniq any); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
208
|
|
8
|
3
|
|
|
3
|
|
1772
|
use CPAN::Packager::DualLivedList; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
135
|
|
9
|
3
|
|
|
3
|
|
21
|
use File::Spec; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
3044
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'checked_duallived_modules' => ( |
12
|
|
|
|
|
|
|
is => 'rw', |
13
|
|
|
|
|
|
|
default => sub { |
14
|
|
|
|
|
|
|
[]; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub check_conflict { |
19
|
0
|
|
|
0
|
0
|
|
my ( $self, $module_name ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
return unless scalar @{ $self->checked_duallived_modules }; |
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ( my $error_message = $self->check_install_settings_conflicted() ) { |
24
|
|
|
|
|
|
|
my @checked_duallived_modules |
25
|
0
|
|
|
|
|
|
= uniq @{ $self->checked_duallived_modules }; |
|
0
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my @module_may_conflicts = (); |
27
|
0
|
|
|
|
|
|
foreach my $duallived (@checked_duallived_modules) { |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# We emit warnings for only really installing the module modules |
30
|
|
|
|
|
|
|
# Those other modules were already installed via RPM in the past |
31
|
|
|
|
|
|
|
# must be ignored |
32
|
0
|
0
|
0
|
|
|
|
if ( $self->is_privlib_installed($duallived) |
33
|
|
|
|
|
|
|
&& !$self->is_vendor_installed($duallived) ) |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
|
|
|
push @module_may_conflicts, $duallived; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
|
my $module_names = join ",", @module_may_conflicts; |
39
|
0
|
|
|
|
|
|
return $self->emit_confliction_warnings( $module_names, |
40
|
|
|
|
|
|
|
$error_message ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub is_dual_lived_module { |
45
|
0
|
|
|
0
|
0
|
|
my ( $self, $module_name ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $dual_lived_list = CPAN::Packager::DualLivedList->new; |
48
|
0
|
0
|
|
|
|
|
if ( $dual_lived_list->is_duallived_module($module_name) ) { |
49
|
0
|
|
|
|
|
|
push @{ $self->checked_duallived_modules }, $module_name; |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return 1; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else { |
53
|
0
|
|
|
|
|
|
return 0; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# This checks modules which may conflict with the given dual-lived module |
58
|
|
|
|
|
|
|
sub is_privlib_installed { |
59
|
0
|
|
|
0
|
0
|
|
my ( $self, $module ) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $file = File::Spec->catfile( split /(?:\'|::)/, $module ) . '.pm'; |
62
|
0
|
|
|
|
|
|
my $is_privlib_installed; |
63
|
0
|
0
|
0
|
|
|
|
if ( -e File::Spec->catfile( $Config{installprivlib}, $file ) |
64
|
|
|
|
|
|
|
|| -e File::Spec->catfile( $Config{installarchlib}, $file ) ) |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
|
|
|
$is_privlib_installed = 1; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
else { |
69
|
0
|
|
|
|
|
|
$is_privlib_installed = 0; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
DEBUG( |
73
|
|
|
|
|
|
|
"Is this module( $module ) installed at privlib or archlib?: $is_privlib_installed" |
74
|
|
|
|
|
|
|
); |
75
|
0
|
|
|
|
|
|
return $is_privlib_installed; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# This checks modules which are already installed |
79
|
|
|
|
|
|
|
sub is_vendor_installed { |
80
|
0
|
|
|
0
|
0
|
|
my ( $self, $module ) = @_; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $file = File::Spec->catfile( split /(?:\'|::)/, $module ) . '.pm'; |
83
|
0
|
|
|
|
|
|
my $is_vendor_installed; |
84
|
0
|
0
|
0
|
|
|
|
if ( -e File::Spec->catfile( $Config{installvendorlib}, $file ) |
85
|
|
|
|
|
|
|
|| -e File::Spec->catfile( $Config{installvendorarch}, $file ) ) |
86
|
|
|
|
|
|
|
{ |
87
|
0
|
|
|
|
|
|
$is_vendor_installed = 1; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
else { |
90
|
0
|
|
|
|
|
|
$is_vendor_installed = 0; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
DEBUG( |
94
|
|
|
|
|
|
|
"Is this module( $module ) installed at vendorlib or vendorarch?: $is_vendor_installed" |
95
|
|
|
|
|
|
|
); |
96
|
0
|
|
|
|
|
|
return $is_vendor_installed; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub check_install_settings_conflicted { |
100
|
0
|
|
|
0
|
0
|
|
my @error_messages = (); |
101
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
if ( $Config{installman1dir} eq $Config{installvendorman1dir} ) { |
103
|
0
|
|
|
|
|
|
push @error_messages, |
104
|
|
|
|
|
|
|
"!! - installman1dir and installvendorman1dir is same value."; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
0
|
0
|
|
|
|
|
if ( $Config{installman3dir} eq $Config{installvendorman3dir} ) { |
108
|
0
|
|
|
|
|
|
push @error_messages, |
109
|
|
|
|
|
|
|
"!! - installman3dir and installvendorman3dir is same value."; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
if ( $Config{installbin} eq $Config{installvendorbin} ) { |
113
|
0
|
|
|
|
|
|
push @error_messages, |
114
|
|
|
|
|
|
|
"!! - installbin and installvendorbin is same value"; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
|
if ( $Config{installprivlib} eq $Config{installvendorlib} ) { |
118
|
0
|
|
|
|
|
|
push @error_messages, |
119
|
|
|
|
|
|
|
"!! - installprivlib and installvendorlib is same value"; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
0
|
0
|
|
|
|
|
if ( $Config{installscript} eq $Config{installvendorscript} ) { |
123
|
0
|
|
|
|
|
|
push @error_messages, |
124
|
|
|
|
|
|
|
"!! - installscript and installvendorscript is same value"; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
if ( $Config{installarchlib} eq $Config{installvendorarch} ) { |
128
|
0
|
|
|
|
|
|
push @error_messages, |
129
|
|
|
|
|
|
|
"!! - installarchliba and installvendorarch is same value"; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
if (@error_messages) { |
133
|
0
|
|
|
|
|
|
return join "\n", @error_messages; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
else { |
136
|
0
|
|
|
|
|
|
return 0; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub _create_confliction_warnings { |
141
|
0
|
|
|
0
|
|
|
my ( $self, $module_names, $error_message ) = @_; |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
my $warning_message = <<"EOS"; |
144
|
|
|
|
|
|
|
WARNINGS |
145
|
|
|
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
146
|
|
|
|
|
|
|
!! The following modules that are being installed may conflict |
147
|
|
|
|
|
|
|
!! with existing modules on the system: |
148
|
|
|
|
|
|
|
!! |
149
|
|
|
|
|
|
|
!! $module_names |
150
|
|
|
|
|
|
|
!! |
151
|
|
|
|
|
|
|
!! Causes: |
152
|
|
|
|
|
|
|
$error_message |
153
|
|
|
|
|
|
|
!! |
154
|
|
|
|
|
|
|
!! Solution: |
155
|
|
|
|
|
|
|
!! It is possible for a CPAN::Packager user to explicitly specify |
156
|
|
|
|
|
|
|
!! installation locations for a distribution's libraries, documentation, |
157
|
|
|
|
|
|
|
!! man pages, binaries, and scripts. Setting both of the below environment |
158
|
|
|
|
|
|
|
!! variables, for example, will accomplish this. |
159
|
|
|
|
|
|
|
!! |
160
|
|
|
|
|
|
|
!! PERL_MM_OPT="INSTALLVENDORMAN1DIR=/usr/local/share/man/man1 |
161
|
|
|
|
|
|
|
!! INSTALLVENDORMAN3DIR=/usr/local/share/man/man3 |
162
|
|
|
|
|
|
|
!! INSTALLVENDORBIN=/usr/local/bin INSTALLVENDORSCRIPT=/usr/local/bin" |
163
|
|
|
|
|
|
|
!! |
164
|
|
|
|
|
|
|
!! PERL_MB_OPT="--config installvendorman1dir=/usr/local/share/man/man1 |
165
|
|
|
|
|
|
|
!! --config installvendorman3dir=/usr/local/share/man/man3 --config |
166
|
|
|
|
|
|
|
!! installvendorbin=/usr/local/bin --config installvendorscript=/usr/local/bin" |
167
|
|
|
|
|
|
|
!! |
168
|
|
|
|
|
|
|
!! You can see the current installation setting with: |
169
|
|
|
|
|
|
|
!! |
170
|
|
|
|
|
|
|
!! perl '-V:install.*' |
171
|
|
|
|
|
|
|
!! |
172
|
|
|
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
173
|
|
|
|
|
|
|
EOS |
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
return $warning_message; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub emit_confliction_warnings { |
179
|
0
|
|
|
0
|
0
|
|
my ( $self, $module_names, $error_message ) = @_; |
180
|
0
|
|
|
|
|
|
my $warning_message = $self->_create_confliction_warnings( $module_names, |
181
|
|
|
|
|
|
|
$error_message ); |
182
|
0
|
|
|
|
|
|
WARN($warning_message); |
183
|
0
|
|
|
|
|
|
return $warning_message; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
1; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
__END__ |