« blib/lib/Alien/Build/Plugin/Fetch/CurlCommand.pm
↑ Summary
blib/lib/Alien/Build/Plugin/Probe/CommandLine.pm »
| 1 | package Alien::Build; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 62 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 62 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 62 | ▶ | use 5.008004; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 62 | ▶ | use Path::Tiny (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 62 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 62 | ▶ | use File::chdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 62 | ▶ | use JSON::PP (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 62 | ▶ | use Env qw( @PATH @PKG_CONFIG_PATH ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 62 | ▶ | use Config (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 62 | ▶ | use Alien::Build::Log; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # ABSTRACT: Build external dependencies for use in CPAN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 62 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1101 | ▶ | sub _path { goto \&Path::Tiny::path } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_path: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 417 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 417 | my($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | my $self = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | install_prop => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | root => _path($args{root} || "_alien")->absolute->stringify, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 417 | ▶ | patch => (defined $args{patch}) ? _path($args{patch})->absolute->stringify : undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$args{'root'} || '_alien'
$Alien::Build::VERSION || 'dev'
MC/DC100%1/1
$args{'root'} || '_alien'
$args{'root'}
MC/DC0%0/1
$Alien::Build::VERSION || 'dev'
$Alien::Build::VERSION
Truth table100%2/2
A
A= $args{'root'}
Truth table50%1/2
A
A= $Alien::Build::VERSION
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | runtime_prop => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | alien_build_version => $Alien::Build::VERSION || 'dev', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | plugin_instance_prop => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | bin_dir => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | pkg_config_path => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | aclocal_path => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # force computing this as soon as possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 417 | $self->download_rule; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | $self->meta->filename( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 417 | ▶ | $args{filename} || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$args{'filename'} || do {
my(undef, $filename) = caller;
_path($filename)->absolute->stringify
}
MC/DC0%0/2
$args{'filename'} || do {
my(undef, $filename) = caller;
_path($filename)->absolute->stringify
}
$args{'filename'}
do {
my(undef, $filename) = caller;
_path($filename)->absolute->stringify
}
Truth table66%2/3
A || B
A= $args{'filename'}B= do {
my(undef, $filename) = caller;
_path($filename)->absolute->stringify
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 18 | my(undef, $filename) = caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 18 | _path($filename)->absolute->stringify; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 417 | ▶ | if($args{meta_prop}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 21 | $self->meta->prop->{$_} = $args{meta_prop}->{$_} for keys %{ $args{meta_prop} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 417 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 62 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | sub load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 400 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=19 SCAR=29.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 400 | my(undef, $alienfile, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 400 | ▶ | my $rcfile = Path::Tiny->new($ENV{ALIEN_BUILD_RC} || '~/.alienbuild/rc.pl')->absolute; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'ALIEN_BUILD_RC'} || '~/.alienbuild/rc.pl'
MC/DC0%0/1
$ENV{'ALIEN_BUILD_RC'} || '~/.alienbuild/rc.pl'
$ENV{'ALIEN_BUILD_RC'}
Truth table50%1/2
A
A= $ENV{'ALIEN_BUILD_RC'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 400 | ▶ | if(-r $rcfile) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 20 | require Alien::Build::rc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | package Alien::Build::rc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 20 | require $rcfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 400 | ▶ | unless(-r $alienfile) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | Carp::croak "Unable to read alienfile: $alienfile"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 399 | my $file = _path $alienfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 399 | my $name = $file->parent->basename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 399 | $name =~ s/^alien-//i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 399 | $name =~ s/[^a-z]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 399 | ▶ | $name = 'x' if $name eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 399 | $name = ucfirst $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 399 | my $class = "Alien::Build::Auto::$name@{[ $count++ ]}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 62 | ▶ | { no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 399 | @{ "${class}::ISA" } = ('Alien::Build'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 399 | ▶ | *{ "${class}::Alienfile::meta" } = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1216 | $class =~ s{::Alienfile$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1216 | $class->meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 399 | }}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 399 | my @preload = qw( Core::Setup Core::Download Core::FFI Core::Override Core::CleanInstall ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 399 | push @preload, @Alien::Build::rc::PRELOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | push @preload, split /;/, $ENV{ALIEN_BUILD_PRELOAD} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 399 | ▶ | if defined $ENV{ALIEN_BUILD_PRELOAD}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 399 | my @postload = qw( Core::Legacy Core::Gather Core::Tail ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 399 | push @postload, @Alien::Build::rc::POSTLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | push @postload, split /;/, $ENV{ALIEN_BUILD_POSTLOAD} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 399 | ▶ | if defined $ENV{ALIEN_BUILD_POSTLOAD}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 399 | my $self = $class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | filename => $file->absolute->stringify, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | @args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 399 | require alienfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 399 | foreach my $preload (@preload) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 2018 | ▶ | ref $preload eq 'CODE' ? $preload->($self->meta) : $self->meta->apply_plugin($preload); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # TODO: do this without a string eval ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | ## no critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 399 | eval '# line '. __LINE__ . ' "' . __FILE__ . qq("\n) . qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | package ${class}::Alienfile; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 399 | do '@{[ $file->absolute->stringify ]}'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | die \$\@ if \$\@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 399 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ## use critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 382 | foreach my $postload (@postload) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1149 | ▶ | ref $postload eq 'CODE' ? $postload->($self->meta) : $self->meta->apply_plugin($postload); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 382 | $self->{args} = \@args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 382 | ▶ | unless(defined $self->meta->prop->{arch}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 380 | $self->meta->prop->{arch} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 382 | ▶ | unless(defined $self->meta->prop->{network}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 379 | $self->meta->prop->{network} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ## https://github.com/PerlAlien/Alien-Build/issues/23#issuecomment-341114414 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | #$self->meta->prop->{network} = 0 if $ENV{NO_NETWORK_TESTING}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 379 | ▶ | $self->meta->prop->{network} = 0 if (defined $ENV{ALIEN_INSTALL_NETWORK}) && ! $ENV{ALIEN_INSTALL_NETWORK}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ENV{"ALIEN_INSTALL_NETWORK"} and not $ENV{"ALIEN_INSTALL_NETWORK"}
MC/DC100%2/2
defined $ENV{"ALIEN_INSTALL_NETWORK"} and not $ENV{"ALIEN_INSTALL_NETWORK"}
defined $ENV{"ALIEN_INSTALL_NETWORK"}
not $ENV{"ALIEN_INSTALL_NETWORK"}
Truth table100%3/3
A and not(B)
A= defined $ENV{"ALIEN_INSTALL_NETWORK"}B= not $ENV{"ALIEN_INSTALL_NETWORK"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 382 | ▶ | unless(defined $self->meta->prop->{local_source}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 378 | ▶ | if(! defined $self->meta->prop->{start_url}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 304 | $self->meta->prop->{local_source} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # we assume URL schemes are at least two characters, that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # way Windows absolute paths can be used as local start_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | elsif($self->meta->prop->{start_url} =~ /^([a-z]{2,}):/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 52 | my $scheme = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 52 | $self->meta->prop->{local_source} = $scheme eq 'file'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 22 | $self->meta->prop->{local_source} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 382 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | sub resume | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 26 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resume: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 26 | my(undef, $alienfile, $root) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 26 | my $h = JSON::PP::decode_json(_path("$root/state.json")->slurp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 26 | my $self = Alien::Build->load("$alienfile", @{ $h->{args} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 26 | $self->{install_prop} = $h->{install}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 26 | $self->{plugin_instance_prop} = $h->{plugin_instance}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 26 | $self->{runtime_prop} = $h->{runtime}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 26 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | sub meta_prop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1468 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
meta_prop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1468 | my($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1468 | $class->meta->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | sub install_prop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 4677 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_prop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 4677 | shift->{install_prop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | sub plugin_instance_prop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plugin_instance_prop: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 10 | my($self, $plugin) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 10 | my $instance_id = $plugin->instance_id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 10 | ▶ | $self->{plugin_instance_prop}->{$instance_id} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"plugin_instance_prop"}{$instance_id} ||= {}
MC/DC100%1/1
$self->{"plugin_instance_prop"}{$instance_id} ||= {}
$self->{"plugin_instance_prop"}{$instance_id}
Truth table100%2/2
A
A= $self->{"plugin_instance_prop"}{$instance_id}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | sub runtime_prop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1258 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runtime_prop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1258 | shift->{runtime_prop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | sub hook_prop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 343 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hook_prop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 343 | shift->{hook_prop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | sub _command_prop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 82 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_command_prop: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 82 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 82 | alien => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | install => $self->install_prop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | runtime => $self->runtime_prop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | hook => $self->hook_prop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | meta => $self->meta_prop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | perl => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | config => \%Config::Config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | env => \%ENV, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | sub checkpoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 40 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkpoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 40 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 40 | my $root = $self->root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | _path("$root/state.json")->spew( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | JSON::PP->new->pretty->canonical(1)->ascii->encode({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | install => $self->install_prop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | runtime => $self->runtime_prop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | plugin_instance => $self->{plugin_instance_prop}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | args => $self->{args}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 40 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 40 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | sub root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 589 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
root: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 589 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 589 | my $root = $self->install_prop->{root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 589 | ▶ | _path($root)->mkpath unless -d $root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 589 | $root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | sub install_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 396 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_type: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 396 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 396 | ▶ | $self->{runtime_prop}->{install_type} ||= $self->probe; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"runtime_prop"}{"install_type"} ||= $self->probe
MC/DC0%0/2
$self->{"runtime_prop"}{"install_type"} ||= $self->probe
$self->{"runtime_prop"}{"install_type"}
$self->probe
Truth table66%2/3
A ||= B
A= $self->{"runtime_prop"}{"install_type"}B= $self->probe
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | sub is_system_install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_system_install: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $self->install_type eq 'system'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | sub is_share_install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_share_install: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $self->install_type eq 'share'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | sub download_rule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 1062 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
download_rule: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1062 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 1062 | ▶ | $self->install_prop->{download_rule} ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->install_prop->{"download_rule"} ||= do {
my $dr = $ENV{"ALIEN_DOWNLOAD_RULE"};
$dr = "warn" unless defined $dr;
$dr = "warn" if $dr eq "default";
unless ($dr =~ /^(warn|digest|encrypt|digest_or_encrypt|digest_and_encrypt)$/) {
$self->log(qq[unknown ALIEN_DOWNLOAD_RULE "$dr", using "warn" instead]);
$dr = "warn";
};
$dr
}
MC/DC0%0/2
$self->install_prop->{"download_rule"} ||= do {
my $dr = $ENV{"ALIEN_DOWNLOAD_RULE"};
$dr = "warn" unless defined $dr;
$dr = "warn" if $dr eq "default";
unless ($dr =~ /^(warn|digest|encrypt|digest_or_encrypt|digest_and_encrypt)$/) {
$self->log(qq[unknown ALIEN_DOWNLOAD_RULE "$dr", using "warn" instead]);
$dr = "warn";
};
$dr
}
$self->install_prop->{"download_rule"}
do {
my $dr = $ENV{"ALIEN_DOWNLOAD_RULE"};
$dr = "warn" unless defined $dr;
$dr = "warn" if $dr eq "default";
unless ($dr =~ /^(warn|digest|encrypt|digest_or_encrypt|digest_and_encrypt)$/) {
$self->log(qq[unknown ALIEN_DOWNLOAD_RULE "$dr", using "warn" instead]);
$dr = "warn";
};
$dr
}
Truth table66%2/3
A ||= B
A= $self->install_prop->{"download_rule"}B= do {
my $dr = $ENV{"ALIEN_DOWNLOAD_RULE"};
$dr = "warn" unless defined $dr;
$dr = "warn" if $dr eq "default";
unless ($dr =~ /^(warn|digest|encrypt|digest_or_encrypt|digest_and_encrypt)$/) {
$self->log(qq[unknown ALIEN_DOWNLOAD_RULE "$dr", using "warn" instead]);
$dr = "warn";
};
$dr
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 417 | my $dr = $ENV{ALIEN_DOWNLOAD_RULE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 417 | ▶ | $dr = 'warn' unless defined $dr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 417 | ▶ | $dr = 'warn' if $dr eq 'default'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 417 | ▶ | unless($dr =~ /^(warn|digest|encrypt|digest_or_encrypt|digest_and_encrypt)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 1 | $self->log("unknown ALIEN_DOWNLOAD_RULE \"$dr\", using \"warn\" instead"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | $dr = 'warn'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 417 | $dr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | sub set_prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 343 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_prefix: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 343 | my($self, $prefix) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 343 | ▶ | if($self->meta_prop->{destdir}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | $self->runtime_prop->{prefix} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 8 | $self->install_prop->{prefix} = $prefix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 335 | $self->runtime_prop->{prefix} = $prefix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 335 | $self->install_prop->{prefix} = $self->install_prop->{stage}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | sub set_stage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 348 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_stage: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 348 | my($self, $dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 348 | $self->install_prop->{stage} = $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | sub _merge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 228 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_merge: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 228 | my %h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 228 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 224 | my $mod = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 224 | my $ver = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 224 | ▶ | if((!defined $h{$mod}) || $ver > $h{$mod}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $h{$mod} or $ver > $h{$mod}
MC/DC100%2/2
not defined $h{$mod} or $ver > $h{$mod}
not defined $h{$mod}
$ver > $h{$mod}
Truth table100%3/3
not(A) or B
A= not defined $h{$mod}B= $ver > $h{$mod}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 222 | { $h{$mod} = $ver } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 228 | \%h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | sub requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 442 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
requires: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 442 | my($self, $phase) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 442 | ▶ | $phase ||= 'any'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$phase ||= "any"
MC/DC100%1/1
$phase ||= "any"
$phase
Truth table100%2/2
A
A= $phase
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 442 | my $meta = $self->meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | $phase =~ /^(?:any|configure)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | ? $meta->{require}->{$phase} || {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 442 | ▶ | : _merge %{ $meta->{require}->{any} }, %{ $meta->{require}->{$phase} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$meta->{"require"}{$phase} or {}
MC/DC100%1/1
$meta->{"require"}{$phase} or {}
$meta->{"require"}{$phase}
Truth table100%2/2
A
A= $meta->{"require"}{$phase}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | sub load_requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 376 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_requires: called CC=23 SCAR=32.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 376 | my($self, $phase, $eval) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 376 | my $reqs = $self->requires($phase); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 376 | foreach my $mod (keys %$reqs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 278 | my $ver = $reqs->{$mod}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 278 | ▶ | my $check = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 278 | my $pm = "$mod.pm"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 278 | $pm =~ s{::}{/}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 278 | require $pm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 278 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 278 | ▶ | if($eval) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 90 | eval { $check->() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 90 | ▶ | die "Required $mod @{[ $ver || 'undef' ]}, missing" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$ver || 'undef'
MC/DC100%1/1
$ver || 'undef'
$ver
Truth table100%2/2
A
A= $ver
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 188 | $check->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | # note Test::Alien::Build#alienfile_skip_if_missing_prereqs does a regex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # on this diagnostic, so if you change it here, change it there too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | die "Required $mod $ver, have @{[ $mod->VERSION || 0 ]}" if $ver && ! $mod->VERSION($ver); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$ver and not $mod->VERSION($ver)
$mod->VERSION || 0
MC/DC0%0/2
$ver and not $mod->VERSION($ver)
$ver
not $mod->VERSION($ver)
MC/DC0%0/1
$mod->VERSION || 0
$mod->VERSION
Truth table66%2/3
A and not(B)
A= $verB= not $mod->VERSION($ver)
Truth table0%0/2
A
A= $mod->VERSION
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # allow for requires on Alien::Build or Alien::Base | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 264 | ▶ | next if $mod eq 'Alien::Build'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 174 | ▶ | next if $mod eq 'Alien::Base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 173 | ▶ | if($mod->can('bin_dir')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 4 | push @{ $self->{bin_dir} }, $mod->bin_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 173 | ▶ | if(($mod->can('runtime_prop') && $mod->runtime_prop) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
$mod->can("runtime_prop") and $mod->runtime_prop or $mod->isa("Alien::Base") and $mod->install_type("share")
$mod->can("runtime_prop") and $mod->runtime_prop
$mod->isa("Alien::Base") and $mod->install_type("share")
MC/DC25%1/4
$mod->can("runtime_prop") and $mod->runtime_prop or $mod->isa("Alien::Base") and $mod->install_type("share")
$mod->can("runtime_prop")
$mod->runtime_prop
$mod->isa("Alien::Base")
$mod->install_type("share")
Truth table28%2/7
A and B or C and D
A= $mod->can("runtime_prop")B= $mod->runtime_propC= $mod->isa("Alien::Base")D= $mod->install_type("share")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | || ($mod->isa('Alien::Base') && $mod->install_type('share'))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 4 | for my $dir (qw(lib share)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 8 | my $path = _path($mod->dist_dir)->child("$dir/pkgconfig"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 8 | ▶ | if(-d $path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 2 | push @{ $self->{pkg_config_path} }, $path->stringify; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 4 | my $path = _path($mod->dist_dir)->child('share/aclocal'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 4 | ▶ | if(-d $path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 2 | $path = "$path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 2 | ▶ | if($^O eq 'MSWin32') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # convert to MSYS path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $path =~ s{^([a-z]):}{/$1/}i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 2 | push @{ $self->{aclocal_path} }, $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # sufficiently new Autotools have a aclocal_dir which will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | # give us the directories we need. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 173 | ▶ | if($mod eq 'Alien::Autotools' && $mod->can('aclocal_dir')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mod eq "Alien::Autotools" and $mod->can("aclocal_dir")
MC/DC0%0/2
$mod eq "Alien::Autotools" and $mod->can("aclocal_dir")
$mod eq "Alien::Autotools"
$mod->can("aclocal_dir")
Truth table33%1/3
A and B
A= $mod eq "Alien::Autotools"B= $mod->can("aclocal_dir")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | push @{ $self->{aclocal_path} }, $mod->aclocal_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 173 | ▶ | if($mod->can('alien_helper')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 4 | my $helpers = $mod->alien_helper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 4 | foreach my $name (sort keys %$helpers) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 6 | my $code = $helpers->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 6 | $self->meta->interpolator->replace_helper($name => $code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 362 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | sub _call_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 893 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_call_hook: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 893 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 893 | local $ENV{PATH} = $ENV{PATH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 893 | unshift @PATH, @{ $self->{bin_dir} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 893 | local $ENV{PKG_CONFIG_PATH} = $ENV{PKG_CONFIG_PATH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 893 | unshift @PKG_CONFIG_PATH, @{ $self->{pkg_config_path} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 893 | local $ENV{ACLOCAL_PATH} = $ENV{ACLOCAL_PATH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # autoconf uses MSYS paths, even for the ACLOCAL_PATH environment variable, so we can't use Env for this. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 893 | my @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 893 | ▶ | @path = split /:/, $ENV{ACLOCAL_PATH} if defined $ENV{ACLOCAL_PATH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 893 | unshift @path, @{ $self->{aclocal_path} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 893 | $ENV{ACLOCAL_PATH} = join ':', @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 893 | ▶ | my $config = ref($_[0]) eq 'HASH' ? shift : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 893 | my($name, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 893 | local $self->{hook_prop} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 893 | $self->meta->call_hook( $config, $name => $self, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | sub probe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 189 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
probe: called CC=12 SCAR=24.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 189 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 189 | local $CWD = $self->root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 189 | my $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 189 | my $env = $self->_call_hook('override'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 189 | my $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | my $error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 189 | ▶ | $env = '' if $env eq 'default'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 189 | ▶ | if($env eq 'share') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 3 | $type = 'share'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 186 | $type = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | $self->_call_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 188 | ▶ | before => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 188 | $dir = Alien::Build::TempDir->new($self, "probe"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 188 | $CWD = "$dir"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 188 | ▶ | after => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 188 | $CWD = $self->root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | ok => 'system', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 167 | ▶ | continue => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 167 | ▶ | if($_[0] eq 'system') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 51 | foreach my $name (qw( probe_class probe_instance_id )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 102 | ▶ | if(exists $self->hook_prop->{$name} && defined $self->hook_prop->{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $self->hook_prop->{$name} and defined $self->hook_prop->{$name}
MC/DC50%1/2
exists $self->hook_prop->{$name} and defined $self->hook_prop->{$name}
exists $self->hook_prop->{$name}
defined $self->hook_prop->{$name}
Truth table66%2/3
A and B
A= exists $self->hook_prop->{$name}B= defined $self->hook_prop->{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 30 | $self->install_prop->{"system_$name"} = $self->hook_prop->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 51 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 116 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 186 | 'probe', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 186 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 186 | ▶ | $type = 'share' unless defined $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 189 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 28 | ▶ | if($env eq 'system') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 27 | $self->log("error in probe (will do a share install): $@"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 27 | $self->log("Don't panic, we will attempt a share build from source if possible."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 27 | $self->log("Do not file a bug unless you expected a system install to succeed."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 27 | $type = 'share'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 188 | ▶ | if($env && $env ne $type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$env and $env ne $type
MC/DC100%2/2
$env and $env ne $type
$env
$env ne $type
Truth table100%3/3
A and B
A= $envB= $env ne $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | die "requested $env install not available"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 187 | ▶ | if($type !~ /^(system|share)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | Carp::croak "probe hook returned something other than system or share: $type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 187 | ▶ | if($type eq 'share' && (!$self->meta_prop->{network}) && (!$self->meta_prop->{local_source})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$type eq "share" and not $self->meta_prop->{"network"} and not $self->meta_prop->{"local_source"}
$type eq "share" and not $self->meta_prop->{"network"}
MC/DC66%2/3
$type eq "share" and not $self->meta_prop->{"network"} and not $self->meta_prop->{"local_source"}
$type eq "share"
not $self->meta_prop->{"network"}
not $self->meta_prop->{"local_source"}
Truth table75%3/4
A and not(B) and not(C)
A= $type eq "share"B= not $self->meta_prop->{"network"}C= not $self->meta_prop->{"local_source"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | $self->log("install type share requested or detected, but network fetch is turned off"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 1 | $self->log("see https://metacpan.org/pod/Alien::Build::Manual::FAQ#Network-fetch-is-turned-off"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 1 | Carp::croak "network fetch is turned off"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 186 | $self->runtime_prop->{install_type} = $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 186 | $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | sub download | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 115 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
download: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 115 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 115 | ▶ | return $self unless $self->install_type eq 'share'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 105 | ▶ | return $self if $self->install_prop->{complete}->{download}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 89 | ▶ | if($self->meta->has_hook('download')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 44 | my $tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 44 | local $CWD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 44 | my $valid = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | $self->_call_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 44 | ▶ | before => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 44 | $tmp = Alien::Build::TempDir->new($self, "download"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 44 | $CWD = "$tmp"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 43 | ▶ | verify => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 43 | my @list = grep { $_->basename !~ /^\./, } _path('.')->children; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 43 | my $count = scalar @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 43 | ▶ | if($count == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 2 | die "no files downloaded"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | elsif($count == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 40 | my($archive) = $list[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 40 | ▶ | if(-d $archive) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # TODO: this is probably a bug that we don't set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # download or compelte properties? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $self->log("single dir, assuming directory"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 40 | $self->log("single file, assuming archive"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 40 | $self->install_prop->{download} = $archive->absolute->stringify; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 40 | $self->install_prop->{complete}->{download} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 40 | $valid = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 1 | $self->log("multiple files, assuming directory"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 1 | $self->install_prop->{complete}->{download} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 1 | $self->install_prop->{download} = _path('.')->absolute->stringify; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 1 | $valid = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 44 | ▶ | after => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 44 | $CWD = $self->root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 44 | 'download', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # experimental and undocumented for now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 41 | ▶ | if($self->meta->has_hook('check_download')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 36 | $self->meta->call_hook(check_download => $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 39 | ▶ | return $self if $valid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | # This will call the default download hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # defined in Core::Download since the recipe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | # does not provide a download hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 45 | my $ret = $self->_call_hook('download'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | # experimental and undocumented for now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 41 | ▶ | if($self->meta->has_hook('check_download')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 15 | $self->meta->call_hook(check_download => $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 41 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | die "download failed"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | sub fetch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 81 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch: called CC=13 SCAR=26.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 81 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 81 | ▶ | my $url = $_[0] || $self->meta_prop->{start_url}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_[0] || $self->meta_prop->{'start_url'}
MC/DC0%0/2
$_[0] || $self->meta_prop->{'start_url'}
$_[0]
$self->meta_prop->{'start_url'}
Truth table66%2/3
A || B
A= $_[0]B= $self->meta_prop->{'start_url'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 81 | my $secure = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 81 | ▶ | if(defined $url && ($url =~ /^(https|file):/ || $url !~ /:/)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition83%5/6
defined $url and $url =~ /^(https|file):/ || !($url =~ /:/)
$url =~ /^(https|file):/ or not $url =~ /:/
MC/DC66%2/3
defined $url and $url =~ /^(https|file):/ || !($url =~ /:/)
defined $url
$url =~ /^(https|file):/
not $url =~ /:/
Truth table75%3/4
A and B or not(C)
A= defined $urlB= $url =~ /^(https|file):/C= not $url =~ /:/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | # considered secure when either https or a local file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 67 | $secure = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | elsif(!defined $url) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | $self->log("warning: undefined url in fetch"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 14 | $self->log("warning: attempting to fetch a non-TLS or bundled URL: @{[ $url ]}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 81 | ▶ | die "insecure fetch is not allowed" if $self->download_rule =~ /^(encrypt|digest_and_encrypt)$/ && !$secure; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->download_rule =~ /^(encrypt|digest_and_encrypt)$/ and not $secure
MC/DC100%2/2
$self->download_rule =~ /^(encrypt|digest_and_encrypt)$/ and not $secure
$self->download_rule =~ /^(encrypt|digest_and_encrypt)$/
not $secure
Truth table100%3/3
A and not(B)
A= $self->download_rule =~ /^(encrypt|digest_and_encrypt)$/B= not $secure
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 78 | my $file = $self->_call_hook( 'fetch' => @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 72 | $secure = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 72 | ▶ | if(ref($file) ne 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | $self->log("warning: fetch returned non-hash reference"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | elsif(!defined $file->{protocol}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | $self->log("warning: fetch did not return a protocol"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | elsif($file->{protocol} !~ /^(https|file)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 11 | $self->log("warning: fetch did not use a secure protocol: @{[ $file->{protocol} ]}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 61 | $secure = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 72 | ▶ | die "insecure fetch is not allowed" if $self->download_rule =~ /^(encrypt|digest_and_encrypt)$/ && !$secure; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->download_rule =~ /^(encrypt|digest_and_encrypt)$/ and not $secure
MC/DC100%2/2
$self->download_rule =~ /^(encrypt|digest_and_encrypt)$/ and not $secure
$self->download_rule =~ /^(encrypt|digest_and_encrypt)$/
not $secure
Truth table100%3/3
A and not(B)
A= $self->download_rule =~ /^(encrypt|digest_and_encrypt)$/B= not $secure
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 71 | $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | sub check_digest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 100 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_digest: called CC=15 SCAR=27.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 100 | my($self, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 100 | ▶ | return '' unless $self->meta_prop->{check_digest}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 67 | ▶ | unless(ref($file) eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 36 | my $path = Path::Tiny->new($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 36 | $file = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | type => 'file', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | filename => $path->basename, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | path => "$path", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | tmp => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 67 | my $path = $file->{path}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 67 | ▶ | if(defined $path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | # there is technically a race condition here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 51 | ▶ | die "Missing file in digest check: @{[ $file->{filename} ]}" unless -f $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | die "Unreadable file in digest check: @{[ $file->{filename} ]}" unless -r $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 16 | ▶ | die "File is wrong type" unless defined $file->{type} && $file->{type} eq 'file'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $file->{"type"} and $file->{"type"} eq "file"
MC/DC100%2/2
defined $file->{"type"} and $file->{"type"} eq "file"
defined $file->{"type"}
$file->{"type"} eq "file"
Truth table100%3/3
A and B
A= defined $file->{"type"}B= $file->{"type"} eq "file"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 14 | ▶ | die "File has no filename" unless defined $file->{filename}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 13 | ▶ | die "@{[ $file->{filename} ]} has no content" unless defined $file->{content}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 60 | my $filename = $file->{filename}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 60 | ▶ | my $signature = $self->meta_prop->{digest}->{$filename} || $self->meta_prop->{digest}->{'*'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->meta_prop->{'digest'}{$filename} || $self->meta_prop->{'digest'}{'*'}
MC/DC100%2/2
$self->meta_prop->{'digest'}{$filename} || $self->meta_prop->{'digest'}{'*'}
$self->meta_prop->{'digest'}{$filename}
$self->meta_prop->{'digest'}{'*'}
Truth table100%3/3
A || B
A= $self->meta_prop->{'digest'}{$filename}B= $self->meta_prop->{'digest'}{'*'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 60 | ▶ | die "No digest for $filename" unless defined $signature && ref $signature eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $signature and ref $signature eq "ARRAY"
MC/DC50%1/2
defined $signature and ref $signature eq "ARRAY"
defined $signature
ref $signature eq "ARRAY"
Truth table66%2/3
A and B
A= defined $signatureB= ref $signature eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 56 | my($algo, $expected) = @$signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 56 | ▶ | if($self->meta->call_hook( check_digest => $self, $file, $algo, $expected )) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | # record the verification here so that we can check in the extract step that the signature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | # was checked. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 41 | ▶ | $self->install_prop->{download_detail}->{$path}->{digest} = [$algo, $expected] if defined $path; return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 4 | die "No plugin provides digest algorithm for $algo"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | sub decode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 14 | my($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 14 | my $res2 = $self->_call_hook( decode => $res ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | $res2->{protocol} = $res->{protocol} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | if !defined $res2->{protocol} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 14 | ▶ | && defined $res->{protocol}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $res2->{"protocol"} and defined $res->{"protocol"}
MC/DC100%2/2
not defined $res2->{"protocol"} and defined $res->{"protocol"}
not defined $res2->{"protocol"}
defined $res->{"protocol"}
Truth table100%3/3
not(A) and B
A= not defined $res2->{"protocol"}B= defined $res->{"protocol"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 14 | return $res2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | sub prefer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 19 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prefer: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 19 | my($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 19 | my $res2 = $self->_call_hook( prefer => $res ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | $res2->{protocol} = $res->{protocol} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | if !defined $res2->{protocol} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 19 | ▶ | && defined $res->{protocol}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $res2->{"protocol"} and defined $res->{"protocol"}
MC/DC50%1/2
not defined $res2->{"protocol"} and defined $res->{"protocol"}
not defined $res2->{"protocol"}
defined $res->{"protocol"}
Truth table66%2/3
not(A) and B
A= not defined $res2->{"protocol"}B= defined $res->{"protocol"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 19 | return $res2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | sub extract | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 99 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract: called CC=29 SCAR=34.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 99 | my($self, $archive) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 99 | ▶ | $archive ||= $self->install_prop->{download}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$archive ||= $self->install_prop->{"download"}
MC/DC0%0/2
$archive ||= $self->install_prop->{"download"}
$archive
$self->install_prop->{"download"}
Truth table66%2/3
A ||= B
A= $archiveB= $self->install_prop->{"download"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 99 | ▶ | unless(defined $archive) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | die "tried to call extract before download"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 99 | my $checked_digest = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 99 | my $encrypted_fetch = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 99 | my $detail = $self->install_prop->{download_detail}->{$archive}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 99 | ▶ | if(defined $detail) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 97 | ▶ | if(defined $detail->{digest}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 83 | my($algo, $expected) = @{ $detail->{digest} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 83 | my $file = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | type => 'file', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | filename => Path::Tiny->new($archive)->basename, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | path => $archive, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | tmp => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 83 | $checked_digest = $self->meta->call_hook( check_digest => $self, $file, $algo, $expected ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 97 | ▶ | if(!defined $detail->{protocol}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | $self->log("warning: extract did not receive protocol details for $archive") unless $checked_digest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | elsif($detail->{protocol} !~ /^(https|file)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 4 | ▶ | $self->log("warning: extracting from a file that was fetched via insecure protocol @{[ $detail->{protocol} ]}") unless $checked_digest ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 93 | $encrypted_fetch = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 2 | $self->log("warning: extract received no download details for $archive"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 99 | ▶ | if($self->download_rule eq 'digest') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 2 | ▶ | die "required digest missing for $archive" unless $checked_digest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | elsif($self->download_rule eq 'encrypt') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 1 | ▶ | die "file was fetched insecurely for $archive" unless $encrypted_fetch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | elsif($self->download_rule eq 'digest_or_encrypt') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 4 | ▶ | die "file was fetched insecurely and required digest missing for $archive" unless $checked_digest || $encrypted_fetch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$checked_digest or $encrypted_fetch
MC/DC100%2/2
$checked_digest or $encrypted_fetch
$checked_digest
$encrypted_fetch
Truth table100%3/3
A or B
A= $checked_digestB= $encrypted_fetch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | elsif($self->download_rule eq 'digest_and_encrypt') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 2 | ▶ | die "file was fetched insecurely and required digest missing for $archive" unless $checked_digest || $encrypted_fetch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$checked_digest or $encrypted_fetch
MC/DC0%0/2
$checked_digest or $encrypted_fetch
$checked_digest
$encrypted_fetch
Truth table66%2/3
A or B
A= $checked_digestB= $encrypted_fetch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 2 | ▶ | die "required digest missing for $archive" unless $checked_digest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 1 | ▶ | die "file was fetched insecurely for $archive" unless $encrypted_fetch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | elsif($self->download_rule eq 'warn') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 90 | ▶ | unless($checked_digest || $encrypted_fetch) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$checked_digest or $encrypted_fetch
MC/DC100%2/2
$checked_digest or $encrypted_fetch
$checked_digest
$encrypted_fetch
Truth table100%3/3
A or B
A= $checked_digestB= $encrypted_fetch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 3 | $self->log("!!! NOTICE OF FUTURE CHANGE IN BEHAVIOR !!!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 3 | $self->log("a future version of Alien::Build will die here by default with this exception: file was fetched insecurely and required digest missing for $archive"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 3 | $self->log("!!! NOTICE OF FUTURE CHANGE IN BEHAVIOR !!!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | die "internal error, unknown download rule: @{[ $self->download_rule ]}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 96 | my $nick_name = 'build'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 96 | ▶ | if($self->meta_prop->{out_of_source}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 8 | $nick_name = 'extract'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 8 | my $extract = $self->install_prop->{extract}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 8 | ▶ | return $extract if defined $extract && -d $extract; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $extract and -d $extract
MC/DC50%1/2
defined $extract and -d $extract
defined $extract
-d $extract
Truth table66%2/3
A and B
A= defined $extractB= -d $extract
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 92 | my $tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 92 | local $CWD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 92 | my $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | $self->_call_hook({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 92 | ▶ | before => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | # called build instead of extract, because this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | # will be used for the build step, and technically | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | # extract is a substage of build anyway. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 92 | $tmp = Alien::Build::TempDir->new($self, $nick_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 92 | $CWD = "$tmp"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 92 | ▶ | verify => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 92 | my $path = '.'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 92 | ▶ | if($self->meta_prop->{out_of_source} && $self->install_prop->{extract}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->meta_prop->{"out_of_source"} and $self->install_prop->{"extract"}
MC/DC100%2/2
$self->meta_prop->{"out_of_source"} and $self->install_prop->{"extract"}
$self->meta_prop->{"out_of_source"}
$self->install_prop->{"extract"}
Truth table100%3/3
A and B
A= $self->meta_prop->{"out_of_source"}B= $self->install_prop->{"extract"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 2 | $path = $self->install_prop->{extract}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 92 | ▶ | my @list = grep { $_->basename !~ /^\./ && $_->basename ne 'pax_global_header' } _path($path)->children; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
!($_->basename =~ /^\./) && $_->basename ne 'pax_global_header'
MC/DC0%0/2
!($_->basename =~ /^\./) && $_->basename ne 'pax_global_header'
!($_->basename =~ /^\./)
$_->basename ne 'pax_global_header'
Truth table33%1/3
not(A) && B
A= !($_->basename =~ /^\./)B= $_->basename ne 'pax_global_header'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 92 | my $count = scalar @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 92 | ▶ | if($count == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 1 | die "no files extracted"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | ▶ | elsif($count == 1 && -d $list[0]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$count == 1 and -d $list[0]
MC/DC100%2/2
$count == 1 and -d $list[0]
$count == 1
-d $list[0]
Truth table100%3/3
A and B
A= $count == 1B= -d $list[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 64 | $ret = $list[0]->absolute->stringify; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 27 | $ret = "$tmp"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 92 | ▶ | after => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 92 | $CWD = $self->root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 92 | }, 'extract', $archive); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 91 | ▶ | $self->install_prop->{extract} ||= $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->install_prop->{"extract"} ||= $ret
MC/DC0%0/2
$self->install_prop->{"extract"} ||= $ret
$self->install_prop->{"extract"}
$ret
Truth table66%2/3
A ||= B
A= $self->install_prop->{"extract"}B= $ret
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 91 | ▶ | $ret ? $ret : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | sub build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 44 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=11 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 44 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | # save the evironment, in case some plugins decide | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | # to alter it. Or us! See just a few lines below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 44 | local %ENV = %ENV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 44 | my $stage = _path($self->install_prop->{stage}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 44 | $stage->mkpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 44 | my $tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 44 | ▶ | if($self->install_type eq 'share') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 32 | foreach my $suffix ('', '_ffi') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 64 | local $CWD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 64 | ▶ | delete $ENV{DESTDIR} unless $self->meta_prop->{destdir}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 64 | ▶ | my %env_meta = %{ $self->meta_prop ->{env} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->meta_prop->{'env'} || {}
MC/DC100%1/1
$self->meta_prop->{'env'} || {}
$self->meta_prop->{'env'}
Truth table100%2/2
A
A= $self->meta_prop->{'env'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 64 | ▶ | my %env_inst = %{ $self->install_prop->{env} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->install_prop->{'env'} || {}
MC/DC100%1/1
$self->install_prop->{'env'} || {}
$self->install_prop->{'env'}
Truth table100%2/2
A
A= $self->install_prop->{'env'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 64 | ▶ | if($self->meta_prop->{env_interpolate}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 2 | foreach my $key (keys %env_meta) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 4 | $env_meta{$key} = $self->meta->interpolator->interpolate($env_meta{$key}, $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 64 | %ENV = (%ENV, %env_meta); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 64 | %ENV = (%ENV, %env_inst); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 64 | my $destdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | $self->_call_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 64 | ▶ | before => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 64 | ▶ | if($self->meta_prop->{out_of_source}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 8 | $self->extract; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 8 | $CWD = $tmp = Alien::Build::TempDir->new($self, 'build'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 56 | $CWD = $tmp = $self->extract; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 64 | ▶ | if($self->meta_prop->{destdir}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 16 | $destdir = Alien::Build::TempDir->new($self, 'destdir'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 16 | $ENV{DESTDIR} = "$destdir"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 64 | $self->_call_hook({ all => 1 }, "patch${suffix}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 64 | ▶ | after => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 64 | ▶ | $destdir = "$destdir" if $destdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 64 | }, "build${suffix}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 64 | ▶ | $self->install_prop->{"_ab_build@{[ $suffix || '_share' ]}"} = "$CWD"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$suffix || '_share'
MC/DC100%1/1
$suffix || '_share'
$suffix
Truth table100%2/2
A
A= $suffix
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 64 | ▶ | $self->_call_hook("gather@{[ $suffix || '_share' ]}"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$suffix || '_share'
MC/DC100%1/1
$suffix || '_share'
$suffix
Truth table100%2/2
A
A= $suffix
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | elsif($self->install_type eq 'system') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 12 | local $CWD = $self->root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 12 | my $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | $self->_call_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 12 | ▶ | before => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 12 | $dir = Alien::Build::TempDir->new($self, "gather"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 12 | $CWD = "$dir"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 12 | ▶ | after => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 12 | $CWD = $self->root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 12 | 'gather_system', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 12 | $self->install_prop->{finished} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 12 | $self->install_prop->{complete}->{gather_system} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 44 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | sub test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test: called CC=7 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 6 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 6 | ▶ | if($self->install_type eq 'share') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 4 | foreach my $suffix ('_share', '_ffi') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 7 | ▶ | if($self->meta->has_hook("test$suffix")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 4 | my $dir = $self->install_prop->{"_ab_build$suffix"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 4 | ▶ | Carp::croak("no build directory to run tests") unless $dir && -d $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dir and -d $dir
MC/DC0%0/2
$dir and -d $dir
$dir
-d $dir
Truth table33%1/3
A and B
A= $dirB= -d $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 4 | local $CWD = $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 4 | $self->_call_hook("test$suffix"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 2 | ▶ | if($self->meta->has_hook("test_system")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 2 | my $dir = Alien::Build::TempDir->new($self, "test"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 2 | local $CWD = "$dir"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 2 | $self->_call_hook("test_system"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | sub clean_install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clean_install: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 3 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 3 | $self->_call_hook("clean_install"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | sub system | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 2 | my($self, $command, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 2 | my $prop = $self->_command_prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | ($command, @args) = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 2 | $self->meta->interpolator->interpolate($_, $prop) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } ($command, @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 2 | $self->log("+ $command @args"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | scalar @args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 2 | ▶ | ? system $command, @args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | : system $command; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | sub log | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 579 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
log: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 579 | my(undef, $message) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 579 | my $caller = [caller]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 579 | chomp $message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 579 | foreach my $line (split /\n/, $message) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 595 | Alien::Build::Log->default->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | caller => $caller, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | message => $line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 62 | my %meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | sub meta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 11129 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
meta: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 11129 | my($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 11129 | ▶ | $class = ref $class if ref $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 11129 | ▶ | $meta{$class} ||= Alien::Build::Meta->new( class => $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$meta{$class} ||= "Alien::Build::Meta"->new("class", $class)
MC/DC0%0/2
$meta{$class} ||= "Alien::Build::Meta"->new("class", $class)
$meta{$class}
"Alien::Build::Meta"->new("class", $class)
Truth table66%2/3
A ||= B
A= $meta{$class}B= "Alien::Build::Meta"->new("class", $class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 62 | package Alien::Build::Meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 62 | our @CARP_NOT = qw( alienfile ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 406 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 406 | my($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 406 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | phase => 'any', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | build_suffix => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | require => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | any => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | share => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | system => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | around => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | prop => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | %args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 406 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | sub prop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 6170 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prop: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 6170 | shift->{prop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | sub filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 637 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filename: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 637 | my($self, $new) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 637 | ▶ | $self->{filename} = $new if defined $new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 637 | $self->{filename}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | sub add_requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 585 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_requires: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 585 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 585 | my $phase = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 585 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 398 | my $module = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 398 | my $version = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 398 | my $old = $self->{require}->{$phase}->{$module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 398 | ▶ | if((!defined $old) || $version > $old) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $old or $version > $old
MC/DC100%2/2
not defined $old or $version > $old
not defined $old
$version > $old
Truth table100%3/3
not(A) or B
A= not defined $oldB= $version > $old
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 373 | { $self->{require}->{$phase}->{$module} = $version } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 585 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | sub has_requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_requires: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | my $phase = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | my @has = keys %{ $self->{require}->{$phase} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | my $pattern = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | for (@has) { return 1 if index($_, $pattern) != -1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | sub interpolator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 132 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
interpolator: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 132 | my($self, $new) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 132 | ▶ | if(defined $new) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 2 | ▶ | if(defined $self->{intr}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | Carp::croak "tried to set interpolator twice"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 2 | ▶ | if(ref $new) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 2 | $self->{intr} = $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | $self->{intr} = $new->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | elsif(!defined $self->{intr}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 52 | require Alien::Build::Interpolate::Default; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 52 | $self->{intr} = Alien::Build::Interpolate::Default->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 132 | $self->{intr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | sub has_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 202 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_hook: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 202 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 202 | defined $self->{hook}->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | sub _instr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 3680 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_instr: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 3680 | my($self, $name, $instr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 3680 | ▶ | if(ref($instr) eq 'CODE') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 3622 | return $instr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | elsif(ref($instr) eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 58 | my %phase = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | download => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | fetch => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | decode => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | prefer => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | extract => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | patch => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | patch_ffi => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | build => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | build_ffi => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | stage => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | gather_ffi => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | gather_share => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | gather_system => 'system', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | test_ffi => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | test_share => 'share', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | test_system => 'system', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 58 | require Alien::Build::CommandSequence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 58 | my $seq = Alien::Build::CommandSequence->new(@$instr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 58 | ▶ | $seq->apply_requirements($self, $phase{$name} || 'any'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$phase{$name} || 'any'
MC/DC100%1/1
$phase{$name} || 'any'
$phase{$name}
Truth table100%2/2
A
A= $phase{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 58 | return $seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | Carp::croak "type not supported as a hook"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | sub register_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 912 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_hook: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 912 | my($self, $name, $instr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 912 | push @{ $self->{hook}->{$name} }, _instr $self, $name, $instr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 912 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | sub default_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 2768 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_hook: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 2768 | my($self, $name, $instr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 2768 | $self->{default_hook}->{$name} = _instr $self, $name, $instr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 2768 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | sub around_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 2762 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
around_hook: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 2762 | my($self, $name, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 2762 | ▶ | if(my $old = $self->{around}->{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | # this is the craziest shit I have ever | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | # come up with. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 116 | ▶ | $self->{around}->{$name} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 116 | my $orig = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 116 | ▶ | $code->(sub { $old->($orig, @_) }, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 1559 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 1203 | $self->{around}->{$name} = $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | sub after_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 1552 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_hook: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 1552 | my($self, $name, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | $self->around_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 92 | ▶ | $name => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 92 | my $orig = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 92 | my $ret = $orig->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 92 | $code->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 92 | $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 1552 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | sub before_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_hook: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 17 | my($self, $name, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | $self->around_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 2 | ▶ | $name => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 2 | my $orig = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 2 | $code->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 2 | my $ret = $orig->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 2 | $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 17 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | sub call_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 1091 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call_hook: called CC=20 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 1091 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 1091 | ▶ | my %args = ref $_[0] ? %{ shift() } : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 1091 | my($name, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 1091 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 1091 | ▶ | my @hooks = @{ $self->{hook}->{$name} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'hook'}{$name} || []
MC/DC100%1/1
$self->{'hook'}{$name} || []
$self->{'hook'}{$name}
Truth table100%2/2
A
A= $self->{'hook'}{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | 1091 | ▶ | if(@hooks == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 389 | ▶ | if(defined $self->{default_hook}->{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 318 | @hooks = ($self->{default_hook}->{$name}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | elsif(!$args{all}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 11 | Carp::croak "No hooks registered for $name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 1080 | my $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 1080 | foreach my $hook (@hooks) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 1035 | ▶ | if(eval { $args[0]->isa('Alien::Build') }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 1035 | %{ $args[0]->{hook_prop} } = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 1035 | ▶ | my $wrapper = $self->{around}->{$name} || sub { my $code = shift; $code->(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Condition66%2/3
$self->{'around'}{$name} || sub {
my $code = shift();
&$code(@_);
}
MC/DC0%0/2
$self->{'around'}{$name} || sub {
my $code = shift();
&$code(@_);
}
$self->{'around'}{$name}
sub {
my $code = shift();
&$code(@_);
}
Truth table66%2/3
A || B
A= $self->{'around'}{$name}B= sub {
my $code = shift();
&$code(@_);
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 1035 | my $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 1035 | ▶ | $args{before}->() if $args{before}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 1035 | ▶ | if(ref($hook) eq 'CODE') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 1022 | $value = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 1022 | ▶ | my $value = $wrapper->(sub { $hook->(@_) }, @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 971 | ▶ | $args{verify}->('code') if $args{verify}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 969 | $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 13 | ▶ | $value = $wrapper->(sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | 13 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 13 | $hook->execute(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 10 | ▶ | $args{verify}->('command') if $args{verify}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 13 | ▶ | defined $args{ok} ? $args{ok} : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 13 | }, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 1035 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 1035 | ▶ | $args{after}->() if $args{after}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 1035 | ▶ | if($args{all}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 5 | ▶ | die if $error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 1030 | ▶ | next if $error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 973 | ▶ | next if $args{continue} && $args{continue}->($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$args{"continue"} and $args{"continue"}->($value)
MC/DC100%2/2
$args{"continue"} and $args{"continue"}->($value)
$args{"continue"}
$args{"continue"}->($value)
Truth table100%3/3
A and B
A= $args{"continue"}B= $args{"continue"}->($value)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 857 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 223 | ▶ | die $error if $error && ! $args{all}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$error and not $args{"all"}
MC/DC50%1/2
$error and not $args{"all"}
$error
not $args{"all"}
Truth table66%2/3
A and not(B)
A= $errorB= not $args{"all"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 171 | $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | sub apply_plugin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 3482 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_plugin: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 3482 | my($self, $name, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 3482 | my $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | my $pm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 3482 | my $found; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 3482 | ▶ | if($name =~ /^=(.*)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 1 | $class = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 1 | $pm = "$class.pm"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 1 | $pm =~ s!::!/!g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 1 | $found = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 3482 | ▶ | if($name !~ /::/ && !$found) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$name =~ /::/ or $found
MC/DC50%1/2
$name =~ /::/ or $found
$name =~ /::/
$found
Truth table66%2/3
A or B
A= $name =~ /::/B= $found
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | 47 | foreach my $inc (@INC) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | # TODO: allow negotiators to work with @INC hooks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 137 | ▶ | next if ref $inc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 137 | my $file = Path::Tiny->new("$inc/Alien/Build/Plugin/$name/Negotiate.pm"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | 137 | ▶ | if(-r $file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 43 | $class = "Alien::Build::Plugin::${name}::Negotiate"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 43 | $pm = "Alien/Build/Plugin/$name/Negotiate.pm"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 43 | $found = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 43 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 3482 | ▶ | unless($found) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 3438 | $class = "Alien::Build::Plugin::$name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | 3438 | $pm = "Alien/Build/Plugin/$name.pm"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 3438 | $pm =~ s{::}{/}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 3482 | ▶ | require $pm unless $class->can('new'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 3482 | my $plugin = $class->new(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 3480 | $plugin->init($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | 3480 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | package Alien::Build::TempDir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | # TODO: it's confusing that there is both a AB::TempDir and AB::Temp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | # although they do different things. there could maybe be a better | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | # name for AB::TempDir (maybe AB::TempBuildDir, though that is a little | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | # redundant). Happily both are private classes, and either are able to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | # rename, if a good name can be thought of. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 62 | ▶ | use overload '""' => sub { shift->as_string }, bool => sub { 1 }, fallback => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 62 | ▶ | use File::Temp qw( tempdir ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 394 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 394 | my($class, $build, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 394 | my $root = $build->install_prop->{root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 394 | ▶ | Path::Tiny->new($root)->mkpath unless -d $root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 394 | bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | dir => Path::Tiny->new(tempdir( "${name}_XXXX", DIR => $root)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | sub as_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 441 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | 441 | shift->{dir}->stringify; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | sub DESTROY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 394 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 394 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 394 | ▶ | if(-d $self->{dir} && $self->{dir}->children == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-d $self->{"dir"} and $self->{"dir"}->children == 0
MC/DC50%1/2
-d $self->{"dir"} and $self->{"dir"}->children == 0
-d $self->{"dir"}
$self->{"dir"}->children == 0
Truth table66%2/3
A and B
A= -d $self->{"dir"}B= $self->{"dir"}->children == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | ▶ | rmdir($self->{dir}) || warn "unable to remove @{[ $self->{dir} ]} $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 62 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||