| 1 | package CPANPLUS::Dist::Build; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | $CPANPLUS::Dist::Build::VERSION = '0.88'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | #ABSTRACT: CPANPLUS plugin to install packages that use Build.PL | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use if $] > 5.017, 'deprecate'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use vars qw[@ISA $STATUS]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | @ISA = qw[CPANPLUS::Dist]; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use CPANPLUS::Internals::Constants; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | 2 | ▶ | require CPANPLUS::Dist::Build::Constants; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=13.1
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | CPANPLUS::Dist::Build::Constants->import() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
__PACKAGE__->can('BUILD') && __PACKAGE__->can('BUILD_DIR')
MC/DC0%0/2
__PACKAGE__->can('BUILD') && __PACKAGE__->can('BUILD_DIR')
__PACKAGE__->can('BUILD')
__PACKAGE__->can('BUILD_DIR')
Truth table33%1/3
A && B
A= __PACKAGE__->can('BUILD')B= __PACKAGE__->can('BUILD_DIR')
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | if not __PACKAGE__->can('BUILD') && __PACKAGE__->can('BUILD_DIR'); | ||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use CPANPLUS::Error; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | use FileHandle; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | ▶ | use version; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | ▶ | use IPC::Cmd qw[run]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | use Params::Check qw[check]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | ▶ | use Module::Load::Conditional qw[can_load check_install]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | local $Params::Check::VERBOSE = 1; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | ### check if the format is available ### | ||||||||||||||||||||||||||||||||||||||||||
| 40 | sub format_available { | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | my $mod = 'Module::Build'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_available: called CC=2 SCAR=8.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | ▶ | unless( can_load( modules => { $mod => '0.2611' }, nocache => 1 ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | error( loc( "You do not have '%1' -- '%2' not available", | |||||||||||||||||||||||||||||||||||||||||
| 44 | $mod, __PACKAGE__ ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | sub init { | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | ▶ | my $dist = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | my $status = $dist->status; | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 3 | $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 | require Module::Build; | |||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 3 | 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 | ▶ | my $dist = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare: called CC=21 SCAR=35.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 7 | 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 | ▶ | $dist = $self->status->dist_cpan if $self->status->dist_cpan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 7 | ▶ | $self->status->dist_cpan( $dist ) unless $self->status->dist_cpan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 7 | my $cb = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 7 | my $conf = $cb->configure_object; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 7 | my %hash = @_; | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 7 | my $dir; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | unless( $dir = $self->status->extract ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | error( loc( "No dir found to operate on!" ) ); | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 7 | my $args; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 7 | my( $force, $verbose, $buildflags, $perl, $prereq_target, $prereq_format, | |||||||||||||||||||||||||||||||||||||||||
| 92 | $prereq_build ); | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | { local $Params::Check::ALLOW_UNKNOWN = 1; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 7 | 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 | ▶ | $args = check( $tmpl, \%hash ) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 7 | ▶ | return 1 if $dist->status->prepared && !$force; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$dist->status->prepared and not $force
MC/DC100%2/2
$dist->status->prepared and not $force
$dist->status->prepared
not $force
Truth table100%3/3
A and not(B)
A= $dist->status->preparedB= not $force
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 5 | $dist->status->_prepare_args( $args ); | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | ### chdir to work directory ### | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 5 | my $orig = cwd(); | |||||||||||||||||||||||||||||||||||||||||
| 117 | 5 | ▶ | unless( $cb->_chdir( dir => $dir ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | error( loc( "Could not chdir to build directory '%1'", $dir ) ); | |||||||||||||||||||||||||||||||||||||||||
| 119 | 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 | my @buildflags = $dist->_buildflags_as_list( $buildflags ); | |||||||||||||||||||||||||||||||||||||||||
| 137 | 5 | $dist->status->_buildflags( $buildflags ); | |||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 5 | my $fail; my $prereq_fail; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 5 | 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 | my $safe_ver = version->new('0.85_01'); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 5 | ▶ | if ( version->new($CPANPLUS::Internals::VERSION) >= $safe_ver ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 5 | { my $configure_requires = $dist->find_configure_requires; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 5 | 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 | ▶ | unless( $ok ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | #### use $dist->flush to reset the cache ### | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | error( loc( "Unable to satisfy '%1' for '%2' " . | |||||||||||||||||||||||||||||||||||||||||
| 167 | "-- aborting install", | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 'configure_requires', $self->module ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $dist->status->prepared(0); | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $prereq_fail++; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $fail++; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 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 | my $prep_output; | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 5 | my $metadata = $dist->status->_metadata; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 5 | ▶ | my $x_use_unsafe_inc = ( defined $metadata && exists $metadata->{x_use_unsafe_inc} ? $metadata->{x_use_unsafe_inc} : undef ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $metadata and exists $metadata->{"x_use_unsafe_inc"}
MC/DC0%0/2
defined $metadata and exists $metadata->{"x_use_unsafe_inc"}
defined $metadata
exists $metadata->{"x_use_unsafe_inc"}
Truth table33%1/3
A and B
A= defined $metadataB= exists $metadata->{"x_use_unsafe_inc"}
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 5 | ▶ | $x_use_unsafe_inc = 1 unless defined $x_use_unsafe_inc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | local $ENV{PERL_USE_UNSAFE_INC} = $x_use_unsafe_inc | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 5 | ▶ | unless exists $ENV{PERL_USE_UNSAFE_INC}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 5 | my $env = ENV_CPANPLUS_IS_EXECUTING; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 5 | local $ENV{$env} = BUILD_PL->( $dir ); | |||||||||||||||||||||||||||||||||||||||||
| 190 | 5 | my @run_perl = $dist->_perlrun(); | |||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | my $cmd = [$perl, @run_perl, BUILD_PL->($dir), @buildflags]; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | ▶ | unless ( scalar run( command => $cmd, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | buffer => \$prep_output, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | verbose => $verbose ) | ||||||||||||||||||||||||||||||||||||||||||
| 196 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | error( loc( "Build.PL failed: %1", $prep_output ) ); | |||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | ▶ | if ( $conf->get_conf('cpantest') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $status->{stage} = 'prepare'; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $status->{capture} = $prep_output; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | $fail++; last RUN; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | ▶ | unless ( -e BUILD->( $dir ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | error( loc( "Build.PL failed to generate a Build script: %1", $prep_output ) ); | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if ( $conf->get_conf('cpantest') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $status->{stage} = 'prepare'; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $status->{capture} = $prep_output; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $fail++; last RUN; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 4 | msg( $prep_output, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 4 | my $prereqs = $self->status->prereqs; | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 4 | ▶ | $prereqs ||= $dist->_find_prereqs( verbose => $verbose, | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$prereqs ||= $dist->_find_prereqs("verbose", $verbose, "dir", $dir, "perl", $perl, "buildflags", $buildflags)
MC/DC0%0/2
$prereqs ||= $dist->_find_prereqs("verbose", $verbose, "dir", $dir, "perl", $perl, "buildflags", $buildflags)
$prereqs
$dist->_find_prereqs("verbose", $verbose, "dir", $dir, "perl", $perl, "buildflags", $buildflags)
Truth table66%2/3
A ||= B
A= $prereqsB= $dist->_find_prereqs("verbose", $verbose, "dir", $dir, "perl", $perl, "buildflags", $buildflags)
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | 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 | ▶ | unless( $cb->_chdir( dir => $orig ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 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 | $dist->status->distdir( $self->status->extract ); | |||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 5 | ▶ | return $dist->status->prepared( $fail ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | sub _find_prereqs { | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 2 | ▶ | my $dist = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_prereqs: called CC=18 SCAR=37.3
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | my $self = $dist->parent; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | my $cb = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | my $conf = $cb->configure_object; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 2 | my %hash = @_; | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | my ($verbose, $dir, $buildflags, $perl); | |||||||||||||||||||||||||||||||||||||||||
| 259 | 2 | 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 | ▶ | my $args = check( $tmpl, \%hash ) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | my $prereqs = {}; | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 2 | ▶ | $prereqs = $dist->find_mymeta_requires() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | if $dist->can('find_mymeta_requires'); | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | ▶ | if ( keys %$prereqs ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | # Ugly hack | ||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | my $safe_ver = version->new('0.31_03'); | |||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | my $content; | |||||||||||||||||||||||||||||||||||||||||
| 280 | PREREQS: { | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | ▶ | if ( version->new( $Module::Build::VERSION ) >= $safe_ver and IPC::Cmd->can_capture_buffer ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
"version"->new($Module::Build::VERSION) >= $safe_ver and "IPC::Cmd"->can_capture_buffer
MC/DC0%0/2
"version"->new($Module::Build::VERSION) >= $safe_ver and "IPC::Cmd"->can_capture_buffer
"version"->new($Module::Build::VERSION) >= $safe_ver
"IPC::Cmd"->can_capture_buffer
Truth table33%1/3
A and B
A= "version"->new($Module::Build::VERSION) >= $safe_verB= "IPC::Cmd"->can_capture_buffer
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 1 | my @buildflags = $dist->_buildflags_as_list( $buildflags ); | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | # Use the new Build action 'prereq_data' | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | my @run_perl = $dist->_perlrun(); | |||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | ▶ | unless ( scalar run( command => [$perl, @run_perl, BUILD->($dir), 'prereq_data', @buildflags], | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | buffer => \$content, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | verbose => 0 ) | ||||||||||||||||||||||||||||||||||||||||||
| 290 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | error( loc( "Build 'prereq_data' failed: %1 %2", $!, $content ) ); | |||||||||||||||||||||||||||||||||||||||||
| 292 | #return; | ||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 1 | last PREREQS; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | my $file = File::Spec->catfile( $dir, '_build', 'prereqs' ); | |||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | return unless -f $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $fh = FileHandle->new(); | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | unless( $fh->open( $file ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | error( loc( "Cannot open '%1': %2", $file, $! ) ); | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $content = do { local $/; <$fh> }; | |||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | ▶ | return unless $content; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | my $bphash = eval $content; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | ▶ | return unless $bphash and ref $bphash eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$bphash and ref $bphash eq "HASH"
MC/DC0%0/2
$bphash and ref $bphash eq "HASH"
$bphash
ref $bphash eq "HASH"
Truth table33%1/3
A and B
A= $bphashB= ref $bphash eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | foreach my $type ('requires', 'build_requires', 'test_requires') { | |||||||||||||||||||||||||||||||||||||||||
| 318 | 3 | ▶ | next unless $bphash->{$type} and ref $bphash->{$type} eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$bphash->{$type} and ref $bphash->{$type} eq "HASH"
MC/DC0%0/2
$bphash->{$type} and ref $bphash->{$type} eq "HASH"
$bphash->{$type}
ref $bphash->{$type} eq "HASH"
Truth table33%1/3
A and B
A= $bphash->{$type}B= ref $bphash->{$type} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $prereqs->{$_} = $bphash->{$type}->{$_} for keys %{ $bphash->{$type} }; | |||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | { | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 2 | ▶ | delete $prereqs->{'perl'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | ▶ | my $href = $cb->_callbacks->can('filter_prereqs') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | ? $cb->_callbacks->filter_prereqs->( $cb, $prereqs ) | ||||||||||||||||||||||||||||||||||||||||||
| 338 | : $prereqs; | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 2 | $self->status->prereqs( $href ); | |||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | ### make sure it's not the same ref | ||||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | 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 | ▶ | my $dist = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: called CC=31 SCAR=50.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 4 | 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 | ▶ | $dist = $self->status->dist_cpan if $self->status->dist_cpan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 4 | ▶ | $self->status->dist_cpan( $dist ) unless $self->status->dist_cpan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | my $cb = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 4 | my $conf = $cb->configure_object; | |||||||||||||||||||||||||||||||||||||||||
| 360 | 4 | my %hash = @_; | |||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 4 | my $dir; | |||||||||||||||||||||||||||||||||||||||||
| 363 | 4 | ▶ | unless( $dir = $self->status->extract ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | error( loc( "No dir found to operate on!" ) ); | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 4 | my $args; | |||||||||||||||||||||||||||||||||||||||||
| 369 | 4 | my( $force, $verbose, $buildflags, $skiptest, $prereq_target, | |||||||||||||||||||||||||||||||||||||||||
| 370 | $perl, $prereq_format, $prereq_build); | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 4 | { local $Params::Check::ALLOW_UNKNOWN = 1; | |||||||||||||||||||||||||||||||||||||||||
| 372 | 4 | 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 | ▶ | $args = check( $tmpl, \%hash ) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | # restore the state as we have created this already. | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 4 | ▶ | if ( $dist->status->created && !$force ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$dist->status->created and not $force
MC/DC0%0/2
$dist->status->created and not $force
$dist->status->created
not $force
Truth table66%2/3
A and not(B)
A= $dist->status->createdB= not $force
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | ### add this directory to your lib ### | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $self->add_to_includepath(); | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 4 | $dist->status->_create_args( $args ); | |||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | ### is this dist prepared? | ||||||||||||||||||||||||||||||||||||||||||
| 403 | 4 | ▶ | unless( $dist->status->prepared ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | error( loc( "You have not successfully prepared a '%2' distribution ". | |||||||||||||||||||||||||||||||||||||||||
| 405 | "yet -- cannot create yet", __PACKAGE__ ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | ### chdir to work directory ### | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 4 | my $orig = cwd(); | |||||||||||||||||||||||||||||||||||||||||
| 411 | 4 | ▶ | unless( $cb->_chdir( dir => $dir ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | error( loc( "Could not chdir to build directory '%1'", $dir ) ); | |||||||||||||||||||||||||||||||||||||||||
| 413 | 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 | ▶ | unshift @INC, $self->best_path_to_module_build | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | if $self->best_path_to_module_build; | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | ### this will generate warnings under anything lower than M::B 0.2606 | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 4 | my @buildflags = $dist->_buildflags_as_list( $buildflags ); | |||||||||||||||||||||||||||||||||||||||||
| 440 | 4 | $dist->status->_buildflags( $buildflags ); | |||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 4 | my $fail; my $prereq_fail; my $test_fail; | |||||||||||||||||||||||||||||||||||||||||
| 443 | 4 | my $status = { }; | |||||||||||||||||||||||||||||||||||||||||
| 444 | RUN: { | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 4 | my @run_perl = $dist->_perlrun(); | |||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | ### this will set the directory back to the start | ||||||||||||||||||||||||||||||||||||||||||
| 449 | ### dir, so we must chdir /again/ | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 4 | 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 | my $metadata = $dist->status->_metadata; | |||||||||||||||||||||||||||||||||||||||||
| 460 | 4 | ▶ | my $x_use_unsafe_inc = ( defined $metadata && exists $metadata->{x_use_unsafe_inc} ? $metadata->{x_use_unsafe_inc} : undef ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $metadata and exists $metadata->{"x_use_unsafe_inc"}
MC/DC0%0/2
defined $metadata and exists $metadata->{"x_use_unsafe_inc"}
defined $metadata
exists $metadata->{"x_use_unsafe_inc"}
Truth table33%1/3
A and B
A= defined $metadataB= exists $metadata->{"x_use_unsafe_inc"}
| |||||||||||||||||||||||||||||||||||||||||||
| 461 | 4 | ▶ | $x_use_unsafe_inc = 1 unless defined $x_use_unsafe_inc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | local $ENV{PERL_USE_UNSAFE_INC} = $x_use_unsafe_inc | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 4 | ▶ | unless exists $ENV{PERL_USE_UNSAFE_INC}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 4 | ▶ | unless( $cb->_chdir( dir => $dir ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | error( loc( "Could not chdir to build directory '%1'", $dir ) ); | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | 4 | ▶ | unless( $ok ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | #### use $dist->flush to reset the cache ### | ||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | error( loc( "Unable to satisfy prerequisites for '%1' " . | |||||||||||||||||||||||||||||||||||||||||
| 474 | "-- aborting install", $self->module ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $dist->status->build(0); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $fail++; $prereq_fail++; | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | last RUN; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 4 | my ($captured, $cmd); | |||||||||||||||||||||||||||||||||||||||||
| 481 | 4 | if ( ON_VMS ) { | |||||||||||||||||||||||||||||||||||||||||
| 482 | $cmd = [$perl, BUILD->($dir), @buildflags]; | ||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 484 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 4 | $cmd = [$perl, @run_perl, BUILD->($dir), @buildflags]; | |||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||
| 488 | 4 | ▶ | unless ( scalar run( command => $cmd, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | buffer => \$captured, | ||||||||||||||||||||||||||||||||||||||||||
| 490 | verbose => $verbose ) | ||||||||||||||||||||||||||||||||||||||||||
| 491 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | error( loc( "MAKE failed:\n%1", $captured ) ); | |||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | $dist->status->build(0); | |||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | if ( $conf->get_conf('cpantest') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $status->{stage} = 'build'; | |||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $status->{capture} = $captured; | |||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $fail++; last RUN; | |||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 4 | msg( $captured, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 4 | $dist->status->build(1); | |||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | ### add this directory to your lib ### | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 4 | $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 | ▶ | unless( $skiptest ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 4 | my $test_output; | |||||||||||||||||||||||||||||||||||||||||
| 513 | 4 | if ( ON_VMS ) { | |||||||||||||||||||||||||||||||||||||||||
| 514 | $cmd = [$perl, BUILD->($dir), "test", @buildflags]; | ||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||
| 516 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 4 | $cmd = [$perl, @run_perl, BUILD->($dir), "test", @buildflags]; | |||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 519 | 4 | local $ENV{PERL_INSTALL_QUIET}; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 4 | ▶ | unless ( scalar run( command => $cmd, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | buffer => \$test_output, | ||||||||||||||||||||||||||||||||||||||||||
| 522 | verbose => $verbose ) | ||||||||||||||||||||||||||||||||||||||||||
| 523 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | error( loc( "MAKE TEST failed:\n%1 ", $test_output ), ( $verbose ? 0 : 1 ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | ### mark specifically *test* failure.. so we don't | ||||||||||||||||||||||||||||||||||||||||||
| 527 | ### send success on force... | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | $test_fail++; | |||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | if( !$force and !$cb->_callbacks->proceed_on_test_failure->( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$force or $cb->_callbacks->proceed_on_test_failure->($self, $@)
MC/DC0%0/2
$force or $cb->_callbacks->proceed_on_test_failure->($self, $@)
$force
$cb->_callbacks->proceed_on_test_failure->($self, $@)
Truth table0%0/3
A or B
A= $forceB= $cb->_callbacks->proceed_on_test_failure->($self, $@)
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | $self, $@ ) | ||||||||||||||||||||||||||||||||||||||||||
| 532 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | $dist->status->test(0); | |||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if ( $conf->get_conf('cpantest') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | $status->{stage} = 'test'; | |||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $status->{capture} = $test_output; | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | $fail++; last RUN; | |||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 543 | 4 | msg( loc( "MAKE TEST passed:\n%1", $test_output ), 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 544 | 4 | $dist->status->test(1); | |||||||||||||||||||||||||||||||||||||||||
| 545 | 4 | ▶ | if ( $conf->get_conf('cpantest') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $status->{stage} = 'test'; | |||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | $status->{capture} = $test_output; | |||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 551 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | msg(loc("Tests skipped"), $verbose); | |||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 4 | ▶ | unless( $cb->_chdir( dir => $orig ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | error( loc( "Could not chdir back to start dir '%1'", $orig ) ); | |||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | ### send out test report? ### | ||||||||||||||||||||||||||||||||||||||||||
| 561 | 4 | ▶ | if( $conf->get_conf('cpantest') and not $prereq_fail ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$conf->get_conf("cpantest") and not $prereq_fail
MC/DC0%0/2
$conf->get_conf("cpantest") and not $prereq_fail
$conf->get_conf("cpantest")
not $prereq_fail
Truth table33%1/3
A and not(B)
A= $conf->get_conf("cpantest")B= not $prereq_fail
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | $cb->_send_report( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$test_fail || $fail
MC/DC0%0/2
$test_fail || $fail
$test_fail
$fail
Truth table0%0/3
A || B
A= $test_failB= $fail
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | ▶ | return $dist->status->created( $fail ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | ▶ | my $dist = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install: called CC=20 SCAR=39.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 582 | 2 | 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 | ▶ | $dist = $self->status->dist_cpan if $self->status->dist_cpan; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 2 | my $cb = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 2 | my $conf = $cb->configure_object; | |||||||||||||||||||||||||||||||||||||||||
| 590 | 2 | my %hash = @_; | |||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 2 | my $verbose; my $perl; my $force; my $buildflags; | |||||||||||||||||||||||||||||||||||||||||
| 594 | 2 | { local $Params::Check::ALLOW_UNKNOWN = 1; | |||||||||||||||||||||||||||||||||||||||||
| 595 | 2 | 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 | ▶ | my $args = check( $tmpl, \%hash ) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | 2 | $dist->status->_install_args( $args ); | |||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | 2 | my $dir; | |||||||||||||||||||||||||||||||||||||||||
| 610 | 2 | ▶ | unless( $dir = $self->status->extract ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | error( loc( "No dir found to operate on!" ) ); | |||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | 2 | my $orig = cwd(); | |||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | 2 | ▶ | unless( $cb->_chdir( dir => $dir ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | error( loc( "Could not chdir to build directory '%1'", $dir ) ); | |||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | ### value set and false -- means failure ### | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 2 | ▶ | if( defined $self->status->installed && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $self->status->installed and not $self->status->installed and not $force
defined $self->status->installed and not $self->status->installed
MC/DC0%0/3
defined $self->status->installed and not $self->status->installed and not $force
defined $self->status->installed
not $self->status->installed
not $force
Truth table25%1/4
A and not(B) and not(C)
A= defined $self->status->installedB= not $self->status->installedC= not $force
| |||||||||||||||||||||||||||||||||||||||||||
| 624 | !$self->status->installed && !$force | ||||||||||||||||||||||||||||||||||||||||||
| 625 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | error( loc( "Module '%1' has failed to install before this session " . | |||||||||||||||||||||||||||||||||||||||||
| 627 | "-- aborting install", $self->module ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||
| 631 | 2 | my $fail; | |||||||||||||||||||||||||||||||||||||||||
| 632 | 2 | my @buildflags = $dist->_buildflags_as_list( $buildflags ); | |||||||||||||||||||||||||||||||||||||||||
| 633 | 2 | my @run_perl = $dist->_perlrun(); | |||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||
| 635 | 2 | my $metadata = $dist->status->_metadata; | |||||||||||||||||||||||||||||||||||||||||
| 636 | 2 | ▶ | my $x_use_unsafe_inc = ( defined $metadata && exists $metadata->{x_use_unsafe_inc} ? $metadata->{x_use_unsafe_inc} : undef ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $metadata and exists $metadata->{"x_use_unsafe_inc"}
MC/DC0%0/2
defined $metadata and exists $metadata->{"x_use_unsafe_inc"}
defined $metadata
exists $metadata->{"x_use_unsafe_inc"}
Truth table33%1/3
A and B
A= defined $metadataB= exists $metadata->{"x_use_unsafe_inc"}
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | 2 | ▶ | $x_use_unsafe_inc = 1 unless defined $x_use_unsafe_inc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | local $ENV{PERL_USE_UNSAFE_INC} = $x_use_unsafe_inc | ||||||||||||||||||||||||||||||||||||||||||
| 640 | 2 | ▶ | unless exists $ENV{PERL_USE_UNSAFE_INC}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | ▶ | if( $> ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | 2 | my $cmd; | |||||||||||||||||||||||||||||||||||||||||
| 651 | 2 | if ( ON_VMS ) { | |||||||||||||||||||||||||||||||||||||||||
| 652 | $cmd = [$perl, BUILD->($dir), "install", @buildflags]; | ||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 655 | 2 | $cmd = [$perl, @run_perl, BUILD->($dir), "install", @buildflags]; | |||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | ### Detect local::lib type behaviour. Do not use 'sudo' in these cases | ||||||||||||||||||||||||||||||||||||||||||
| 659 | 2 | my $sudo = $conf->get_program('sudo'); | |||||||||||||||||||||||||||||||||||||||||
| 660 | SUDO: { | ||||||||||||||||||||||||||||||||||||||||||
| 661 | ### Actual local::lib in use | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 2 | ▶ | last SUDO if defined $ENV{PERL_MB_OPT} and $ENV{PERL_MB_OPT} =~ m!install_base!; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $ENV{"PERL_MB_OPT"} and $ENV{"PERL_MB_OPT"} =~ /install_base/
MC/DC0%0/2
defined $ENV{"PERL_MB_OPT"} and $ENV{"PERL_MB_OPT"} =~ /install_base/
defined $ENV{"PERL_MB_OPT"}
$ENV{"PERL_MB_OPT"} =~ /install_base/
Truth table33%1/3
A and B
A= defined $ENV{"PERL_MB_OPT"}B= $ENV{"PERL_MB_OPT"} =~ /install_base/
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | ### 'buildflags' is configured with '--install_base' | ||||||||||||||||||||||||||||||||||||||||||
| 664 | 2 | ▶ | last SUDO if scalar grep { m!install_base! } @buildflags; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 665 | ### oh well 'sudo make me a sandwich' | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | unshift @$cmd, $sudo; | |||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||
| 669 | 2 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 670 | 2 | ▶ | unless( scalar run( command => $cmd, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | buffer => \$buffer, | ||||||||||||||||||||||||||||||||||||||||||
| 672 | verbose => $verbose ) | ||||||||||||||||||||||||||||||||||||||||||
| 673 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | error(loc("Could not run '%1': %2", 'Build install', $buffer)); | |||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | $fail++; | |||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||
| 677 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | my ($install_output, $cmd); | |||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | if ( ON_VMS ) { | |||||||||||||||||||||||||||||||||||||||||
| 680 | $cmd = [$perl, BUILD->($dir), "install", @buildflags]; | ||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 682 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | $cmd = [$perl, @run_perl, BUILD->($dir), "install", @buildflags]; | |||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | unless( scalar run( command => $cmd, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | buffer => \$install_output, | ||||||||||||||||||||||||||||||||||||||||||
| 687 | verbose => $verbose ) | ||||||||||||||||||||||||||||||||||||||||||
| 688 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | error(loc("Could not run '%1': %2", 'Build install', $install_output)); | |||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | $fail++; | |||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||
| 692 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | msg( $install_output, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | 2 | ▶ | unless( $cb->_chdir( dir => $orig ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | error( loc( "Could not chdir back to start dir '%1'", $orig ) ); | |||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | 2 | ▶ | return $dist->status->installed( $fail ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_buildflags_as_list: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | 12 | ▶ | my $flags = shift or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | 12 | return Module::Build->split_like_shell($flags); | |||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | { | ||||||||||||||||||||||||||||||||||||||||||
| 715 | 2 | my $afe_ver = version->new($CPANPLUS::Internals::VERSION) >= version->new("0.9166"); | |||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | sub _perlrun { | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 12 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_perlrun: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||
| 719 | 12 | ▶ | if ( $afe_ver ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | 12 | return ( '-MCPANPLUS::Internals::Utils::Autoflush' ); | |||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||
| 722 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | return ( '-e', CPDB_PERL_WRAPPER ); | |||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | 2 | 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__ | ||||||||||||||||||||||||||||||||||||||||||