line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPANPLUS::Dist::Build; |
2
|
|
|
|
|
|
|
$CPANPLUS::Dist::Build::VERSION = '0.90'; |
3
|
|
|
|
|
|
|
#ABSTRACT: CPANPLUS plugin to install packages that use Build.PL |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
45890
|
use if $] > 5.017, 'deprecate'; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
37
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
380
|
use strict; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
56
|
|
8
|
1
|
|
|
1
|
|
16
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
78
|
|
9
|
1
|
|
|
1
|
|
9
|
use vars qw[@ISA $STATUS]; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
84
|
|
10
|
|
|
|
|
|
|
@ISA = qw[CPANPLUS::Dist]; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
23
|
use CPANPLUS::Internals::Constants; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
535
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
### these constants were exported by CPANPLUS::Internals::Constants |
15
|
|
|
|
|
|
|
### in previous versions.. they do the same though. If we want to have |
16
|
|
|
|
|
|
|
### a normal 'use' here, up the dependency to CPANPLUS 0.056 or higher |
17
|
|
|
|
|
|
|
BEGIN { |
18
|
1
|
|
|
1
|
|
661
|
require CPANPLUS::Dist::Build::Constants; |
19
|
1
|
50
|
33
|
|
|
96
|
CPANPLUS::Dist::Build::Constants->import() |
20
|
|
|
|
|
|
|
if not __PACKAGE__->can('BUILD') && __PACKAGE__->can('BUILD_DIR'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
9
|
use CPANPLUS::Error; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
8
|
use Config; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
67
|
|
26
|
1
|
|
|
1
|
|
8
|
use FileHandle; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
27
|
1
|
|
|
1
|
|
1089
|
use Cwd; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
64
|
|
28
|
1
|
|
|
1
|
|
7
|
use version; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
|
111
|
use IPC::Cmd qw[run]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
69
|
|
31
|
1
|
|
|
1
|
|
9
|
use Params::Check qw[check]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
32
|
1
|
|
|
1
|
|
7
|
use Module::Load::Conditional qw[can_load check_install]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
85
|
|
33
|
1
|
|
|
1
|
|
9
|
use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
local $Params::Check::VERBOSE = 1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
### check if the format is available ### |
40
|
|
|
|
|
|
|
sub format_available { |
41
|
4
|
|
|
4
|
1
|
1592608
|
my $mod = 'Module::Build'; |
42
|
4
|
50
|
|
|
|
46
|
unless( can_load( modules => { $mod => '0.2611' }, nocache => 1 ) ) { |
43
|
0
|
|
|
|
|
0
|
error( loc( "You do not have '%1' -- '%2' not available", |
44
|
|
|
|
|
|
|
$mod, __PACKAGE__ ) ); |
45
|
0
|
|
|
|
|
0
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
85386
|
return 1; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub init { |
54
|
3
|
|
|
3
|
1
|
39
|
my $dist = shift; |
55
|
3
|
|
|
|
|
37
|
my $status = $dist->status; |
56
|
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
312
|
$status->mk_accessors(qw[build_pl build test created installed uninstalled |
58
|
|
|
|
|
|
|
_create_args _install_args _prepare_args |
59
|
|
|
|
|
|
|
_mb_object _buildflags _metadata |
60
|
|
|
|
|
|
|
]); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
### just in case 'format_available' didn't get called |
63
|
3
|
|
|
|
|
414
|
require Module::Build; |
64
|
|
|
|
|
|
|
|
65
|
3
|
|
|
|
|
18
|
return 1; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub prepare { |
70
|
|
|
|
|
|
|
### just in case you already did a create call for this module object |
71
|
|
|
|
|
|
|
### just via a different dist object |
72
|
7
|
|
|
7
|
1
|
29980
|
my $dist = shift; |
73
|
7
|
|
|
|
|
50
|
my $self = $dist->parent; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
### we're also the cpan_dist, since we don't need to have anything |
76
|
|
|
|
|
|
|
### prepared from another installer |
77
|
7
|
50
|
|
|
|
634
|
$dist = $self->status->dist_cpan if $self->status->dist_cpan; |
78
|
7
|
50
|
|
|
|
1080
|
$self->status->dist_cpan( $dist ) unless $self->status->dist_cpan; |
79
|
|
|
|
|
|
|
|
80
|
7
|
|
|
|
|
570
|
my $cb = $self->parent; |
81
|
7
|
|
|
|
|
120
|
my $conf = $cb->configure_object; |
82
|
7
|
|
|
|
|
100
|
my %hash = @_; |
83
|
|
|
|
|
|
|
|
84
|
7
|
|
|
|
|
19
|
my $dir; |
85
|
7
|
50
|
|
|
|
109
|
unless( $dir = $self->status->extract ) { |
86
|
0
|
|
|
|
|
0
|
error( loc( "No dir found to operate on!" ) ); |
87
|
0
|
|
|
|
|
0
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
7
|
|
|
|
|
620
|
my $args; |
91
|
7
|
|
|
|
|
29
|
my( $force, $verbose, $buildflags, $perl, $prereq_target, $prereq_format, |
92
|
|
|
|
|
|
|
$prereq_build ); |
93
|
7
|
|
|
|
|
13
|
{ local $Params::Check::ALLOW_UNKNOWN = 1; |
|
7
|
|
|
|
|
14
|
|
94
|
7
|
|
|
|
|
83
|
my $tmpl = { |
95
|
|
|
|
|
|
|
force => { default => $conf->get_conf('force'), |
96
|
|
|
|
|
|
|
store => \$force }, |
97
|
|
|
|
|
|
|
verbose => { default => $conf->get_conf('verbose'), |
98
|
|
|
|
|
|
|
store => \$verbose }, |
99
|
|
|
|
|
|
|
perl => { default => $^X, store => \$perl }, |
100
|
|
|
|
|
|
|
buildflags => { default => $conf->get_conf('buildflags'), |
101
|
|
|
|
|
|
|
store => \$buildflags }, |
102
|
|
|
|
|
|
|
prereq_target => { default => '', store => \$prereq_target }, |
103
|
|
|
|
|
|
|
prereq_format => { default => '', |
104
|
|
|
|
|
|
|
store => \$prereq_format }, |
105
|
|
|
|
|
|
|
prereq_build => { default => 0, store => \$prereq_build }, |
106
|
|
|
|
|
|
|
}; |
107
|
|
|
|
|
|
|
|
108
|
7
|
50
|
|
|
|
4540
|
$args = check( $tmpl, \%hash ) or return; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
7
|
100
|
100
|
|
|
1316
|
return 1 if $dist->status->prepared && !$force; |
112
|
|
|
|
|
|
|
|
113
|
5
|
|
|
|
|
816
|
$dist->status->_prepare_args( $args ); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
### chdir to work directory ### |
116
|
5
|
|
|
|
|
22607
|
my $orig = cwd(); |
117
|
5
|
50
|
|
|
|
253
|
unless( $cb->_chdir( dir => $dir ) ) { |
118
|
0
|
|
|
|
|
0
|
error( loc( "Could not chdir to build directory '%1'", $dir ) ); |
119
|
0
|
|
|
|
|
0
|
return; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
### by now we've loaded module::build, and we're using the API, so |
123
|
|
|
|
|
|
|
### it's safe to remove CPANPLUS::inc from our inc path, especially |
124
|
|
|
|
|
|
|
### because it can trip up tests run under taint (just like EU::MM). |
125
|
|
|
|
|
|
|
### turn off our PERL5OPT so no modules from CPANPLUS::inc get |
126
|
|
|
|
|
|
|
### included in make test -- it should build without. |
127
|
|
|
|
|
|
|
### also, modules that run in taint mode break if we leave |
128
|
|
|
|
|
|
|
### our code ref in perl5opt |
129
|
|
|
|
|
|
|
### XXX we've removed the ENV settings from cp::inc, so only need |
130
|
|
|
|
|
|
|
### to reset the @INC |
131
|
|
|
|
|
|
|
#local $ENV{PERL5OPT} = CPANPLUS::inc->original_perl5opt; |
132
|
|
|
|
|
|
|
#local $ENV{PERL5LIB} = CPANPLUS::inc->original_perl5lib; |
133
|
|
|
|
|
|
|
#local @INC = CPANPLUS::inc->original_inc; |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
### this will generate warnings under anything lower than M::B 0.2606 |
136
|
5
|
|
|
|
|
1852
|
my @buildflags = $dist->_buildflags_as_list( $buildflags ); |
137
|
5
|
|
|
|
|
1449
|
$dist->status->_buildflags( $buildflags ); |
138
|
|
|
|
|
|
|
|
139
|
5
|
|
|
|
|
1640
|
my $fail; my $prereq_fail; |
140
|
5
|
|
|
|
|
30
|
my $status = { }; |
141
|
|
|
|
|
|
|
RUN: { |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# 0.85_01 |
144
|
|
|
|
|
|
|
### we resolve 'configure requires' here, so we can run the 'perl |
145
|
|
|
|
|
|
|
### Makefile.PL' command |
146
|
|
|
|
|
|
|
### XXX for tests: mock f_c_r to something that *can* resolve and |
147
|
|
|
|
|
|
|
### something that *doesn't* resolve. Check the error log for ok |
148
|
|
|
|
|
|
|
### on this step or failure |
149
|
|
|
|
|
|
|
### XXX make a separate tarball to test for this scenario: simply |
150
|
|
|
|
|
|
|
### containing a makefile.pl/build.pl for test purposes? |
151
|
5
|
|
|
|
|
16
|
my $safe_ver = version->new('0.85_01'); |
|
5
|
|
|
|
|
118
|
|
152
|
5
|
50
|
|
|
|
173
|
if ( version->new($CPANPLUS::Internals::VERSION) >= $safe_ver ) |
153
|
5
|
|
|
|
|
104
|
{ my $configure_requires = $dist->find_configure_requires; |
154
|
5
|
|
|
|
|
19155
|
my $ok = $dist->_resolve_prereqs( |
155
|
|
|
|
|
|
|
format => $prereq_format, |
156
|
|
|
|
|
|
|
verbose => $verbose, |
157
|
|
|
|
|
|
|
prereqs => $configure_requires, |
158
|
|
|
|
|
|
|
target => $prereq_target, |
159
|
|
|
|
|
|
|
force => $force, |
160
|
|
|
|
|
|
|
prereq_build => $prereq_build, |
161
|
|
|
|
|
|
|
); |
162
|
|
|
|
|
|
|
|
163
|
5
|
50
|
|
|
|
7256
|
unless( $ok ) { |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
#### use $dist->flush to reset the cache ### |
166
|
0
|
|
|
|
|
0
|
error( loc( "Unable to satisfy '%1' for '%2' " . |
167
|
|
|
|
|
|
|
"-- aborting install", |
168
|
|
|
|
|
|
|
'configure_requires', $self->module ) ); |
169
|
0
|
|
|
|
|
0
|
$dist->status->prepared(0); |
170
|
0
|
|
|
|
|
0
|
$prereq_fail++; |
171
|
0
|
|
|
|
|
0
|
$fail++; |
172
|
0
|
|
|
|
|
0
|
last RUN; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
### end of prereq resolving ### |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
# Wrap the exception that may be thrown here (should likely be |
178
|
|
|
|
|
|
|
# done at a much higher level). |
179
|
5
|
|
|
|
|
34
|
my $prep_output; |
180
|
|
|
|
|
|
|
|
181
|
5
|
|
|
|
|
35
|
my $metadata = $dist->status->_metadata; |
182
|
5
|
50
|
33
|
|
|
841
|
my $x_use_unsafe_inc = ( defined $metadata && exists $metadata->{x_use_unsafe_inc} ? $metadata->{x_use_unsafe_inc} : undef ); |
183
|
5
|
50
|
|
|
|
47
|
$x_use_unsafe_inc = 1 unless defined $x_use_unsafe_inc; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
local $ENV{PERL_USE_UNSAFE_INC} = $x_use_unsafe_inc |
186
|
5
|
50
|
|
|
|
43
|
unless exists $ENV{PERL_USE_UNSAFE_INC}; |
187
|
|
|
|
|
|
|
|
188
|
5
|
|
|
|
|
35
|
my $env = ENV_CPANPLUS_IS_EXECUTING; |
189
|
5
|
|
|
|
|
42
|
local $ENV{$env} = BUILD_PL->( $dir ); |
190
|
5
|
|
|
|
|
194
|
my @run_perl = $dist->_perlrun(); |
191
|
5
|
|
|
|
|
24
|
my $cmd = [$perl, @run_perl, BUILD_PL->($dir), @buildflags]; |
192
|
|
|
|
|
|
|
|
193
|
5
|
100
|
|
|
|
194
|
unless ( scalar run( command => $cmd, |
194
|
|
|
|
|
|
|
buffer => \$prep_output, |
195
|
|
|
|
|
|
|
verbose => $verbose ) |
196
|
|
|
|
|
|
|
) { |
197
|
1
|
|
|
|
|
11931
|
error( loc( "Build.PL failed: %1", $prep_output ) ); |
198
|
1
|
50
|
|
|
|
2695
|
if ( $conf->get_conf('cpantest') ) { |
199
|
0
|
|
|
|
|
0
|
$status->{stage} = 'prepare'; |
200
|
0
|
|
|
|
|
0
|
$status->{capture} = $prep_output; |
201
|
|
|
|
|
|
|
} |
202
|
1
|
|
|
|
|
231
|
$fail++; last RUN; |
|
1
|
|
|
|
|
55
|
|
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
4
|
50
|
|
|
|
1345530
|
unless ( -e BUILD->( $dir ) ) { |
206
|
0
|
|
|
|
|
0
|
error( loc( "Build.PL failed to generate a Build script: %1", $prep_output ) ); |
207
|
0
|
0
|
|
|
|
0
|
if ( $conf->get_conf('cpantest') ) { |
208
|
0
|
|
|
|
|
0
|
$status->{stage} = 'prepare'; |
209
|
0
|
|
|
|
|
0
|
$status->{capture} = $prep_output; |
210
|
|
|
|
|
|
|
} |
211
|
0
|
|
|
|
|
0
|
$fail++; last RUN; |
|
0
|
|
|
|
|
0
|
|
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
4
|
|
|
|
|
154
|
msg( $prep_output, 0 ); |
215
|
|
|
|
|
|
|
|
216
|
4
|
|
|
|
|
11868
|
my $prereqs = $self->status->prereqs; |
217
|
|
|
|
|
|
|
|
218
|
4
|
|
66
|
|
|
1562
|
$prereqs ||= $dist->_find_prereqs( verbose => $verbose, |
219
|
|
|
|
|
|
|
dir => $dir, |
220
|
|
|
|
|
|
|
perl => $perl, |
221
|
|
|
|
|
|
|
buildflags => $buildflags ); |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
### send out test report? ### |
226
|
|
|
|
|
|
|
### there is no way to accurately know if it is a PASS/FAIL/ETC |
227
|
|
|
|
|
|
|
### CPANPLUS::Dist::MM doesn't bother why are we? |
228
|
5
|
|
|
|
|
32
|
if( 0 and $fail and $conf->get_conf('cpantest') and not $prereq_fail ) { |
229
|
|
|
|
|
|
|
$cb->_send_report( |
230
|
|
|
|
|
|
|
module => $self, |
231
|
|
|
|
|
|
|
failed => $fail, |
232
|
|
|
|
|
|
|
buffer => CPANPLUS::Error->stack_as_string, |
233
|
|
|
|
|
|
|
status => $status, |
234
|
|
|
|
|
|
|
verbose => $verbose, |
235
|
|
|
|
|
|
|
force => $force, |
236
|
|
|
|
|
|
|
) or error(loc("Failed to send test report for '%1'", |
237
|
|
|
|
|
|
|
$self->module ) ); |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
5
|
50
|
|
|
|
109
|
unless( $cb->_chdir( dir => $orig ) ) { |
241
|
0
|
|
|
|
|
0
|
error( loc( "Could not chdir back to start dir '%1'", $orig ) ); |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
### save where we wrote this stuff -- same as extract dir in normal |
245
|
|
|
|
|
|
|
### installer circumstances |
246
|
5
|
|
|
|
|
1251
|
$dist->status->distdir( $self->status->extract ); |
247
|
|
|
|
|
|
|
|
248
|
5
|
100
|
|
|
|
1664
|
return $dist->status->prepared( $fail ? 0 : 1 ); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub _find_prereqs { |
252
|
2
|
|
|
2
|
|
14
|
my $dist = shift; |
253
|
2
|
|
|
|
|
23
|
my $self = $dist->parent; |
254
|
2
|
|
|
|
|
342
|
my $cb = $self->parent; |
255
|
2
|
|
|
|
|
203
|
my $conf = $cb->configure_object; |
256
|
2
|
|
|
|
|
127
|
my %hash = @_; |
257
|
|
|
|
|
|
|
|
258
|
2
|
|
|
|
|
11
|
my ($verbose, $dir, $buildflags, $perl); |
259
|
2
|
|
|
|
|
75
|
my $tmpl = { |
260
|
|
|
|
|
|
|
verbose => { default => $conf->get_conf('verbose'), store => \$verbose }, |
261
|
|
|
|
|
|
|
dir => { default => $self->status->extract, store => \$dir }, |
262
|
|
|
|
|
|
|
perl => { default => $^X, store => \$perl }, |
263
|
|
|
|
|
|
|
buildflags => { default => $conf->get_conf('buildflags'), |
264
|
|
|
|
|
|
|
store => \$buildflags }, |
265
|
|
|
|
|
|
|
}; |
266
|
|
|
|
|
|
|
|
267
|
2
|
50
|
|
|
|
1693
|
my $args = check( $tmpl, \%hash ) or return; |
268
|
|
|
|
|
|
|
|
269
|
2
|
|
|
|
|
416
|
my $prereqs = {}; |
270
|
|
|
|
|
|
|
|
271
|
2
|
50
|
|
|
|
22
|
$prereqs = $dist->find_mymeta_requires() |
272
|
|
|
|
|
|
|
if $dist->can('find_mymeta_requires'); |
273
|
|
|
|
|
|
|
|
274
|
2
|
100
|
|
|
|
27501
|
if ( keys %$prereqs ) { |
275
|
|
|
|
|
|
|
# Ugly hack |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
else { |
278
|
1
|
|
|
|
|
43
|
my $safe_ver = version->new('0.31_03'); |
279
|
1
|
|
|
|
|
10
|
my $content; |
280
|
|
|
|
|
|
|
PREREQS: { |
281
|
1
|
50
|
33
|
|
|
7
|
if ( version->new( $Module::Build::VERSION ) >= $safe_ver and IPC::Cmd->can_capture_buffer ) { |
|
1
|
|
|
|
|
114
|
|
282
|
1
|
|
|
|
|
330
|
my @buildflags = $dist->_buildflags_as_list( $buildflags ); |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
# Use the new Build action 'prereq_data' |
285
|
1
|
|
|
|
|
246
|
my @run_perl = $dist->_perlrun(); |
286
|
|
|
|
|
|
|
|
287
|
1
|
50
|
|
|
|
22
|
unless ( scalar run( command => [$perl, @run_perl, BUILD->($dir), 'prereq_data', @buildflags], |
288
|
|
|
|
|
|
|
buffer => \$content, |
289
|
|
|
|
|
|
|
verbose => 0 ) |
290
|
|
|
|
|
|
|
) { |
291
|
0
|
|
|
|
|
0
|
error( loc( "Build 'prereq_data' failed: %1 %2", $!, $content ) ); |
292
|
|
|
|
|
|
|
#return; |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
else { |
295
|
1
|
|
|
|
|
159444
|
last PREREQS; |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
0
|
|
|
|
|
0
|
my $file = File::Spec->catfile( $dir, '_build', 'prereqs' ); |
301
|
0
|
0
|
|
|
|
0
|
return unless -f $file; |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
0
|
my $fh = FileHandle->new(); |
304
|
|
|
|
|
|
|
|
305
|
0
|
0
|
|
|
|
0
|
unless( $fh->open( $file ) ) { |
306
|
0
|
|
|
|
|
0
|
error( loc( "Cannot open '%1': %2", $file, $! ) ); |
307
|
0
|
|
|
|
|
0
|
return; |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
0
|
$content = do { local $/; <$fh> }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
1
|
50
|
|
|
|
108
|
return unless $content; |
315
|
1
|
|
|
|
|
480
|
my $bphash = eval $content; |
316
|
1
|
50
|
33
|
|
|
62
|
return unless $bphash and ref $bphash eq 'HASH'; |
317
|
1
|
|
|
|
|
29
|
foreach my $type ('requires', 'build_requires', 'test_requires') { |
318
|
3
|
50
|
33
|
|
|
107
|
next unless $bphash->{$type} and ref $bphash->{$type} eq 'HASH'; |
319
|
0
|
|
|
|
|
0
|
$prereqs->{$_} = $bphash->{$type}->{$_} for keys %{ $bphash->{$type} }; |
|
0
|
|
|
|
|
0
|
|
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
{ |
324
|
2
|
50
|
|
|
|
15
|
delete $prereqs->{'perl'} |
|
2
|
|
|
|
|
87
|
|
325
|
|
|
|
|
|
|
unless version->new($CPANPLUS::Internals::VERSION) |
326
|
|
|
|
|
|
|
>= version->new('0.9102'); |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
### allows for a user defined callback to filter the prerequisite |
330
|
|
|
|
|
|
|
### list as they see fit, to remove (or add) any prereqs they see |
331
|
|
|
|
|
|
|
### fit. The default installed callback will return the hashref in |
332
|
|
|
|
|
|
|
### an unmodified form |
333
|
|
|
|
|
|
|
### this callback got added after cpanplus 0.0562, so use a 'can' |
334
|
|
|
|
|
|
|
### to find out if it's supported. For older versions, we'll just |
335
|
|
|
|
|
|
|
### return the hashref as is ourselves. |
336
|
2
|
50
|
|
|
|
61
|
my $href = $cb->_callbacks->can('filter_prereqs') |
337
|
|
|
|
|
|
|
? $cb->_callbacks->filter_prereqs->( $cb, $prereqs ) |
338
|
|
|
|
|
|
|
: $prereqs; |
339
|
|
|
|
|
|
|
|
340
|
2
|
|
|
|
|
7979
|
$self->status->prereqs( $href ); |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
### make sure it's not the same ref |
343
|
2
|
|
|
|
|
427
|
return { %$href }; |
344
|
|
|
|
|
|
|
} |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
sub create { |
348
|
|
|
|
|
|
|
### just in case you already did a create call for this module object |
349
|
|
|
|
|
|
|
### just via a different dist object |
350
|
4
|
|
|
4
|
1
|
1309
|
my $dist = shift; |
351
|
4
|
|
|
|
|
50
|
my $self = $dist->parent; |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
### we're also the cpan_dist, since we don't need to have anything |
354
|
|
|
|
|
|
|
### prepared from another installer |
355
|
4
|
50
|
|
|
|
377
|
$dist = $self->status->dist_cpan if $self->status->dist_cpan; |
356
|
4
|
50
|
|
|
|
673
|
$self->status->dist_cpan( $dist ) unless $self->status->dist_cpan; |
357
|
|
|
|
|
|
|
|
358
|
4
|
|
|
|
|
385
|
my $cb = $self->parent; |
359
|
4
|
|
|
|
|
234
|
my $conf = $cb->configure_object; |
360
|
4
|
|
|
|
|
91
|
my %hash = @_; |
361
|
|
|
|
|
|
|
|
362
|
4
|
|
|
|
|
20
|
my $dir; |
363
|
4
|
50
|
|
|
|
19
|
unless( $dir = $self->status->extract ) { |
364
|
0
|
|
|
|
|
0
|
error( loc( "No dir found to operate on!" ) ); |
365
|
0
|
|
|
|
|
0
|
return; |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
4
|
|
|
|
|
453
|
my $args; |
369
|
4
|
|
|
|
|
35
|
my( $force, $verbose, $buildflags, $skiptest, $prereq_target, |
370
|
|
|
|
|
|
|
$perl, $prereq_format, $prereq_build); |
371
|
4
|
|
|
|
|
20
|
{ local $Params::Check::ALLOW_UNKNOWN = 1; |
|
4
|
|
|
|
|
40
|
|
372
|
4
|
|
|
|
|
98
|
my $tmpl = { |
373
|
|
|
|
|
|
|
force => { default => $conf->get_conf('force'), |
374
|
|
|
|
|
|
|
store => \$force }, |
375
|
|
|
|
|
|
|
verbose => { default => $conf->get_conf('verbose'), |
376
|
|
|
|
|
|
|
store => \$verbose }, |
377
|
|
|
|
|
|
|
perl => { default => $^X, store => \$perl }, |
378
|
|
|
|
|
|
|
buildflags => { default => $conf->get_conf('buildflags'), |
379
|
|
|
|
|
|
|
store => \$buildflags }, |
380
|
|
|
|
|
|
|
skiptest => { default => $conf->get_conf('skiptest'), |
381
|
|
|
|
|
|
|
store => \$skiptest }, |
382
|
|
|
|
|
|
|
prereq_target => { default => '', store => \$prereq_target }, |
383
|
|
|
|
|
|
|
### don't set the default format to 'build' -- that is wrong! |
384
|
|
|
|
|
|
|
prereq_format => { #default => $self->status->installer_type, |
385
|
|
|
|
|
|
|
default => '', |
386
|
|
|
|
|
|
|
store => \$prereq_format }, |
387
|
|
|
|
|
|
|
prereq_build => { default => 0, store => \$prereq_build }, |
388
|
|
|
|
|
|
|
}; |
389
|
|
|
|
|
|
|
|
390
|
4
|
50
|
|
|
|
4173
|
$args = check( $tmpl, \%hash ) or return; |
391
|
|
|
|
|
|
|
} |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
# restore the state as we have created this already. |
394
|
4
|
50
|
66
|
|
|
975
|
if ( $dist->status->created && !$force ) { |
395
|
|
|
|
|
|
|
### add this directory to your lib ### |
396
|
0
|
|
|
|
|
0
|
$self->add_to_includepath(); |
397
|
0
|
|
|
|
|
0
|
return 1; |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
|
400
|
4
|
|
|
|
|
784
|
$dist->status->_create_args( $args ); |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
### is this dist prepared? |
403
|
4
|
50
|
|
|
|
744
|
unless( $dist->status->prepared ) { |
404
|
0
|
|
|
|
|
0
|
error( loc( "You have not successfully prepared a '%2' distribution ". |
405
|
|
|
|
|
|
|
"yet -- cannot create yet", __PACKAGE__ ) ); |
406
|
0
|
|
|
|
|
0
|
return; |
407
|
|
|
|
|
|
|
} |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
### chdir to work directory ### |
410
|
4
|
|
|
|
|
20061
|
my $orig = cwd(); |
411
|
4
|
50
|
|
|
|
144
|
unless( $cb->_chdir( dir => $dir ) ) { |
412
|
0
|
|
|
|
|
0
|
error( loc( "Could not chdir to build directory '%1'", $dir ) ); |
413
|
0
|
|
|
|
|
0
|
return; |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
### by now we've loaded module::build, and we're using the API, so |
417
|
|
|
|
|
|
|
### it's safe to remove CPANPLUS::inc from our inc path, especially |
418
|
|
|
|
|
|
|
### because it can trip up tests run under taint (just like EU::MM). |
419
|
|
|
|
|
|
|
### turn off our PERL5OPT so no modules from CPANPLUS::inc get |
420
|
|
|
|
|
|
|
### included in make test -- it should build without. |
421
|
|
|
|
|
|
|
### also, modules that run in taint mode break if we leave |
422
|
|
|
|
|
|
|
### our code ref in perl5opt |
423
|
|
|
|
|
|
|
### XXX we've removed the ENV settings from cp::inc, so only need |
424
|
|
|
|
|
|
|
### to reset the @INC |
425
|
|
|
|
|
|
|
#local $ENV{PERL5OPT} = CPANPLUS::inc->original_perl5opt; |
426
|
|
|
|
|
|
|
#local $ENV{PERL5LIB} = CPANPLUS::inc->original_perl5lib; |
427
|
|
|
|
|
|
|
#local @INC = CPANPLUS::inc->original_inc; |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
### but do it *before* the new_from_context, as M::B seems |
430
|
|
|
|
|
|
|
### to be actually running the file... |
431
|
|
|
|
|
|
|
### an unshift in the block seems to be ignored.. somehow... |
432
|
|
|
|
|
|
|
#{ my $lib = $self->best_path_to_module_build; |
433
|
|
|
|
|
|
|
# unshift @INC, $lib if $lib; |
434
|
|
|
|
|
|
|
#} |
435
|
4
|
50
|
|
|
|
1578
|
unshift @INC, $self->best_path_to_module_build |
436
|
|
|
|
|
|
|
if $self->best_path_to_module_build; |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
### this will generate warnings under anything lower than M::B 0.2606 |
439
|
4
|
|
|
|
|
155
|
my @buildflags = $dist->_buildflags_as_list( $buildflags ); |
440
|
4
|
|
|
|
|
1120
|
$dist->status->_buildflags( $buildflags ); |
441
|
|
|
|
|
|
|
|
442
|
4
|
|
|
|
|
1434
|
my $fail; my $prereq_fail; my $test_fail; |
|
4
|
|
|
|
|
0
|
|
443
|
4
|
|
|
|
|
17
|
my $status = { }; |
444
|
|
|
|
|
|
|
RUN: { |
445
|
|
|
|
|
|
|
|
446
|
4
|
|
|
|
|
17
|
my @run_perl = $dist->_perlrun(); |
|
4
|
|
|
|
|
50
|
|
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
### this will set the directory back to the start |
449
|
|
|
|
|
|
|
### dir, so we must chdir /again/ |
450
|
4
|
|
|
|
|
107
|
my $ok = $dist->_resolve_prereqs( |
451
|
|
|
|
|
|
|
force => $force, |
452
|
|
|
|
|
|
|
format => $prereq_format, |
453
|
|
|
|
|
|
|
verbose => $verbose, |
454
|
|
|
|
|
|
|
prereqs => $self->status->prereqs, |
455
|
|
|
|
|
|
|
target => $prereq_target, |
456
|
|
|
|
|
|
|
prereq_build => $prereq_build, |
457
|
|
|
|
|
|
|
); |
458
|
|
|
|
|
|
|
|
459
|
4
|
|
|
|
|
15117
|
my $metadata = $dist->status->_metadata; |
460
|
4
|
50
|
33
|
|
|
862
|
my $x_use_unsafe_inc = ( defined $metadata && exists $metadata->{x_use_unsafe_inc} ? $metadata->{x_use_unsafe_inc} : undef ); |
461
|
4
|
50
|
|
|
|
33
|
$x_use_unsafe_inc = 1 unless defined $x_use_unsafe_inc; |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
local $ENV{PERL_USE_UNSAFE_INC} = $x_use_unsafe_inc |
464
|
4
|
50
|
|
|
|
24
|
unless exists $ENV{PERL_USE_UNSAFE_INC}; |
465
|
|
|
|
|
|
|
|
466
|
4
|
50
|
|
|
|
28
|
unless( $cb->_chdir( dir => $dir ) ) { |
467
|
0
|
|
|
|
|
0
|
error( loc( "Could not chdir to build directory '%1'", $dir ) ); |
468
|
0
|
|
|
|
|
0
|
return; |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
|
471
|
4
|
50
|
|
|
|
483
|
unless( $ok ) { |
472
|
|
|
|
|
|
|
#### use $dist->flush to reset the cache ### |
473
|
0
|
|
|
|
|
0
|
error( loc( "Unable to satisfy prerequisites for '%1' " . |
474
|
|
|
|
|
|
|
"-- aborting install", $self->module ) ); |
475
|
0
|
|
|
|
|
0
|
$dist->status->build(0); |
476
|
0
|
|
|
|
|
0
|
$fail++; $prereq_fail++; |
|
0
|
|
|
|
|
0
|
|
477
|
0
|
|
|
|
|
0
|
last RUN; |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
|
480
|
4
|
|
|
|
|
18
|
my ($captured, $cmd); |
481
|
4
|
|
|
|
|
12
|
if ( ON_VMS ) { |
482
|
|
|
|
|
|
|
$cmd = [$perl, BUILD->($dir), @buildflags]; |
483
|
|
|
|
|
|
|
} |
484
|
|
|
|
|
|
|
else { |
485
|
4
|
|
|
|
|
64
|
$cmd = [$perl, @run_perl, BUILD->($dir), @buildflags]; |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
|
488
|
4
|
50
|
|
|
|
97
|
unless ( scalar run( command => $cmd, |
489
|
|
|
|
|
|
|
buffer => \$captured, |
490
|
|
|
|
|
|
|
verbose => $verbose ) |
491
|
|
|
|
|
|
|
) { |
492
|
0
|
|
|
|
|
0
|
error( loc( "MAKE failed:\n%1", $captured ) ); |
493
|
0
|
|
|
|
|
0
|
$dist->status->build(0); |
494
|
0
|
0
|
|
|
|
0
|
if ( $conf->get_conf('cpantest') ) { |
495
|
0
|
|
|
|
|
0
|
$status->{stage} = 'build'; |
496
|
0
|
|
|
|
|
0
|
$status->{capture} = $captured; |
497
|
|
|
|
|
|
|
} |
498
|
0
|
|
|
|
|
0
|
$fail++; last RUN; |
|
0
|
|
|
|
|
0
|
|
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
|
501
|
4
|
|
|
|
|
1364592
|
msg( $captured, 0 ); |
502
|
|
|
|
|
|
|
|
503
|
4
|
|
|
|
|
13781
|
$dist->status->build(1); |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
### add this directory to your lib ### |
506
|
4
|
|
|
|
|
2314
|
$self->add_to_includepath(); |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
### this buffer will not include what tests failed due to a |
509
|
|
|
|
|
|
|
### M::B/Test::Harness bug. Reported as #9793 with patch |
510
|
|
|
|
|
|
|
### against 0.2607 on 26/1/2005 |
511
|
4
|
50
|
|
|
|
7203
|
unless( $skiptest ) { |
512
|
4
|
|
|
|
|
29
|
my $test_output; |
513
|
4
|
|
|
|
|
17
|
if ( ON_VMS ) { |
514
|
|
|
|
|
|
|
$cmd = [$perl, BUILD->($dir), "test", @buildflags]; |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
else { |
517
|
4
|
|
|
|
|
189
|
$cmd = [$perl, @run_perl, BUILD->($dir), "test", @buildflags]; |
518
|
|
|
|
|
|
|
} |
519
|
4
|
|
|
|
|
82
|
local $ENV{PERL_INSTALL_QUIET}; |
520
|
4
|
50
|
|
|
|
50
|
unless ( scalar run( command => $cmd, |
521
|
|
|
|
|
|
|
buffer => \$test_output, |
522
|
|
|
|
|
|
|
verbose => $verbose ) |
523
|
|
|
|
|
|
|
) { |
524
|
0
|
0
|
|
|
|
0
|
error( loc( "MAKE TEST failed:\n%1 ", $test_output ), ( $verbose ? 0 : 1 ) ); |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
### mark specifically *test* failure.. so we don't |
527
|
|
|
|
|
|
|
### send success on force... |
528
|
0
|
|
|
|
|
0
|
$test_fail++; |
529
|
|
|
|
|
|
|
|
530
|
0
|
0
|
0
|
|
|
0
|
if( !$force and !$cb->_callbacks->proceed_on_test_failure->( |
531
|
|
|
|
|
|
|
$self, $@ ) |
532
|
|
|
|
|
|
|
) { |
533
|
0
|
|
|
|
|
0
|
$dist->status->test(0); |
534
|
0
|
0
|
|
|
|
0
|
if ( $conf->get_conf('cpantest') ) { |
535
|
0
|
|
|
|
|
0
|
$status->{stage} = 'test'; |
536
|
0
|
|
|
|
|
0
|
$status->{capture} = $test_output; |
537
|
|
|
|
|
|
|
} |
538
|
0
|
|
|
|
|
0
|
$fail++; last RUN; |
|
0
|
|
|
|
|
0
|
|
539
|
|
|
|
|
|
|
} |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
else { |
543
|
4
|
|
|
|
|
2341708
|
msg( loc( "MAKE TEST passed:\n%1", $test_output ), 0 ); |
544
|
4
|
|
|
|
|
12289
|
$dist->status->test(1); |
545
|
4
|
50
|
|
|
|
2275
|
if ( $conf->get_conf('cpantest') ) { |
546
|
0
|
|
|
|
|
0
|
$status->{stage} = 'test'; |
547
|
0
|
|
|
|
|
0
|
$status->{capture} = $test_output; |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
} |
551
|
|
|
|
|
|
|
else { |
552
|
0
|
|
|
|
|
0
|
msg(loc("Tests skipped"), $verbose); |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
4
|
50
|
|
|
|
2392
|
unless( $cb->_chdir( dir => $orig ) ) { |
557
|
0
|
|
|
|
|
0
|
error( loc( "Could not chdir back to start dir '%1'", $orig ) ); |
558
|
|
|
|
|
|
|
} |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
### send out test report? ### |
561
|
4
|
50
|
33
|
|
|
1420
|
if( $conf->get_conf('cpantest') and not $prereq_fail ) { |
562
|
0
|
0
|
0
|
|
|
0
|
$cb->_send_report( |
563
|
|
|
|
|
|
|
module => $self, |
564
|
|
|
|
|
|
|
failed => $test_fail || $fail, |
565
|
|
|
|
|
|
|
buffer => CPANPLUS::Error->stack_as_string, |
566
|
|
|
|
|
|
|
status => $status, |
567
|
|
|
|
|
|
|
verbose => $verbose, |
568
|
|
|
|
|
|
|
force => $force, |
569
|
|
|
|
|
|
|
tests_skipped => $skiptest, |
570
|
|
|
|
|
|
|
) or error(loc("Failed to send test report for '%1'", |
571
|
|
|
|
|
|
|
$self->module ) ); |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
4
|
50
|
|
|
|
1336
|
return $dist->status->created( $fail ? 0 : 1 ); |
575
|
|
|
|
|
|
|
} |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
sub install { |
579
|
|
|
|
|
|
|
### just in case you already did a create call for this module object |
580
|
|
|
|
|
|
|
### just via a different dist object |
581
|
2
|
|
|
2
|
1
|
1169
|
my $dist = shift; |
582
|
2
|
|
|
|
|
31
|
my $self = $dist->parent; |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
### we're also the cpan_dist, since we don't need to have anything |
585
|
|
|
|
|
|
|
### prepared from another installer |
586
|
2
|
50
|
|
|
|
264
|
$dist = $self->status->dist_cpan if $self->status->dist_cpan; |
587
|
|
|
|
|
|
|
|
588
|
2
|
|
|
|
|
475
|
my $cb = $self->parent; |
589
|
2
|
|
|
|
|
202
|
my $conf = $cb->configure_object; |
590
|
2
|
|
|
|
|
84
|
my %hash = @_; |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
|
593
|
2
|
|
|
|
|
41
|
my $verbose; my $perl; my $force; my $buildflags; |
|
2
|
|
|
|
|
0
|
|
|
2
|
|
|
|
|
0
|
|
594
|
2
|
|
|
|
|
8
|
{ local $Params::Check::ALLOW_UNKNOWN = 1; |
|
2
|
|
|
|
|
33
|
|
595
|
2
|
|
|
|
|
41
|
my $tmpl = { |
596
|
|
|
|
|
|
|
verbose => { default => $conf->get_conf('verbose'), |
597
|
|
|
|
|
|
|
store => \$verbose }, |
598
|
|
|
|
|
|
|
force => { default => $conf->get_conf('force'), |
599
|
|
|
|
|
|
|
store => \$force }, |
600
|
|
|
|
|
|
|
buildflags => { default => $conf->get_conf('buildflags'), |
601
|
|
|
|
|
|
|
store => \$buildflags }, |
602
|
|
|
|
|
|
|
perl => { default => $^X, store => \$perl }, |
603
|
|
|
|
|
|
|
}; |
604
|
|
|
|
|
|
|
|
605
|
2
|
50
|
|
|
|
1832
|
my $args = check( $tmpl, \%hash ) or return; |
606
|
2
|
|
|
|
|
265
|
$dist->status->_install_args( $args ); |
607
|
|
|
|
|
|
|
} |
608
|
|
|
|
|
|
|
|
609
|
2
|
|
|
|
|
368
|
my $dir; |
610
|
2
|
50
|
|
|
|
13
|
unless( $dir = $self->status->extract ) { |
611
|
0
|
|
|
|
|
0
|
error( loc( "No dir found to operate on!" ) ); |
612
|
0
|
|
|
|
|
0
|
return; |
613
|
|
|
|
|
|
|
} |
614
|
|
|
|
|
|
|
|
615
|
2
|
|
|
|
|
9745
|
my $orig = cwd(); |
616
|
|
|
|
|
|
|
|
617
|
2
|
50
|
|
|
|
86
|
unless( $cb->_chdir( dir => $dir ) ) { |
618
|
0
|
|
|
|
|
0
|
error( loc( "Could not chdir to build directory '%1'", $dir ) ); |
619
|
0
|
|
|
|
|
0
|
return; |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
### value set and false -- means failure ### |
623
|
2
|
0
|
33
|
|
|
637
|
if( defined $self->status->installed && |
|
|
|
33
|
|
|
|
|
624
|
|
|
|
|
|
|
!$self->status->installed && !$force |
625
|
|
|
|
|
|
|
) { |
626
|
0
|
|
|
|
|
0
|
error( loc( "Module '%1' has failed to install before this session " . |
627
|
|
|
|
|
|
|
"-- aborting install", $self->module ) ); |
628
|
0
|
|
|
|
|
0
|
return; |
629
|
|
|
|
|
|
|
} |
630
|
|
|
|
|
|
|
|
631
|
2
|
|
|
|
|
496
|
my $fail; |
632
|
2
|
|
|
|
|
51
|
my @buildflags = $dist->_buildflags_as_list( $buildflags ); |
633
|
2
|
|
|
|
|
441
|
my @run_perl = $dist->_perlrun(); |
634
|
|
|
|
|
|
|
|
635
|
2
|
|
|
|
|
49
|
my $metadata = $dist->status->_metadata; |
636
|
2
|
50
|
33
|
|
|
405
|
my $x_use_unsafe_inc = ( defined $metadata && exists $metadata->{x_use_unsafe_inc} ? $metadata->{x_use_unsafe_inc} : undef ); |
637
|
2
|
50
|
|
|
|
34
|
$x_use_unsafe_inc = 1 unless defined $x_use_unsafe_inc; |
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
local $ENV{PERL_USE_UNSAFE_INC} = $x_use_unsafe_inc |
640
|
2
|
50
|
|
|
|
17
|
unless exists $ENV{PERL_USE_UNSAFE_INC}; |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
### hmm, how is this going to deal with sudo? |
643
|
|
|
|
|
|
|
### for now, check effective uid, if it's not root, |
644
|
|
|
|
|
|
|
### shell out, otherwise use the method |
645
|
2
|
50
|
|
|
|
35
|
if( $> ) { |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
### don't worry about loading the right version of M::B anymore |
648
|
|
|
|
|
|
|
### the 'new_from_context' already added the 'right' path to |
649
|
|
|
|
|
|
|
### M::B at the top of the build.pl |
650
|
0
|
|
|
|
|
0
|
my $cmd; |
651
|
0
|
|
|
|
|
0
|
if ( ON_VMS ) { |
652
|
|
|
|
|
|
|
$cmd = [$perl, BUILD->($dir), "install", @buildflags]; |
653
|
|
|
|
|
|
|
} |
654
|
|
|
|
|
|
|
else { |
655
|
0
|
|
|
|
|
0
|
$cmd = [$perl, @run_perl, BUILD->($dir), "install", @buildflags]; |
656
|
|
|
|
|
|
|
} |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
### Detect local::lib type behaviour. Do not use 'sudo' in these cases |
659
|
0
|
|
|
|
|
0
|
my $sudo = $conf->get_program('sudo'); |
660
|
|
|
|
|
|
|
SUDO: { |
661
|
|
|
|
|
|
|
### Actual local::lib in use |
662
|
0
|
0
|
0
|
|
|
0
|
last SUDO if defined $ENV{PERL_MB_OPT} and $ENV{PERL_MB_OPT} =~ m!install_base!; |
|
0
|
|
|
|
|
0
|
|
663
|
|
|
|
|
|
|
### 'buildflags' is configured with '--install_base' |
664
|
0
|
0
|
|
|
|
0
|
last SUDO if scalar grep { m!install_base! } @buildflags; |
|
0
|
|
|
|
|
0
|
|
665
|
|
|
|
|
|
|
### oh well 'sudo make me a sandwich' |
666
|
0
|
|
|
|
|
0
|
unshift @$cmd, $sudo; |
667
|
|
|
|
|
|
|
} |
668
|
|
|
|
|
|
|
|
669
|
0
|
|
|
|
|
0
|
my $buffer; |
670
|
0
|
0
|
|
|
|
0
|
unless( scalar run( command => $cmd, |
671
|
|
|
|
|
|
|
buffer => \$buffer, |
672
|
|
|
|
|
|
|
verbose => $verbose ) |
673
|
|
|
|
|
|
|
) { |
674
|
0
|
|
|
|
|
0
|
error(loc("Could not run '%1': %2", 'Build install', $buffer)); |
675
|
0
|
|
|
|
|
0
|
$fail++; |
676
|
|
|
|
|
|
|
} |
677
|
|
|
|
|
|
|
} else { |
678
|
2
|
|
|
|
|
11
|
my ($install_output, $cmd); |
679
|
2
|
|
|
|
|
5
|
if ( ON_VMS ) { |
680
|
|
|
|
|
|
|
$cmd = [$perl, BUILD->($dir), "install", @buildflags]; |
681
|
|
|
|
|
|
|
} |
682
|
|
|
|
|
|
|
else { |
683
|
2
|
|
|
|
|
47
|
$cmd = [$perl, @run_perl, BUILD->($dir), "install", @buildflags]; |
684
|
|
|
|
|
|
|
} |
685
|
2
|
50
|
|
|
|
37
|
unless( scalar run( command => $cmd, |
686
|
|
|
|
|
|
|
buffer => \$install_output, |
687
|
|
|
|
|
|
|
verbose => $verbose ) |
688
|
|
|
|
|
|
|
) { |
689
|
0
|
|
|
|
|
0
|
error(loc("Could not run '%1': %2", 'Build install', $install_output)); |
690
|
0
|
|
|
|
|
0
|
$fail++; |
691
|
|
|
|
|
|
|
} |
692
|
|
|
|
|
|
|
else { |
693
|
2
|
|
|
|
|
621707
|
msg( $install_output, 0 ); |
694
|
|
|
|
|
|
|
} |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
|
698
|
2
|
50
|
|
|
|
5479
|
unless( $cb->_chdir( dir => $orig ) ) { |
699
|
0
|
|
|
|
|
0
|
error( loc( "Could not chdir back to start dir '%1'", $orig ) ); |
700
|
|
|
|
|
|
|
} |
701
|
|
|
|
|
|
|
|
702
|
2
|
50
|
|
|
|
773
|
return $dist->status->installed( $fail ? 0 : 1 ); |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
### returns the string 'foo=bar --zot quux' |
706
|
|
|
|
|
|
|
### as the list 'foo=bar', '--zot', 'qux' |
707
|
|
|
|
|
|
|
sub _buildflags_as_list { |
708
|
12
|
|
|
12
|
|
87
|
my $self = shift; |
709
|
12
|
50
|
|
|
|
178
|
my $flags = shift or return; |
710
|
|
|
|
|
|
|
|
711
|
12
|
|
|
|
|
444
|
return Module::Build->split_like_shell($flags); |
712
|
|
|
|
|
|
|
} |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
{ |
715
|
|
|
|
|
|
|
my $afe_ver = version->new($CPANPLUS::Internals::VERSION) >= version->new("0.9166"); |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
sub _perlrun { |
718
|
12
|
|
|
12
|
|
52
|
my $self = shift; |
719
|
12
|
50
|
|
|
|
104
|
if ( $afe_ver ) { |
720
|
12
|
|
|
|
|
106
|
return ( '-MCPANPLUS::Internals::Utils::Autoflush' ); |
721
|
|
|
|
|
|
|
} |
722
|
|
|
|
|
|
|
else { |
723
|
0
|
|
|
|
|
|
return ( '-e', CPDB_PERL_WRAPPER ); |
724
|
|
|
|
|
|
|
} |
725
|
|
|
|
|
|
|
} |
726
|
|
|
|
|
|
|
} |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
qq[Putting the Module::Build into CPANPLUS]; |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
# Local variables: |
733
|
|
|
|
|
|
|
# c-indentation-style: bsd |
734
|
|
|
|
|
|
|
# c-basic-offset: 4 |
735
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
736
|
|
|
|
|
|
|
# End: |
737
|
|
|
|
|
|
|
# vim: expandtab shiftwidth=4: |
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
__END__ |