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