| 1 | package CPAN::Maker; | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | # a CPAN distribution creation utility | ||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use CPAN::Maker::Constants qw( :all ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use CPAN::Maker::Utils; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use CLI::Simple::Constants qw(:booleans :chars); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use CLI::Simple::Utils qw(choose slurp); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Cwd qw(getcwd); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use English qw( -no_match_vars ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use ExtUtils::MM; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use File::Basename qw(basename fileparse); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use File::Process qw( process_file filter ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use File::Temp qw( tempfile tempdir ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use File::Copy qw(cp); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use File::Path qw(make_path); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use IPC::Open3; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Symbol qw(gensym); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use File::ShareDir qw(dist_dir dist_file); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use JSON qw( encode_json decode_json ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use List::Util qw( pairs uniq none); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use Log::Log4perl::Level; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use Scalar::Util qw( reftype ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use YAML::Tiny qw(Load Dump LoadFile); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use version; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use parent qw(CLI::Simple); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | use Role::Tiny::With; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | 1 | with 'CPAN::Maker::Role::ModuleUtils'; | |||||||||||||||||||||||||||||||||
| 38 | 1 | with 'CPAN::Maker::Role::FileUtils'; | |||||||||||||||||||||||||||||||||
| 39 | 1 | with 'CPAN::Maker::Role::Provides'; | |||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | 1 | our $VERSION = '2.0.13'; | |||||||||||||||||||||||||||||||||
| 42 | 1 | our $GIT_SHA = '0371d076b863b3b1daec21ae56bb943399371645'; | |||||||||||||||||||||||||||||||||
| 43 | 1 | our $GIT_DIRTY = '0371d076b863b3b1daec21ae56bb943399371645-dirty'; | |||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||
| 45 | 1 | __PACKAGE__->use_log4perl( level => 'info', color => $FALSE ); | |||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||
| 47 | 1 | ▶ | caller or exit __PACKAGE__->main(); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||
| 49 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub init { | ||||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 51 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 52 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if ( $self->get_version ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 55 | 0 | $self->command('version'); | |||||||||||||||||||||||||||||||||
| 56 | 0 | return; | |||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||
| 59 | 0 | my $log_level = $self->get_log_level; | |||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||
| 61 | 0 | $self->_set_log_level($log_level); | |||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||
| 63 | 0 | my $project_root = $self->get_project_root; | |||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | $self->set_project_root( $project_root // $ENV{PROJECT_HOME} // getcwd ); | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
($project_root // $ENV{"PROJECT_HOME"}) // getcwd()
$project_root // $ENV{"PROJECT_HOME"}
MC/DC0%0/3
($project_root // $ENV{"PROJECT_HOME"}) // getcwd()
$project_root
$ENV{"PROJECT_HOME"}
getcwd()
Truth table0%0/4
A // B // C
A= $project_rootB= $ENV{"PROJECT_HOME"}C= getcwd()
| |||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||
| 67 | # set the min perl version for deteriming core modules | ||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->_min_perl_version; | |||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | # invoked by bash script to generate Makefile.PL - no buildspec | ||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if ( !$self->get_buildspec && $self->get_module ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->get_buildspec and $self->get_module
MC/DC0%0/2
not $self->get_buildspec and $self->get_module
not $self->get_buildspec
$self->get_module
Truth table0%0/3
not(A) and B
A= not $self->get_buildspecB= $self->get_module
| |||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->command('write-makefile'); | |||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||
| 75 | 0 | return; | |||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||
| 78 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub _set_log_level { | ||||||||||||||||||||||||||||||||
|
Subroutine
_set_log_level: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 80 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 81 | 0 | my ( $self, $log_level ) = @_; | |||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||
| 83 | 0 | my @numeric_levels = ( | |||||||||||||||||||||||||||||||||
| 84 | $ERROR => 1, | ||||||||||||||||||||||||||||||||||
| 85 | $WARN => 2, | ||||||||||||||||||||||||||||||||||
| 86 | $INFO => 3, | ||||||||||||||||||||||||||||||||||
| 87 | $DEBUG => 4, | ||||||||||||||||||||||||||||||||||
| 88 | $TRACE => 5, | ||||||||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||
| 91 | 0 | my @text_levels = ( | |||||||||||||||||||||||||||||||||
| 92 | error => 1, | ||||||||||||||||||||||||||||||||||
| 93 | warn => 2, | ||||||||||||||||||||||||||||||||||
| 94 | info => 3, | ||||||||||||||||||||||||||||||||||
| 95 | debug => 4, | ||||||||||||||||||||||||||||||||||
| 96 | trace => 5, | ||||||||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | my $numeric_level = choose { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if ( $log_level =~ /^(?:[12345])$/xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 102 | 0 | $log_level = { reverse @numeric_levels }->{$log_level}; | |||||||||||||||||||||||||||||||||
| 103 | 0 | return $self->get_log_level; | |||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||
| 105 | 0 | elsif ( ($log_level) = grep { $log_level eq $_ } @text_levels ) { | |||||||||||||||||||||||||||||||||
| 106 | 0 | return {@text_levels}->{$log_level}; | |||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||
| 108 | else { | ||||||||||||||||||||||||||||||||||
| 109 | 0 | return {@text_levels}->{info}; | |||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||
| 111 | 0 | }; | |||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||
| 113 | 0 | $self->get_logger->level( { reverse @numeric_levels }->{$numeric_level} ); | |||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||
| 115 | 0 | $self->set_log_level($numeric_level); | |||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||
| 117 | 0 | return $numeric_level; | |||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||
| 120 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | sub cmd_version { | ||||||||||||||||||||||||||||||||
|
Subroutine
cmd_version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 122 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 123 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||
| 125 | 0 | print $PROGRAM_NAME . ' v' . $VERSION . $NL; | |||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||
| 127 | 0 | return $SUCCESS; | |||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub cmd_create_cpanfile { | ||||||||||||||||||||||||||||||||
|
Subroutine
cmd_create_cpanfile: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 132 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 133 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||
| 135 | 0 | my @file_list = $self->get_args; | |||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | my $dep_type = $self->get_dependency_type // 'requires'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->get_dependency_type // "requires"
MC/DC0%0/1
$self->get_dependency_type // "requires"
$self->get_dependency_type
Truth table0%0/2
A
A= $self->get_dependency_type
| |||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||
| 138 | 0 | my @dep_types = qw(requires suggests recommends); | |||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||
| 140 | die sprintf "ERROR: --dependency-type must be one of %s\n", join q{, }, @dep_types | ||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if none { $dep_type eq $_ } @dep_types; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | die "ERROR: usage cpan-maker create-cpanfile file1 file2 ...\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 144 | if !@file_list; | ||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||
| 146 | 0 | my @requires; | |||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||
| 148 | 0 | foreach (@file_list) { | |||||||||||||||||||||||||||||||||
| 149 | 0 | push @requires, split /\n/xsm, slurp($_); | |||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||
| 152 | 0 | my @filtered_requires; | |||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||
| 154 | 0 | foreach (@requires) { | |||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | next if /^[#]/xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 156 | 0 | s/^[+]//xsm; | |||||||||||||||||||||||||||||||||
| 157 | 0 | push @filtered_requires, $_; | |||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||
| 160 | 0 | @requires = uniq sort @filtered_requires; | |||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $fh = choose { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 163 | 0 | my $outfile = $self->get_outfile; | |||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | return \*STDOUT | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 166 | if $outfile eq q{-}; | ||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | $outfile //= 'cpanfile'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$outfile //= "cpanfile"
MC/DC0%0/1
$outfile //= "cpanfile"
$outfile
Truth table0%0/2
A
A= $outfile
| |||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->set_outfile($outfile); | |||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | open my $fh, '>', $outfile | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 173 | or die "ERROR: could not open cpanfile for writing: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||
| 175 | 0 | return $fh; | |||||||||||||||||||||||||||||||||
| 176 | 0 | }; | |||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||
| 178 | 0 | foreach (@requires) { | |||||||||||||||||||||||||||||||||
| 179 | 0 | my (@module) = split /\s+/xsm, $_; | |||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||
| 181 | 0 | my $req = { | |||||||||||||||||||||||||||||||||
| 182 | module => shift @module, | ||||||||||||||||||||||||||||||||||
| 183 | version => shift @module, | ||||||||||||||||||||||||||||||||||
| 184 | }; | ||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if (@module) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 187 | 0 | foreach my $e (@module) { | |||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | die "ERROR: invalid entry only dist, url or mirror permitted after version\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 189 | if $e !~ /^(?:dist=|url=|mirror=)/xsm; | ||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||
| 191 | 0 | my (@args) = split /=/, $e; | |||||||||||||||||||||||||||||||||
| 192 | 0 | $req->{ $args[0] } = $args[1]; | |||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ( keys %{$req} == 2 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | print {$fh} sprintf qq{%s "%s", "%s";\n}, $dep_type, $req->{module} // q{}, $req->{version} // q{}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/4
$req->{"module"} // ""
$req->{"version"} // ""
MC/DC0%0/1
$req->{"module"} // ""
$req->{"module"}
MC/DC0%0/1
$req->{"version"} // ""
$req->{"version"}
Truth table0%0/2
A
A= $req->{"module"}
Truth table0%0/2
A
A= $req->{"version"}
| |||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||
| 199 | else { | ||||||||||||||||||||||||||||||||||
| 200 | 0 | my @extra; | |||||||||||||||||||||||||||||||||
| 201 | 0 | foreach ( keys %{$req} ) { | |||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | next if /^(?:module|version)/xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 203 | 0 | push @extra, sprintf ' %s => "%s"', $_, $req->{$_}; | |||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | print {$fh} sprintf qq{requires "%s", "%s";\n}, $req->{module} // q{}, $req->{version} // q{}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/4
$req->{"module"} // ""
$req->{"version"} // ""
MC/DC0%0/1
$req->{"module"} // ""
$req->{"module"}
MC/DC0%0/1
$req->{"version"} // ""
$req->{"version"}
Truth table0%0/2
A
A= $req->{"module"}
Truth table0%0/2
A
A= $req->{"version"}
| |||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||
| 208 | 0 | print {$fh} sprintf ",\n%s", join ",\n", @extra; | |||||||||||||||||||||||||||||||||
| 209 | 0 | print {$fh} ";\n"; | |||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if ( $self->get_outfile ne '-' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 214 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||
| 217 | 0 | return $SUCCESS; | |||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||
| 220 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub cmd_validate { | ||||||||||||||||||||||||||||||||
|
Subroutine
cmd_validate: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 222 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 223 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||
| 225 | 0 | my $is_validator_available = eval { require JSON::Validator; 1; }; ## scandeps: recommends | |||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | die "ERROR: JSON::Validator must be installed to validate your 'buildspec.yml' file.\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 228 | if !$is_validator_available; | ||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||
| 230 | 0 | my ($file) = $self->get_args; | |||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | $file //= $self->get_buildspec // 'buildspec.yml'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/4
$file //= $self->get_buildspec // "buildspec.yml"
$self->get_buildspec // "buildspec.yml"
MC/DC0%0/1
$file //= $self->get_buildspec // "buildspec.yml"
$file
Truth table0%0/2
A
A= $file
| |||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | croak "ERROR: $file not found\n" if !-e $file; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||
| 235 | 0 | my $buildspec = $self->read_buildspec($file); | |||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ( $self->validate_buildspec($buildspec) ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 238 | 0 | $self->get_logger->info("$file is valid"); | |||||||||||||||||||||||||||||||||
| 239 | 0 | return $SUCCESS; | |||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||
| 241 | else { | ||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->get_logger->error("$file is invalid"); | |||||||||||||||||||||||||||||||||
| 243 | 0 | return $FAILURE; | |||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||
| 247 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub cmd_build { | ||||||||||||||||||||||||||||||||
|
Subroutine
cmd_build: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 249 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 250 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | die "ERROR: no buildspec.yml specified.\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 253 | if !$self->get_buildspec; | ||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||
| 255 | 0 | $self->parse_buildspec; | |||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if ( $self->get_dryrun ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 258 | 0 | print {*STDOUT} Dumper( | |||||||||||||||||||||||||||||||||
| 259 | { requires => $self->get_requires, | ||||||||||||||||||||||||||||||||||
| 260 | recommends => $self->get_recommends, | ||||||||||||||||||||||||||||||||||
| 261 | suggests => $self->get_suggests, | ||||||||||||||||||||||||||||||||||
| 262 | test_requires => $self->get_test_requires, | ||||||||||||||||||||||||||||||||||
| 263 | build_requires => $self->get_build_requires, | ||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||
| 265 | ); | ||||||||||||||||||||||||||||||||||
| 266 | 0 | return $SUCCESS; | |||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||
| 269 | 0 | my $builddir = tempdir( 'cpan-maker-XXXXXX', TMPDIR => $TRUE, CLEANUP => !$self->get_no_cleanup ); | |||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||
| 271 | 0 | $self->get_logger->debug("builddir: $builddir"); | |||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||
| 273 | 0 | my $cwd = getcwd; | |||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | my $project_root = $self->get_project_root // $cwd; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_project_root // $cwd
MC/DC0%0/2
$self->get_project_root // $cwd
$self->get_project_root
$cwd
Truth table0%0/3
A // B
A= $self->get_project_rootB= $cwd
| |||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | chdir $project_root | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 277 | or die "ERROR: could not chdir to $project_root: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||
| 279 | 0 | my $provides_file = $self->stage_distribution( builddir => $builddir ); | |||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->set_work_dir($builddir); | |||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||
| 283 | { | ||||||||||||||||||||||||||||||||||
| 284 | 0 | my $makefile_pl = "$builddir/Makefile.PL"; | |||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||
| 286 | 0 | $self->get_logger->info("writing $makefile_pl"); | |||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||
| 288 | 0 | $self->write_makefile( | |||||||||||||||||||||||||||||||||
| 289 | dest => $makefile_pl, | ||||||||||||||||||||||||||||||||||
| 290 | provides_file => $provides_file, | ||||||||||||||||||||||||||||||||||
| 291 | ); | ||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | chdir $builddir | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 295 | or die "ERROR: could not chdir to $builddir: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | if ( $provides_file && -e $provides_file ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$provides_file and -e $provides_file
MC/DC0%0/2
$provides_file and -e $provides_file
$provides_file
-e $provides_file
Truth table0%0/3
A and B
A= $provides_fileB= -e $provides_file
| |||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | cp( $provides_file, "$builddir/provides" ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 299 | or die "ERROR: could not copy provides to builddir: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | my $destdir = $self->get_destdir // $cwd; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_destdir // $cwd
MC/DC0%0/2
$self->get_destdir // $cwd
$self->get_destdir
$cwd
Truth table0%0/3
A // B
A= $self->get_destdirB= $cwd
| |||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||
| 304 | # write MANIFEST.SKIP to prevent MYMETA files, Makefile, and | ||||||||||||||||||||||||||||||||||
| 305 | # intermediate build artifacts from being included in the distribution | ||||||||||||||||||||||||||||||||||
| 306 | { | ||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | open my $fh, '>', 'MANIFEST.SKIP' | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 308 | or die "ERROR: could not write MANIFEST.SKIP: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 309 | 0 | print {$fh} "Makefile\$\nMYMETA.json\nMYMETA.yml\nprovides\n"; | |||||||||||||||||||||||||||||||||
| 310 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | my @steps = ( [ $^X, 'Makefile.PL' ], [ 'make', 'manifest' ], sub { $self->_sort_manifest }, [ 'make', 'dist' ], ); | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | push @steps, [ 'make', 'test' ] | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 316 | if !$self->get_skip_tests; | ||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||
| 318 | 0 | for my $step (@steps) { | |||||||||||||||||||||||||||||||||
| 319 | 0 | my ( $rc, $label ); | |||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if ( ref $step eq 'CODE' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 322 | 0 | $rc = $step->(); | |||||||||||||||||||||||||||||||||
| 323 | 0 | $label = 'sort-manifest'; | |||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||
| 325 | else { | ||||||||||||||||||||||||||||||||||
| 326 | 0 | $rc = $self->_run_cmd( @{$step} ); | |||||||||||||||||||||||||||||||||
| 327 | 0 | $label = join $SPACE, @{$step}; | |||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if ( $rc != 0 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 331 | 0 | chdir $cwd; | |||||||||||||||||||||||||||||||||
| 332 | 0 | die sprintf "ERROR: '%s' failed with exit code %d\n", $label, $rc; | |||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||
| 336 | 0 | my @tarballs = glob '*.tar.gz'; | |||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | die "ERROR: no tarball produced by make dist\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 339 | if !@tarballs; | ||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||
| 341 | 0 | my $tarball = ( sort @tarballs )[-1]; | |||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | cp( $tarball, $destdir ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 344 | or die "ERROR: could not copy $tarball to $destdir: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||
| 346 | 0 | $self->get_logger->info("distribution written to $destdir/$tarball"); | |||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if ( $self->get_preserve_makefile ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | cp( 'Makefile.PL', $destdir ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 350 | or die "ERROR: could not copy Makefile.PL to $destdir: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||
| 353 | 0 | chdir $cwd; | |||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||
| 355 | 0 | return $SUCCESS; | |||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||
| 358 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub _sort_manifest { | ||||||||||||||||||||||||||||||||
|
Subroutine
_sort_manifest: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||
| 360 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 361 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||
| 363 | 0 | my $file = 'MANIFEST'; | |||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | open my $fh, '<', $file | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 366 | or die sprintf "ERROR: cannot read %s: %s\n", $file, $OS_ERROR; | ||||||||||||||||||||||||||||||||||
| 367 | 0 | chomp( my @lines = <$fh> ); | |||||||||||||||||||||||||||||||||
| 368 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||
| 370 | # ExtUtils::Manifest sorts with { lc $a cmp lc $b } and no tiebreaker, so | ||||||||||||||||||||||||||||||||||
| 371 | # entries differing only in case (botocore's JWT...Exception vs | ||||||||||||||||||||||||||||||||||
| 372 | # jwt...Exception) compare equal and fall back to directory-walk order, | ||||||||||||||||||||||||||||||||||
| 373 | # which varies between builds. Add a case-sensitive tiebreaker for a | ||||||||||||||||||||||||||||||||||
| 374 | # total, reproducible order. | ||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | my @sorted = sort { lc $a cmp lc $b or $a cmp $b } @lines; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
lc $a cmp lc $b || $a cmp $b
MC/DC0%0/2
lc $a cmp lc $b || $a cmp $b
lc $a cmp lc $b
$a cmp $b
Truth table0%0/3
A || B
A= lc $a cmp lc $bB= $a cmp $b
| |||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | open my $out, '>', $file | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 378 | or die sprintf "ERROR: cannot write %s: %s\n", $file, $OS_ERROR; | ||||||||||||||||||||||||||||||||||
| 379 | 0 | print {$out} map {"$_\n"} @sorted; | |||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | close $out | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 382 | or die sprintf "ERROR: cannot close %s: %s\n", $file, $OS_ERROR; | ||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||
| 384 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||
| 387 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | sub cmd_makefile { | ||||||||||||||||||||||||||||||||
|
Subroutine
cmd_makefile: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 389 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 390 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | croak 'no module specified' | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 393 | if !$self->get_module; | ||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | croak 'no requires file specified' | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 396 | if !$self->get_requires; | ||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||
| 398 | # TBD, update error to 'not found...use --scan path to create a requires file' | ||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | croak sprintf q{requires file '%s' not found}, $self->get_requires | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 400 | if !-f $self->get_requires; | ||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||
| 402 | # TBD, use outfile if provided | ||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | return $self->write_makefile( dest => \*STDOUT ) ? $SUCCESS : $FAILURE; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||
| 406 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | sub get_exe_file_list { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_exe_file_list: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 408 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 409 | 0 | my ( $self, $file ) = @_; | |||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||
| 411 | 0 | my $lines; | |||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if ($file) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 414 | ($lines) = process_file( | ||||||||||||||||||||||||||||||||||
| 415 | $file, | ||||||||||||||||||||||||||||||||||
| 416 | chomp => $TRUE, | ||||||||||||||||||||||||||||||||||
| 417 | skip_blank_lines => $TRUE, | ||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | process => sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 419 | 0 | my $f = pop @_; | |||||||||||||||||||||||||||||||||
| 420 | 0 | $f =~ s/^.*\/(.*)$/bin\/$1/xsm; | |||||||||||||||||||||||||||||||||
| 421 | 0 | return $f; | |||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||
| 423 | 0 | ); | |||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | return $lines ? @{$lines} : (); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||
| 429 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | sub fetch_perl_version { | ||||||||||||||||||||||||||||||||
|
Subroutine
fetch_perl_version: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 431 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 432 | 0 | my ( $self, $requires ) = @_; | |||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||
| 434 | 0 | my $version; | |||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||
| 436 | return | ||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | if !-e $requires; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||
| 439 | process_file( | ||||||||||||||||||||||||||||||||||
| 440 | $requires, | ||||||||||||||||||||||||||||||||||
| 441 | chomp => $TRUE, | ||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | process => sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||
| 443 | 0 | my $module = pop @_; | |||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | if ( $module !~ /^perl\s+/xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 446 | 0 | return (); | |||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||
| 449 | 0 | ( undef, $version ) = split /\s+/xsm, $module; | |||||||||||||||||||||||||||||||||
| 450 | 0 | return; | |||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||
| 452 | 0 | ); | |||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||
| 454 | 0 | return $version; | |||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||
| 457 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | sub read_resources { | ||||||||||||||||||||||||||||||||
|
Subroutine
read_resources: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 459 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 460 | 0 | my ( $self, $file ) = @_; | |||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||
| 462 | 0 | return get_json_file($file); | |||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||
| 465 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | sub write_resources { | ||||||||||||||||||||||||||||||||
|
Subroutine
write_resources: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 467 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 468 | 0 | my ( $self, $resources ) = @_; | |||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||
| 470 | 0 | my $resources_file; | |||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | if ($resources) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 473 | 0 | $resources_file = 'resources'; | |||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | open my $fh, '>', $resources_file | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 476 | or croak "could not open resources for writing\n"; | ||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||
| 478 | 0 | print {$fh} JSON->new->pretty->encode($resources); | |||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | close $fh | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 481 | or croak "could not close file $resources_file\n"; | ||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||
| 484 | 0 | return; | |||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||
| 487 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | sub write_pl_files { | ||||||||||||||||||||||||||||||||
|
Subroutine
write_pl_files: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 489 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 490 | 0 | my ( $self, $pl_files ) = @_; | |||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||
| 492 | return | ||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | if !$pl_files; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||
| 495 | 0 | my ( $fh, $filename ) = tempfile( 'make-cpan-dist-XXXXX', TMPDIR => $TRUE ); | |||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||
| 497 | 0 | print {$fh} join $SPACE, %{$pl_files}; | |||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||
| 499 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||
| 501 | 0 | $self->set_pl_files($filename); | |||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||
| 503 | 0 | return; | |||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||
| 506 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 507 | 0 | ▶ | sub write_makefile { | ||||||||||||||||||||||||||||||||
|
Subroutine
write_makefile: not called CC=47 SCAR=77.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 508 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 509 | 0 | my ( $self, %params ) = @_; | |||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||
| 511 | 0 | ▶ | my $dest = $params{dest} // \*STDOUT; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$params{"dest"} // \*STDOUT
MC/DC0%0/1
$params{"dest"} // \*STDOUT
$params{"dest"}
Truth table0%0/2
A
A= $params{"dest"}
| |||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||
| 513 | 0 | my $core = $self->get_core_modules; | |||||||||||||||||||||||||||||||||
| 514 | 0 | my $MODULE_ABSTRACT = $self->get_abstract; | |||||||||||||||||||||||||||||||||
| 515 | 0 | my $AUTHOR = $self->get_author; | |||||||||||||||||||||||||||||||||
| 516 | 0 | my $project_root = $self->get_project_root; | |||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | my $LICENSE = $self->get_license // 'perl'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->get_license // "perl"
MC/DC0%0/1
$self->get_license // "perl"
$self->get_license
Truth table0%0/2
A
A= $self->get_license
| |||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | my ( $author, $email ) = choose { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | if ( $AUTHOR && $AUTHOR =~ /^([^<]+)\s+<([^>]+)>\s*$/xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$AUTHOR and $AUTHOR =~ /^([^<]+)\s+<([^>]+)>\s*$/msx
MC/DC0%0/2
$AUTHOR and $AUTHOR =~ /^([^<]+)\s+<([^>]+)>\s*$/msx
$AUTHOR
$AUTHOR =~ /^([^<]+)\s+<([^>]+)>\s*$/msx
Truth table0%0/3
A and B
A= $AUTHORB= $AUTHOR =~ /^([^<]+)\s+<([^>]+)>\s*$/msx
| |||||||||||||||||||||||||||||||||||
| 522 | 0 | return ( $1, $2 ); | |||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||
| 525 | # TBD: look in ENV, ~/.gitconfig ? | ||||||||||||||||||||||||||||||||||
| 526 | 0 | return ( 'Anonymouse', 'anonymouse@example.org' ); | |||||||||||||||||||||||||||||||||
| 527 | 0 | }; | |||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||
| 529 | 0 | $AUTHOR = sprintf '%s <%s>', $author, $email; | |||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||
| 531 | 0 | my $PM_MODULE = $self->get_module; | |||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | my %buildspec = ( | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$MODULE_ABSTRACT // $PM_MODULE
MC/DC0%0/2
$MODULE_ABSTRACT // $PM_MODULE
$MODULE_ABSTRACT
$PM_MODULE
Truth table0%0/3
A // B
A= $MODULE_ABSTRACTB= $PM_MODULE
| |||||||||||||||||||||||||||||||||||
| 534 | version => $VERSION, | ||||||||||||||||||||||||||||||||||
| 535 | project => { | ||||||||||||||||||||||||||||||||||
| 536 | description => $MODULE_ABSTRACT // $PM_MODULE, | ||||||||||||||||||||||||||||||||||
| 537 | author => { | ||||||||||||||||||||||||||||||||||
| 538 | name => $author, | ||||||||||||||||||||||||||||||||||
| 539 | mailto => $email, | ||||||||||||||||||||||||||||||||||
| 540 | }, | ||||||||||||||||||||||||||||||||||
| 541 | }, | ||||||||||||||||||||||||||||||||||
| 542 | 'pm-module' => $PM_MODULE, | ||||||||||||||||||||||||||||||||||
| 543 | ); | ||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | my $VERSION_FROM = $self->get_version_from // $self->get_module; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_version_from // $self->get_module
MC/DC0%0/2
$self->get_version_from // $self->get_module
$self->get_version_from
$self->get_module
Truth table0%0/3
A // B
A= $self->get_version_fromB= $self->get_module
| |||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | if ( $VERSION_FROM !~ /\//xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 548 | 0 | $VERSION_FROM = 'lib/' . $self->make_path_from_module($VERSION_FROM); | |||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||
| 551 | 0 | $buildspec{'version-from'} = $VERSION_FROM; | |||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||
| 553 | 0 | local $Data::Dumper::Terse = $TRUE; | |||||||||||||||||||||||||||||||||
| 554 | 0 | local $Data::Dumper::Sortkeys = $TRUE; | |||||||||||||||||||||||||||||||||
| 555 | 0 | local $Data::Dumper::Indent = 2; | |||||||||||||||||||||||||||||||||
| 556 | 0 | local $Data::Dumper::Pad = $SPACE x $INDENT; | |||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||
| 558 | # dependencies = key name taken as file name if not provided | ||||||||||||||||||||||||||||||||||
| 559 | 0 | foreach my $d (qw(requires test_requires build_requires recommends suggests)) { | |||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | $self->set( $d, $self->get($d) || $d ); | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get($d) || $d
MC/DC0%0/2
$self->get($d) || $d
$self->get($d)
$d
Truth table0%0/3
A || B
A= $self->get($d)B= $d
| |||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||
| 563 | $buildspec{dependencies} = { | ||||||||||||||||||||||||||||||||||
| 564 | 0 | 'build-requires' => $self->get_build_requires, | |||||||||||||||||||||||||||||||||
| 565 | 'recommends' => $self->get_recommends, | ||||||||||||||||||||||||||||||||||
| 566 | 'requires' => $self->get_requires, | ||||||||||||||||||||||||||||||||||
| 567 | 'suggests' => $self->get_suggests, | ||||||||||||||||||||||||||||||||||
| 568 | 'test-requires' => $self->get_test_requires, | ||||||||||||||||||||||||||||||||||
| 569 | }; | ||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||
| 571 | 0 | foreach (qw(requires test-requires build-requires recommends suggests)) { | |||||||||||||||||||||||||||||||||
| 572 | 0 | my $dependency_file = $buildspec{dependencies}->{$_}; | |||||||||||||||||||||||||||||||||
| 573 | 0 | $dependency_file =~ s/$project_root\/?//xsm; | |||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | next if -s $dependency_file; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||
| 576 | 0 | delete $buildspec{dependencies}->{$_}; | |||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | my $MIN_PERL_VERSION = $self->get_min_perl_version // $DEFAULT_PERL_VERSION; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_min_perl_version // $CPAN::Maker::DEFAULT_PERL_VERSION
MC/DC0%0/2
$self->get_min_perl_version // $CPAN::Maker::DEFAULT_PERL_VERSION
$self->get_min_perl_version
$CPAN::Maker::DEFAULT_PERL_VERSION
Truth table0%0/3
A // B
A= $self->get_min_perl_versionB= $CPAN::Maker::DEFAULT_PERL_VERSION
| |||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||
| 581 | 0 | my $require_versions = $self->get_require_versions; | |||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||
| 583 | 0 | my $PRE_REQ = Dumper $self->fetch_requires( | |||||||||||||||||||||||||||||||||
| 584 | requires => $self->get_requires, | ||||||||||||||||||||||||||||||||||
| 585 | include_core_modules => $core, | ||||||||||||||||||||||||||||||||||
| 586 | include_version => $require_versions, | ||||||||||||||||||||||||||||||||||
| 587 | min_perl_version => $MIN_PERL_VERSION, | ||||||||||||||||||||||||||||||||||
| 588 | ); | ||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||
| 590 | 0 | $PRE_REQ = trim($PRE_REQ); | |||||||||||||||||||||||||||||||||
| 591 | 0 | $PRE_REQ =~ s/[@](\d+)/== $1/xsmg; | |||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||
| 593 | 0 | my $TEST_REQ = {}; | |||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | if ( $self->get_test_requires && -s $self->get_test_requires ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_test_requires and -s $self->get_test_requires
MC/DC0%0/2
$self->get_test_requires and -s $self->get_test_requires
$self->get_test_requires
-s $self->get_test_requires
Truth table0%0/3
A and B
A= $self->get_test_requiresB= -s $self->get_test_requires
| |||||||||||||||||||||||||||||||||||
| 596 | 0 | $TEST_REQ = Dumper $self->fetch_requires( | |||||||||||||||||||||||||||||||||
| 597 | requires => $self->get_test_requires, | ||||||||||||||||||||||||||||||||||
| 598 | include_core_modules => $core, | ||||||||||||||||||||||||||||||||||
| 599 | include_version => $require_versions, | ||||||||||||||||||||||||||||||||||
| 600 | min_perl_version => $MIN_PERL_VERSION, | ||||||||||||||||||||||||||||||||||
| 601 | ); | ||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||
| 603 | else { | ||||||||||||||||||||||||||||||||||
| 604 | 0 | $TEST_REQ = '{}'; | |||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||
| 607 | 0 | $TEST_REQ = trim($TEST_REQ); | |||||||||||||||||||||||||||||||||
| 608 | 0 | $TEST_REQ =~ s/[@](\d+)/== $1/xsmg; | |||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||
| 610 | 0 | my $build_req = {}; | |||||||||||||||||||||||||||||||||
| 611 | 0 | my $build_requires = $self->get_build_requires; | |||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | if ( $build_requires && -s $build_requires ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$build_requires and -s $build_requires
MC/DC0%0/2
$build_requires and -s $build_requires
$build_requires
-s $build_requires
Truth table0%0/3
A and B
A= $build_requiresB= -s $build_requires
| |||||||||||||||||||||||||||||||||||
| 614 | 0 | $build_req = $self->fetch_requires( | |||||||||||||||||||||||||||||||||
| 615 | requires => $build_requires, | ||||||||||||||||||||||||||||||||||
| 616 | include_core_modules => $TRUE, | ||||||||||||||||||||||||||||||||||
| 617 | include_version => $require_versions, | ||||||||||||||||||||||||||||||||||
| 618 | min_perl_version => $MIN_PERL_VERSION, | ||||||||||||||||||||||||||||||||||
| 619 | ); | ||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||
| 622 | 0 | my %build_req_defaults = ( | |||||||||||||||||||||||||||||||||
| 623 | 'ExtUtils::MakeMaker' => '6.64', | ||||||||||||||||||||||||||||||||||
| 624 | 'File::ShareDir::Install' => $NO_VERSION, | ||||||||||||||||||||||||||||||||||
| 625 | ); | ||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||
| 627 | 0 | foreach my $m ( keys %build_req_defaults ) { | |||||||||||||||||||||||||||||||||
| 628 | 0 | ▶ | $build_req->{$m} ||= $build_req_defaults{$m}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$build_req->{$m} ||= $build_req_defaults{$m}
MC/DC0%0/2
$build_req->{$m} ||= $build_req_defaults{$m}
$build_req->{$m}
$build_req_defaults{$m}
Truth table0%0/3
A ||= B
A= $build_req->{$m}B= $build_req_defaults{$m}
| |||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||
| 631 | 0 | $build_req = Dumper $build_req; | |||||||||||||||||||||||||||||||||
| 632 | 0 | $build_req = trim($build_req); | |||||||||||||||||||||||||||||||||
| 633 | 0 | $build_req =~ s/[@](\d+)/== $1/xsmg; | |||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||
| 635 | 0 | my @exe_file_list; | |||||||||||||||||||||||||||||||||
| 636 | $buildspec{path} = { | ||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | 'pm-module' => $self->get_module_path, | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 638 | recurse => $self->get_recurse ? 'yes' : 'no', | ||||||||||||||||||||||||||||||||||
| 639 | }; | ||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | my $exe_files = $self->get_exe_files || $self->get_exec_path; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_exe_files || $self->get_exec_path
MC/DC0%0/2
$self->get_exe_files || $self->get_exec_path
$self->get_exe_files
$self->get_exec_path
Truth table0%0/3
A || B
A= $self->get_exe_filesB= $self->get_exec_path
| |||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | if ( $exe_files && -f $exe_files ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$exe_files and -f $exe_files
MC/DC0%0/2
$exe_files and -f $exe_files
$exe_files
-f $exe_files
Truth table0%0/3
A and B
A= $exe_filesB= -f $exe_files
| |||||||||||||||||||||||||||||||||||
| 644 | 0 | @exe_file_list = $self->get_exe_file_list($exe_files); | |||||||||||||||||||||||||||||||||
| 645 | 0 | $self->set_exec_path($exe_files); | |||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||
| 648 | 0 | foreach my $p ( pairs qw(exe-files exec-path scripts scripts-path tests tests-path) ) { | |||||||||||||||||||||||||||||||||
| 649 | 0 | my ( $spec_option, $path ) = @{$p}; | |||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||
| 651 | next | ||||||||||||||||||||||||||||||||||
| 652 | 0 | ▶ | if !$self->get($path); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||
| 654 | 0 | my $real_path = $self->get($path); | |||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||
| 656 | 0 | my $project_file = sprintf '%s/%s', $project_root, $real_path; | |||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | if ( -e $project_file ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 659 | 0 | $buildspec{path}->{$spec_option} = $real_path; | |||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||
| 661 | else { | ||||||||||||||||||||||||||||||||||
| 662 | 0 | $buildspec{$spec_option} = $self->fetch_relative_filelist( $project_root, $real_path ); | |||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||
| 664 | # remove temporary files? | ||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | if ( $real_path =~ /make\-cpan\-dist\-[[:alpha:]]{5}/xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 666 | 0 | unlink $real_path; | |||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | if ( my $path = $self->get_extra_path ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 672 | 0 | $buildspec{'extra-files'} = $path; | |||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||
| 675 | 0 | my $EXE_FILES = Dumper \@exe_file_list; | |||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||
| 677 | # was: blindly putting all exe_files into MAN3PODS | ||||||||||||||||||||||||||||||||||
| 678 | # fix: MAN1PODS only for scripts that actually contain POD | ||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||
| 680 | 0 | my %man1pods; | |||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||
| 682 | 0 | foreach (@exe_file_list) { | |||||||||||||||||||||||||||||||||
| 683 | 0 | my ( $name, $path, $ext ) = fileparse( $_, qr/[.][^.]+\z/xsm ); | |||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||
| 685 | # only include scripts that actually contain POD | ||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | my $content = eval { slurp($_) } // q{}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
eval {
do {
slurp($_)
}
} // ""
MC/DC0%0/1
eval {
do {
slurp($_)
}
} // ""
eval {
do {
slurp($_)
}
}
Truth table0%0/2
A
A= eval {
do {
slurp($_)
}
}
| |||||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | next if $content !~ /^=(head\d|pod|over|item|begin|encoding)/xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||
| 689 | 0 | $man1pods{$_} = sprintf 'blib/man1/%s.1', $name; | |||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||
| 692 | 0 | my $MAN1PODS = Dumper \%man1pods; | |||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||
| 694 | 0 | my %provides; | |||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | my $provides_file = $params{provides_file} // 'provides'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$params{"provides_file"} // "provides"
MC/DC0%0/1
$params{"provides_file"} // "provides"
$params{"provides_file"}
Truth table0%0/2
A
A= $params{"provides_file"}
| |||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | if ( -e $provides_file ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 699 | 0 | %provides = $self->get_provides( | |||||||||||||||||||||||||||||||||
| 700 | file => $provides_file, | ||||||||||||||||||||||||||||||||||
| 701 | work_dir => $self->get_work_dir, | ||||||||||||||||||||||||||||||||||
| 702 | ); | ||||||||||||||||||||||||||||||||||
| 703 | $buildspec{provides} = [ | ||||||||||||||||||||||||||||||||||
| 704 | 0 | map { sprintf '%s %s', $_, $provides{$_}->{version} } | |||||||||||||||||||||||||||||||||
| 705 | sort keys %provides | ||||||||||||||||||||||||||||||||||
| 706 | ]; | ||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | my $resources_path = $self->get_resources // 'resources'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->get_resources // "resources"
MC/DC0%0/1
$self->get_resources // "resources"
$self->get_resources
Truth table0%0/2
A
A= $self->get_resources
| |||||||||||||||||||||||||||||||||||
| 710 | 0 | my $resources; | |||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | if ( -e $resources_path ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 713 | 0 | $resources = $self->read_resources($resources_path); | |||||||||||||||||||||||||||||||||
| 714 | 0 | $buildspec{resources} = $resources; | |||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||
| 717 | 0 | my $recommends = {}; | |||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | if ( $self->get_recommends && -s $self->get_recommends ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_recommends and -s $self->get_recommends
MC/DC0%0/2
$self->get_recommends and -s $self->get_recommends
$self->get_recommends
-s $self->get_recommends
Truth table0%0/3
A and B
A= $self->get_recommendsB= -s $self->get_recommends
| |||||||||||||||||||||||||||||||||||
| 720 | 0 | $recommends = $self->fetch_requires( | |||||||||||||||||||||||||||||||||
| 721 | requires => $self->get_recommends, | ||||||||||||||||||||||||||||||||||
| 722 | include_core_modules => $core, | ||||||||||||||||||||||||||||||||||
| 723 | include_version => $require_versions, | ||||||||||||||||||||||||||||||||||
| 724 | min_perl_version => $MIN_PERL_VERSION, | ||||||||||||||||||||||||||||||||||
| 725 | ); | ||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||
| 728 | 0 | my $suggests = {}; | |||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | if ( $self->get_suggests && -s $self->get_suggests ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_suggests and -s $self->get_suggests
MC/DC0%0/2
$self->get_suggests and -s $self->get_suggests
$self->get_suggests
-s $self->get_suggests
Truth table0%0/3
A and B
A= $self->get_suggestsB= -s $self->get_suggests
| |||||||||||||||||||||||||||||||||||
| 731 | 0 | $suggests = $self->fetch_requires( | |||||||||||||||||||||||||||||||||
| 732 | requires => $self->get_suggests, | ||||||||||||||||||||||||||||||||||
| 733 | include_core_modules => $core, | ||||||||||||||||||||||||||||||||||
| 734 | include_version => $require_versions, | ||||||||||||||||||||||||||||||||||
| 735 | min_perl_version => $MIN_PERL_VERSION, | ||||||||||||||||||||||||||||||||||
| 736 | ); | ||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||
| 739 | 0 | my %prereqs_runtime; | |||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | $prereqs_runtime{recommends} = $recommends if keys %{$recommends}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 741 | 0 | ▶ | $prereqs_runtime{suggests} = $suggests if keys %{$suggests}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||
| 743 | 0 | my $META_MERGE = 'META_MERGE ' . $FAT_ARROW; | |||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||
| 745 | { | ||||||||||||||||||||||||||||||||||
| 746 | 0 | local $Data::Dumper::Pair = $FAT_ARROW; | |||||||||||||||||||||||||||||||||
| 747 | 0 | ▶ | $META_MERGE .= Dumper( | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 748 | { 'meta-spec' => { version => 2 }, | ||||||||||||||||||||||||||||||||||
| 749 | 'provides' => \%provides, | ||||||||||||||||||||||||||||||||||
| 750 | ( %prereqs_runtime ? ( 'prereqs' => { 'runtime' => \%prereqs_runtime } ) : () ), | ||||||||||||||||||||||||||||||||||
| 751 | $resources ? ( 'resources' => $resources ) : () | ||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||
| 753 | ); | ||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||
| 756 | 0 | my $timestamp = scalar localtime; | |||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||
| 758 | 0 | $buildspec{'min-perl-version'} = $MIN_PERL_VERSION; | |||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||
| 760 | # From: https://metacpan.org/pod/ExtUtils::MakeMaker | ||||||||||||||||||||||||||||||||||
| 761 | # | ||||||||||||||||||||||||||||||||||
| 762 | # MakeMaker can run programs to generate files for you at build | ||||||||||||||||||||||||||||||||||
| 763 | # time. By default any file named *.PL (except Makefile.PL and | ||||||||||||||||||||||||||||||||||
| 764 | # Build.PL) in the top level directory will be assumed to be a Perl | ||||||||||||||||||||||||||||||||||
| 765 | # program and run passing its own basename in as an argument. This | ||||||||||||||||||||||||||||||||||
| 766 | # basename is actually a build target, and there is an intention, but | ||||||||||||||||||||||||||||||||||
| 767 | # not a requirement, that the *.PL file make the file passed to to as | ||||||||||||||||||||||||||||||||||
| 768 | # an argument. For example... | ||||||||||||||||||||||||||||||||||
| 769 | # | ||||||||||||||||||||||||||||||||||
| 770 | # perl foo.PL foo | ||||||||||||||||||||||||||||||||||
| 771 | # | ||||||||||||||||||||||||||||||||||
| 772 | 0 | my %pl_list; | |||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||
| 774 | 0 | my $pl_files = $self->get_pl_files; | |||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | if ( $pl_files && -s $pl_files ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pl_files and -s $pl_files
MC/DC0%0/2
$pl_files and -s $pl_files
$pl_files
-s $pl_files
Truth table0%0/3
A and B
A= $pl_filesB= -s $pl_files
| |||||||||||||||||||||||||||||||||||
| 777 | 0 | my @file_list = split /\n/xsm, slurp($pl_files); | |||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||
| 779 | 0 | foreach my $pl_file (@file_list) { | |||||||||||||||||||||||||||||||||
| 780 | 0 | my ( $file, $target ) = split /\s+/xsm, $pl_file; | |||||||||||||||||||||||||||||||||
| 781 | 0 | $pl_list{$file} = $target; | |||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||
| 784 | 0 | $buildspec{'pl-files'} = \%pl_list; | |||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||
| 787 | 0 | my $PL_FILES = Dumper( \%pl_list ); | |||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||
| 789 | 0 | $buildspec{postamble} = $self->get_postamble; | |||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||
| 791 | 0 | my $MAKEFILE = <<"END_OF_TEXT"; | |||||||||||||||||||||||||||||||||
| 792 | use strict; | ||||||||||||||||||||||||||||||||||
| 793 | use warnings; | ||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||
| 795 | use ExtUtils::MakeMaker; | ||||||||||||||||||||||||||||||||||
| 796 | use File::ShareDir::Install; | ||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||
| 798 | \$File::ShareDir::Install::INCLUDE_DOTFILES = 1; | ||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||
| 800 | if ( -d 'share' ) { | ||||||||||||||||||||||||||||||||||
| 801 | install_share 'share'; | ||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||
| 804 | WriteMakefile( | ||||||||||||||||||||||||||||||||||
| 805 | NAME => '$PM_MODULE', | ||||||||||||||||||||||||||||||||||
| 806 | MIN_PERL_VERSION => '$MIN_PERL_VERSION', | ||||||||||||||||||||||||||||||||||
| 807 | AUTHOR => '$AUTHOR', | ||||||||||||||||||||||||||||||||||
| 808 | VERSION_FROM => '$VERSION_FROM', | ||||||||||||||||||||||||||||||||||
| 809 | ABSTRACT => '$MODULE_ABSTRACT', | ||||||||||||||||||||||||||||||||||
| 810 | LICENSE => '$LICENSE', | ||||||||||||||||||||||||||||||||||
| 811 | PL_FILES => $PL_FILES, | ||||||||||||||||||||||||||||||||||
| 812 | EXE_FILES => $EXE_FILES, | ||||||||||||||||||||||||||||||||||
| 813 | MAN1PODS => $MAN1PODS, | ||||||||||||||||||||||||||||||||||
| 814 | PREREQ_PM => $PRE_REQ, | ||||||||||||||||||||||||||||||||||
| 815 | BUILD_REQUIRES => $build_req, | ||||||||||||||||||||||||||||||||||
| 816 | CONFIGURE_REQUIRES => { | ||||||||||||||||||||||||||||||||||
| 817 | 'ExtUtils::MakeMaker' => '6.64', | ||||||||||||||||||||||||||||||||||
| 818 | 'File::ShareDir::Install' => $NO_VERSION, | ||||||||||||||||||||||||||||||||||
| 819 | }, | ||||||||||||||||||||||||||||||||||
| 820 | TEST_REQUIRES => $TEST_REQ, | ||||||||||||||||||||||||||||||||||
| 821 | $META_MERGE | ||||||||||||||||||||||||||||||||||
| 822 | ); | ||||||||||||||||||||||||||||||||||
| 823 | END_OF_TEXT | ||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||
| 825 | 0 | $MAKEFILE .= <<'END_OF_MAKEFILE'; | |||||||||||||||||||||||||||||||||
| 826 | package MY; | ||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||
| 828 | use File::ShareDir::Install; | ||||||||||||||||||||||||||||||||||
| 829 | use English qw(-no_match_vars); | ||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||
| 831 | sub postamble { | ||||||||||||||||||||||||||||||||||
| 832 | my $self = shift; | ||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||
| 834 | my @ret = File::ShareDir::Install::postamble($self); | ||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||
| 836 | my $postamble = join "\n", @ret; | ||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||
| 838 | if ( -e 'postamble' ) { | ||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||
| 840 | local $RS = undef; | ||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||
| 842 | open my $fh, '<', 'postamble' | ||||||||||||||||||||||||||||||||||
| 843 | or die "could not open postamble\n"; | ||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||
| 845 | $postamble .= <$fh>; | ||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||
| 847 | close $fh; | ||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||
| 850 | return $postamble; | ||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||
| 853 | 1; | ||||||||||||||||||||||||||||||||||
| 854 | END_OF_MAKEFILE | ||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||
| 856 | # TBD: use openhandle and refactor this block | ||||||||||||||||||||||||||||||||||
| 857 | 0 | ▶ | if ( ref $dest ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 858 | 0 | print {$dest} $MAKEFILE; | |||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||
| 860 | else { | ||||||||||||||||||||||||||||||||||
| 861 | 0 | ▶ | open my $fh, '>', $dest | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 862 | or die "ERROR: could not open $dest for writing: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||
| 864 | 0 | print {$fh} $MAKEFILE; | |||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | close $fh | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 867 | or die "ERROR: could not close $dest: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | $self->get_logger->debug( sub { return $MAKEFILE } ); | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||
| 872 | 0 | $self->write_buildspec_file( \%buildspec ); | |||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||
| 874 | 0 | return $TRUE; | |||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||
| 877 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 878 | 0 | ▶ | sub write_buildspec_file { | ||||||||||||||||||||||||||||||||
|
Subroutine
write_buildspec_file: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 879 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 880 | 0 | my ( $self, $buildspec ) = @_; | |||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||
| 882 | 0 | my $buildspec_file = $self->get_create_buildspec; | |||||||||||||||||||||||||||||||||
| 883 | 0 | my $overwrite = $self->get_overwrite; | |||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||
| 885 | return | ||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | if !$buildspec_file; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||
| 888 | 0 | ▶ | die "$buildspec_file exists\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e $buildspec_file and not $overwrite
MC/DC0%0/2
-e $buildspec_file and not $overwrite
-e $buildspec_file
not $overwrite
Truth table0%0/3
A and not(B)
A= -e $buildspec_fileB= not $overwrite
| |||||||||||||||||||||||||||||||||||
| 889 | if -e $buildspec_file && !$overwrite; | ||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||
| 891 | 0 | ▶ | open my $fh, '>', $buildspec_file | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 892 | or die "could not open $buildspec_file for writing\n"; | ||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||
| 894 | 0 | print {$fh} Dump($buildspec); | |||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||
| 896 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||
| 898 | 0 | return; | |||||||||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||
| 901 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | sub parse_dependencies { | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_dependencies: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 903 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 904 | 0 | my ( $self, $dependencies ) = @_; | |||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||
| 906 | 0 | ▶ | if ($dependencies) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 907 | croak 'malformed buildspec.yml file - dependencies section with no keys?' | ||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | if !keys %{$dependencies}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | $dependencies->{'core-modules'} //= 'no'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dependencies->{"core-modules"} //= "no"
MC/DC0%0/1
$dependencies->{"core-modules"} //= "no"
$dependencies->{"core-modules"}
Truth table0%0/2
A
A= $dependencies->{"core-modules"}
| |||||||||||||||||||||||||||||||||||
| 911 | 0 | ▶ | $dependencies->{'required-modules'} //= 'yes'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dependencies->{"required-modules"} //= "yes"
MC/DC0%0/1
$dependencies->{"required-modules"} //= "yes"
$dependencies->{"required-modules"}
Truth table0%0/2
A
A= $dependencies->{"required-modules"}
| |||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | if ( $dependencies->{path} ) { # deprecated | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 914 | 0 | $self->set_requires( $dependencies->{path} ); | |||||||||||||||||||||||||||||||||
| 915 | 0 | warn "path is deprecated: use requires\n"; | |||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | if ( $dependencies->{requires} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 919 | 0 | $self->set_requires( $dependencies->{requires} ); | |||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||
| 922 | 0 | ▶ | if ( $dependencies->{'test-requires'} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 923 | 0 | $self->set_test_requires( $dependencies->{'test-requires'} ); | |||||||||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | if ( $dependencies->{'build-requires'} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 927 | 0 | $self->set_build_requires( $dependencies->{'build-requires'} ); | |||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | if ( $dependencies->{recommends} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 931 | 0 | $self->set_recommends( $dependencies->{recommends} ); | |||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||
| 934 | 0 | ▶ | if ( $dependencies->{suggests} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 935 | 0 | $self->set_suggests( $dependencies->{suggests} ); | |||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||
| 938 | 0 | ▶ | if ( $dependencies->{'core-modules'} eq 'yes' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 939 | 0 | $self->set_core_modules($TRUE); | |||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||
| 942 | # NOTE: required-modules and resolver have no corresponding | ||||||||||||||||||||||||||||||||||
| 943 | # CLI::Simple accessor (not in option_specs, no extra_options | ||||||||||||||||||||||||||||||||||
| 944 | # declared) -- there is currently nowhere valid to apply these | ||||||||||||||||||||||||||||||||||
| 945 | # buildspec.yml values. Preserved here as parsed/validated but | ||||||||||||||||||||||||||||||||||
| 946 | # intentionally not applied; flagging rather than guessing at | ||||||||||||||||||||||||||||||||||
| 947 | # attribute names that don't exist. | ||||||||||||||||||||||||||||||||||
| 948 | 0 | my $required_modules_requested = $dependencies->{'required-modules'} eq 'no'; | |||||||||||||||||||||||||||||||||
| 949 | 0 | my $resolver = $dependencies->{resolver}; | |||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||
| 951 | 0 | ▶ | if ( $self->get_requires && $resolver ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_requires and $resolver
MC/DC0%0/2
$self->get_requires and $resolver
$self->get_requires
$resolver
Truth table0%0/3
A and B
A= $self->get_requiresB= $resolver
| |||||||||||||||||||||||||||||||||||
| 952 | 0 | croak "use either path or resolver for dependencies, but not both\n"; | |||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||
| 956 | 0 | return; | |||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||
| 959 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 960 | 0 | ▶ | sub parse_include_version { | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_include_version: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 961 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 962 | 0 | my ( $self, $version ) = @_; | |||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||
| 964 | return | ||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | if !defined $version; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||
| 967 | 0 | ▶ | if ( $version =~ /(no|0|off)/ixsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 968 | 0 | $self->set_require_versions($FALSE); | |||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||
| 971 | 0 | return; | |||||||||||||||||||||||||||||||||
| 972 | } | ||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||
| 974 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 975 | 0 | ▶ | sub parse_project { | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_project: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 976 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 977 | 0 | my ( $self, $project ) = @_; | |||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||
| 979 | return | ||||||||||||||||||||||||||||||||||
| 980 | 0 | ▶ | if !$project; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | if ( $project->{author} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | my $name = $project->{author}->{name} // 'anonymouse'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$project->{"author"}{"name"} // "anonymouse"
MC/DC0%0/1
$project->{"author"}{"name"} // "anonymouse"
$project->{"author"}{"name"}
Truth table0%0/2
A
A= $project->{"author"}{"name"}
| |||||||||||||||||||||||||||||||||||
| 984 | 0 | my $author = $name; | |||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | if ( my $mailto = $project->{author}->{mailto} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 987 | 0 | $author .= ' <' . $mailto . '>'; | |||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||
| 990 | 0 | $self->set_author($author); | |||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||
| 993 | 0 | ▶ | if ( my $description = $project->{description} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 994 | 0 | $self->set_abstract($description); | |||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||
| 997 | # NOTE: 'git' has no corresponding CLI::Simple accessor (not in | ||||||||||||||||||||||||||||||||||
| 998 | # option_specs, no extra_options declared) -- there is currently | ||||||||||||||||||||||||||||||||||
| 999 | # nowhere valid to apply this buildspec.yml value. Left unapplied | ||||||||||||||||||||||||||||||||||
| 1000 | # rather than guessing at an attribute name that doesn't exist. | ||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||
| 1002 | 0 | return; | |||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||
| 1005 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1006 | 0 | ▶ | sub parse_pm_module { | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_pm_module: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 1007 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1008 | 0 | my ( $self, $pm_module ) = @_; | |||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||
| 1010 | return | ||||||||||||||||||||||||||||||||||
| 1011 | 0 | ▶ | if !$pm_module; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||
| 1013 | 0 | $self->set_module($pm_module); | |||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||
| 1015 | 0 | return; | |||||||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||
| 1018 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1019 | 0 | ▶ | sub read_buildspec { | ||||||||||||||||||||||||||||||||
|
Subroutine
read_buildspec: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 1020 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1021 | 0 | my ( $self, $file ) = @_; | |||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||
| 1023 | 0 | ▶ | croak 'file not found or empty ' . $file . $NL | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1024 | if !-s $file; | ||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||
| 1026 | 0 | local $RS = undef; | |||||||||||||||||||||||||||||||||
| 1027 | 0 | ▶ | open my $fh, '<', $file or croak "could not open $file: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1028 | 0 | my $text = <$fh>; | |||||||||||||||||||||||||||||||||
| 1029 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||
| 1031 | 0 | my $normalized = ( | |||||||||||||||||||||||||||||||||
| 1032 | $text =~ s/^(\s*)(\w+)(\s*:)/ | ||||||||||||||||||||||||||||||||||
| 1033 | 0 | my ($pre, $key, $post) = ($1, $2, $3); | |||||||||||||||||||||||||||||||||
| 1034 | 0 | $key =~ s|_|-|g; | |||||||||||||||||||||||||||||||||
| 1035 | 0 | "$pre$key$post"/xsmgre | |||||||||||||||||||||||||||||||||
| 1036 | ); | ||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||
| 1038 | 0 | ▶ | if ( $normalized ne $text ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1039 | 0 | my $current = $file . '.current'; | |||||||||||||||||||||||||||||||||
| 1040 | 0 | ▶ | open my $out, '>', $current or croak "could not write $current: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1041 | 0 | print {$out} $normalized; | |||||||||||||||||||||||||||||||||
| 1042 | 0 | close $out; | |||||||||||||||||||||||||||||||||
| 1043 | 0 | $self->get_logger->warn("deprecated underscore keys found - normalized buildspec written to $current"); | |||||||||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||||
| 1046 | 0 | my $buildspec = eval { Load($normalized) }; | |||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||
| 1048 | 0 | ▶ | croak 'could not read ' . $file . $NL . $EVAL_ERROR . $NL | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$CPAN::Maker::EVAL_ERROR or not $buildspec
MC/DC0%0/2
$CPAN::Maker::EVAL_ERROR or not $buildspec
$CPAN::Maker::EVAL_ERROR
not $buildspec
Truth table0%0/3
A or not(B)
A= $CPAN::Maker::EVAL_ERRORB= not $buildspec
| |||||||||||||||||||||||||||||||||||
| 1049 | if $EVAL_ERROR || !$buildspec; | ||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||
| 1051 | 0 | return $buildspec; | |||||||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||
| 1054 | # this method converts a buildspec into options to be passed to shell script | ||||||||||||||||||||||||||||||||||
| 1055 | # which eventually calls this script to create the Makefile.PL | ||||||||||||||||||||||||||||||||||
| 1056 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1057 | 0 | ▶ | sub parse_buildspec { | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_buildspec: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 1058 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1059 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||||
| 1061 | 0 | my $file = $self->get_buildspec; | |||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||
| 1063 | 0 | my $project_root = $self->get_project_root; | |||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||
| 1065 | 0 | my $buildspec = $self->read_buildspec($file); | |||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||
| 1067 | 0 | ▶ | croak 'invalid buildspec.yml' | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1068 | if !$self->validate_buildspec($buildspec); | ||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||
| 1070 | 0 | ▶ | if ( $buildspec->{license} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1071 | 0 | $self->set_license( $buildspec->{license} ); | |||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||
| 1074 | 0 | ▶ | if ( $buildspec->{'min-perl-version'} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1075 | 0 | $self->set_min_perl_version( $buildspec->{'min-perl-version'} ); | |||||||||||||||||||||||||||||||||
| 1076 | } | ||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||
| 1078 | 0 | ▶ | if ( $buildspec->{'version-from'} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1079 | 0 | $self->set_version_from( $buildspec->{'version-from'} ); | |||||||||||||||||||||||||||||||||
| 1080 | } | ||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||
| 1082 | 0 | ▶ | if ( $buildspec->{'exe-files'} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1083 | 0 | $self->set_exe_files( $self->create_temp_filelist( $project_root, $buildspec->{'exe-files'} ) ); | |||||||||||||||||||||||||||||||||
| 1084 | } | ||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||
| 1086 | 0 | ▶ | if ( $buildspec->{tests} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1087 | 0 | $self->set_tests_path( $self->create_temp_filelist( $project_root, $buildspec->{tests} ) ); | |||||||||||||||||||||||||||||||||
| 1088 | } | ||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||
| 1090 | 0 | ▶ | if ( $buildspec->{scripts} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1091 | 0 | $self->set_scripts_path( $self->create_temp_filelist( $project_root, $buildspec->{scripts} ) ); | |||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||
| 1094 | 0 | $self->write_resources( $buildspec->{resources} ); | |||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||
| 1096 | 0 | $self->parse_project( $buildspec->{project} ); | |||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||
| 1098 | 0 | $self->parse_pm_module( $buildspec->{'pm-module'} ); | |||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||
| 1100 | 0 | $self->parse_include_version( $buildspec->{'include-version'} ); | |||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||
| 1102 | 0 | $self->parse_dependencies( $buildspec->{dependencies} ); | |||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||
| 1104 | 0 | $self->parse_path( $project_root, $buildspec->{path} ); | |||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||
| 1106 | $self->write_extra_files( | ||||||||||||||||||||||||||||||||||
| 1107 | extra_files => $buildspec->{'extra-files'}, | ||||||||||||||||||||||||||||||||||
| 1108 | extra => $buildspec->{extra}, | ||||||||||||||||||||||||||||||||||
| 1109 | 0 | project_root => $project_root, | |||||||||||||||||||||||||||||||||
| 1110 | ); | ||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||
| 1112 | 0 | ▶ | if ( $buildspec->{provides} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1113 | $self->write_provides( | ||||||||||||||||||||||||||||||||||
| 1114 | provides => $buildspec->{provides}, | ||||||||||||||||||||||||||||||||||
| 1115 | 0 | file => 'provides', | |||||||||||||||||||||||||||||||||
| 1116 | ); | ||||||||||||||||||||||||||||||||||
| 1117 | } | ||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||
| 1119 | 0 | $self->write_pl_files( $buildspec->{'pl-files'} ); | |||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||
| 1121 | 0 | ▶ | if ( my $links = $buildspec->{'man-links'} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1122 | 0 | my $man_links_content = $self->_generate_man_links($links); | |||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||
| 1124 | 0 | my ( $fh, $filename ) = tempfile( 'make-cpan-dist-XXXXX', TMPDIR => $TRUE ); | |||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||
| 1126 | # preserve existing postamble if one was specified | ||||||||||||||||||||||||||||||||||
| 1127 | 0 | ▶ | if ( my $postamble = $self->get_postamble ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1128 | 0 | ▶ | if ( -e $postamble ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1129 | 0 | local $RS = undef; | |||||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | open my $existing, '<', $postamble | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1131 | or die "could not read postamble $postamble: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 1132 | 0 | print {$fh} <$existing>; | |||||||||||||||||||||||||||||||||
| 1133 | 0 | close $existing; | |||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||
| 1137 | 0 | print {$fh} $man_links_content; | |||||||||||||||||||||||||||||||||
| 1138 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||
| 1140 | 0 | $self->set_postamble($filename); | |||||||||||||||||||||||||||||||||
| 1141 | } | ||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||
| 1143 | 0 | ▶ | if ( $buildspec->{destdir} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1144 | 0 | $self->set_destdir( $buildspec->{destdir} ); | |||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||
| 1147 | # NOTE: top-level buildspec 'extra' has no corresponding | ||||||||||||||||||||||||||||||||||
| 1148 | # CLI::Simple accessor (not in option_specs, no extra_options | ||||||||||||||||||||||||||||||||||
| 1149 | # declared) -- it is still applied where it's actually used, as the | ||||||||||||||||||||||||||||||||||
| 1150 | # extra-files output path in write_extra_files above. | ||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||
| 1152 | 0 | return; | |||||||||||||||||||||||||||||||||
| 1153 | } | ||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||
| 1155 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1156 | 0 | ▶ | sub _generate_man_links { | ||||||||||||||||||||||||||||||||
|
Subroutine
_generate_man_links: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||
| 1157 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1158 | 0 | my ( $self, $links ) = @_; | |||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||
| 1160 | 0 | my $content = q{}; | |||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||
| 1162 | 0 | for my $entry ( @{$links} ) { | |||||||||||||||||||||||||||||||||
| 1163 | 0 | for my $p ( pairs %{$entry} ) { | |||||||||||||||||||||||||||||||||
| 1164 | 0 | my ( $alias, $module ) = @{$p}; | |||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||
| 1166 | # derive the .pm path from the module name and check for POD | ||||||||||||||||||||||||||||||||||
| 1167 | 0 | ( my $pm_path = "lib/$module.pm" ) =~ s|::|/|gxsm; | |||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||
| 1169 | 0 | ▶ | if ( -e $pm_path ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1170 | 0 | ▶ | my $pm_content = eval { slurp($pm_path) } // q{}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
eval {
do {
slurp($pm_path)
}
} // ""
MC/DC0%0/1
eval {
do {
slurp($pm_path)
}
} // ""
eval {
do {
slurp($pm_path)
}
}
Truth table0%0/2
A
A= eval {
do {
slurp($pm_path)
}
}
| |||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||
| 1172 | 0 | ▶ | if ( $pm_content !~ /^=(head\d|pod|over|item|begin|encoding)/xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1173 | 0 | next; | |||||||||||||||||||||||||||||||||
| 1174 | } | ||||||||||||||||||||||||||||||||||
| 1175 | } | ||||||||||||||||||||||||||||||||||
| 1176 | else { | ||||||||||||||||||||||||||||||||||
| 1177 | 0 | next; | |||||||||||||||||||||||||||||||||
| 1178 | } | ||||||||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||||||||
| 1180 | 0 | $content .= <<"POSTAMBLE"; | |||||||||||||||||||||||||||||||||
| 1181 | install :: | ||||||||||||||||||||||||||||||||||
| 1182 | \t-\$(NOECHO) ln -sf \$(INSTALLMAN3DIR)/$module.3pm \$(DESTINSTALLMAN3DIR)/$alias.3pm; \ | ||||||||||||||||||||||||||||||||||
| 1183 | \t\$(NOECHO) echo \$(INSTALLMAN3DIR)/$alias.3pm >> \$(DESTINSTALLSITEARCH)/auto/\$(FULLEXT)/.packlist | ||||||||||||||||||||||||||||||||||
| 1184 | POSTAMBLE | ||||||||||||||||||||||||||||||||||
| 1185 | } | ||||||||||||||||||||||||||||||||||
| 1186 | } | ||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||
| 1188 | 0 | return $content; | |||||||||||||||||||||||||||||||||
| 1189 | } | ||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||
| 1191 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1192 | 0 | ▶ | sub fetch_requires { | ||||||||||||||||||||||||||||||||
|
Subroutine
fetch_requires: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 1193 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1194 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||||
| 1196 | my ( $requires, $core_modules, $min_perl_version, $include_version ) | ||||||||||||||||||||||||||||||||||
| 1197 | 0 | = @args{qw(requires include_core_modules min_perl_version include_version)}; | |||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||
| 1199 | 0 | my $logger = $self->get_logger; | |||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||
| 1201 | 0 | $logger->trace( sprintf 'processing %s file', $requires ); | |||||||||||||||||||||||||||||||||
| 1202 | 0 | ▶ | $logger->trace( sprintf "\t include_version: [%s]", $include_version ? 'yes' : 'no' ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1203 | 0 | $logger->trace( sprintf "\tmin_perl_version: [%s]", $min_perl_version ); | |||||||||||||||||||||||||||||||||
| 1204 | 0 | ▶ | $logger->trace( sprintf "\t core_modules: [%s]", $core_modules ? 'yes' : 'no' ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||
| 1206 | 0 | my %modules; | |||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||
| 1208 | process_file( | ||||||||||||||||||||||||||||||||||
| 1209 | $requires, | ||||||||||||||||||||||||||||||||||
| 1210 | chomp => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1211 | skip_blank_lines => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1212 | skip_comments => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1213 | 0 | ▶ | filter => sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||
| 1214 | 0 | my ( $fh, $all_lines, $args, $line ) = @_; | |||||||||||||||||||||||||||||||||
| 1215 | 0 | $line = filter( $fh, $all_lines, $args, $line ); | |||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||
| 1217 | 0 | ▶ | return () if $line && $line =~ /^perl\s+/xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$line and $line =~ /^perl\s+/msx
MC/DC0%0/2
$line and $line =~ /^perl\s+/msx
$line
$line =~ /^perl\s+/msx
Truth table0%0/3
A and B
A= $lineB= $line =~ /^perl\s+/msx
| |||||||||||||||||||||||||||||||||||
| 1218 | 0 | ▶ | return $line if !defined $line; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1219 | 0 | ▶ | return $line if $core_modules; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1220 | 0 | ▶ | return $line if $line =~ /^[+]/xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1221 | 0 | ▶ | return is_core( $line, $min_perl_version ) ? undef : $line; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1222 | }, | ||||||||||||||||||||||||||||||||||
| 1223 | 0 | ▶ | process => sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 1224 | 0 | my $line = pop @_; | |||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||
| 1226 | 0 | $line =~ s/^[+]//xsm; | |||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||
| 1228 | 0 | my ( $module, $version ) = split /\s+/xsm, $line; | |||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||
| 1230 | 0 | $logger->trace( sprintf "\tprocessing line (%s): %s", basename($requires), $line ); | |||||||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||||||||
| 1232 | 0 | ▶ | $logger->trace( sprintf "\t\t[%s:%s]", $module, $version // $EMPTY ); | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$version // $CPAN::Maker::EMPTY
MC/DC0%0/2
$version // $CPAN::Maker::EMPTY
$version
$CPAN::Maker::EMPTY
Truth table0%0/3
A // B
A= $versionB= $CPAN::Maker::EMPTY
| |||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||
| 1234 | 0 | ▶ | if ( !$include_version ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1235 | 0 | $version = '0'; | |||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||
| 1237 | else { | ||||||||||||||||||||||||||||||||||
| 1238 | 0 | ▶ | $version ||= '0'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$version ||= 0
MC/DC0%0/1
$version ||= 0
$version
Truth table0%0/2
A
A= $version
| |||||||||||||||||||||||||||||||||||
| 1239 | } | ||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||
| 1241 | 0 | $modules{$module} = $version; | |||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||
| 1243 | 0 | return $line; | |||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||||
| 1245 | 0 | ); | |||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||
| 1247 | 0 | return \%modules; | |||||||||||||||||||||||||||||||||
| 1248 | } | ||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||
| 1250 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1251 | 0 | ▶ | sub get_modules { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_modules: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 1252 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1253 | 0 | my ( $self, $module_list ) = @_; | |||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||
| 1255 | 0 | my ($modules) = process_file( $module_list, chomp => $TRUE ); | |||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||
| 1257 | 0 | return $modules; | |||||||||||||||||||||||||||||||||
| 1258 | } | ||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||
| 1260 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1261 | 0 | ▶ | sub validate_buildspec { | ||||||||||||||||||||||||||||||||
|
Subroutine
validate_buildspec: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 1262 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1263 | 0 | my ( $self, $buildspec ) = @_; | |||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||
| 1265 | 0 | ▶ | return $TRUE | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1266 | if !$self->get_validate; | ||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||
| 1268 | 0 | my $schema_file = eval { dist_file( 'CPAN-Maker', 'buildspec-schema.json' ) }; | |||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||
| 1270 | 0 | ▶ | if ( !$schema_file || !-e $schema_file ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$schema_file and -e $schema_file
MC/DC0%0/2
$schema_file and -e $schema_file
$schema_file
-e $schema_file
Truth table0%0/3
A and B
A= $schema_fileB= -e $schema_file
| |||||||||||||||||||||||||||||||||||
| 1271 | 0 | $self->get_logger->warn('buildspec-schema.json not found - skipping validation'); | |||||||||||||||||||||||||||||||||
| 1272 | 0 | return $TRUE; | |||||||||||||||||||||||||||||||||
| 1273 | } | ||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||
| 1275 | 0 | my @errors = JSON::Validator->new->schema($schema_file)->validate($buildspec); | |||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||
| 1277 | 0 | ▶ | if (@errors) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1278 | 0 | $self->get_logger->error('buildspec.yml validation failed:'); | |||||||||||||||||||||||||||||||||
| 1279 | 0 | $self->get_logger->error( ' - ' . $_ ) for @errors; | |||||||||||||||||||||||||||||||||
| 1280 | 0 | return $FALSE; | |||||||||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||
| 1283 | 0 | return $TRUE; | |||||||||||||||||||||||||||||||||
| 1284 | } | ||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||
| 1286 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1287 | 0 | ▶ | sub _min_perl_version { | ||||||||||||||||||||||||||||||||
|
Subroutine
_min_perl_version: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 1288 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1289 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||
| 1291 | 0 | ▶ | my $min_perl_version = choose { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 1292 | 0 | ▶ | return $self->get_min_perl_version | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1293 | if $self->get_min_perl_version; | ||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||
| 1295 | 0 | ▶ | return $self->fetch_perl_version( $self->get_requires ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1296 | if $self->get_requires; | ||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||
| 1298 | 0 | return $DEFAULT_PERL_VERSION; | |||||||||||||||||||||||||||||||||
| 1299 | 0 | }; | |||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||
| 1301 | 0 | $min_perl_version = version->parse($min_perl_version)->stringify; | |||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||
| 1303 | 0 | $self->set_min_perl_version($min_perl_version); | |||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||
| 1305 | 0 | return; | |||||||||||||||||||||||||||||||||
| 1306 | } | ||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||
| 1308 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1309 | # _run_cmd: run an external command, logging its output. | ||||||||||||||||||||||||||||||||||
| 1310 | # | ||||||||||||||||||||||||||||||||||
| 1311 | # STDERR is deliberately merged into STDOUT (via '>&STDOUT') so we read | ||||||||||||||||||||||||||||||||||
| 1312 | # a SINGLE pipe with a SINGLE loop below. This is not cosmetic -- it | ||||||||||||||||||||||||||||||||||
| 1313 | # avoids a classic IPC::Open3 deadlock. | ||||||||||||||||||||||||||||||||||
| 1314 | # | ||||||||||||||||||||||||||||||||||
| 1315 | # The deadlock we are avoiding: open3 connects the child's STDOUT and | ||||||||||||||||||||||||||||||||||
| 1316 | # STDERR to two separate pipes, each with a fixed (~64K) kernel buffer. | ||||||||||||||||||||||||||||||||||
| 1317 | # If the parent drains one pipe to EOF *before* reading the other (e.g. | ||||||||||||||||||||||||||||||||||
| 1318 | # `while (<$out>) {...} while (<$err>) {...}`), a child that emits more | ||||||||||||||||||||||||||||||||||
| 1319 | # than a buffer's worth on the *second* stream blocks in write(), the | ||||||||||||||||||||||||||||||||||
| 1320 | # parent won't read that stream until the first hits EOF, and the first | ||||||||||||||||||||||||||||||||||
| 1321 | # never EOFs because the child can't exit -- both sides wait forever. | ||||||||||||||||||||||||||||||||||
| 1322 | # | ||||||||||||||||||||||||||||||||||
| 1323 | # This stayed hidden for small services (output < one buffer) and only | ||||||||||||||||||||||||||||||||||
| 1324 | # surfaced on large APIs like CloudFront, whose `make manifest`/`make | ||||||||||||||||||||||||||||||||||
| 1325 | # dist` emit enough output to fill a pipe. Merging the streams removes | ||||||||||||||||||||||||||||||||||
| 1326 | # the second pipe entirely, so there is nothing to block on. | ||||||||||||||||||||||||||||||||||
| 1327 | # | ||||||||||||||||||||||||||||||||||
| 1328 | # Do NOT "fix" this by making the handles hot/autoflush -- that changes | ||||||||||||||||||||||||||||||||||
| 1329 | # WHEN bytes are written, not the pipe capacity or who drains it, and if | ||||||||||||||||||||||||||||||||||
| 1330 | # anything makes the deadlock more reliable. The only real fixes are to | ||||||||||||||||||||||||||||||||||
| 1331 | # drain both streams concurrently or to merge them (done here). If the | ||||||||||||||||||||||||||||||||||
| 1332 | # STDERR/STDOUT split is ever needed back, switch to IPC::Run3, which | ||||||||||||||||||||||||||||||||||
| 1333 | # spools each stream to a temp file and sidesteps the deadlock that way. | ||||||||||||||||||||||||||||||||||
| 1334 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||||
| 1336 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1337 | 0 | ▶ | sub _run_cmd { | ||||||||||||||||||||||||||||||||
|
Subroutine
_run_cmd: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||
| 1338 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1339 | 0 | my ( $self, @cmd ) = @_; | |||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||
| 1341 | 0 | $self->get_logger->info( join $SPACE, @cmd ); | |||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||
| 1343 | 0 | my $pid = open3( my $in, my $out, '>&STDOUT', @cmd ); # child STDERR dup'd onto STDOUT | |||||||||||||||||||||||||||||||||
| 1344 | 0 | close $in; | |||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||
| 1346 | 0 | ▶ | while ( my $line = <$out> ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1347 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||
| 1348 | 0 | $self->get_logger->info($line); | |||||||||||||||||||||||||||||||||
| 1349 | } | ||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||
| 1351 | 0 | waitpid $pid, 0; | |||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||
| 1353 | 0 | return $CHILD_ERROR >> 8; | |||||||||||||||||||||||||||||||||
| 1354 | } | ||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||
| 1356 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1357 | 0 | ▶ | sub stage_distribution { | ||||||||||||||||||||||||||||||||
|
Subroutine
stage_distribution: not called CC=30 SCAR=68.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 1358 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1359 | 0 | my ( $self, %params ) = @_; | |||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||
| 1361 | 0 | my ($builddir) = @params{qw(builddir)}; | |||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||
| 1363 | 0 | my $buildspec = $self->read_buildspec( $self->get_buildspec ); | |||||||||||||||||||||||||||||||||
| 1364 | 0 | my $project_root = $self->get_project_root; | |||||||||||||||||||||||||||||||||
| 1365 | |||||||||||||||||||||||||||||||||||
| 1366 | # --- lib/ --- | ||||||||||||||||||||||||||||||||||
| 1367 | 0 | ▶ | my $pm_path = $self->get_module_path // $buildspec->{path}{'pm-module'} // 'lib'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/5
($self->get_module_path // $buildspec->{"path"}{"pm-module"}) // "lib"
$self->get_module_path // $buildspec->{"path"}{"pm-module"}
MC/DC0%0/2
($self->get_module_path // $buildspec->{"path"}{"pm-module"}) // "lib"
$self->get_module_path
$buildspec->{"path"}{"pm-module"}
Truth table0%0/3
A // B
A= $self->get_module_pathB= $buildspec->{"path"}{"pm-module"}
| |||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||
| 1369 | 0 | ▶ | if ( $pm_path !~ /^\//xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1370 | 0 | $pm_path = "$project_root/$pm_path"; | |||||||||||||||||||||||||||||||||
| 1371 | } | ||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||
| 1373 | 0 | ▶ | if ( -d $pm_path ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1374 | find( | ||||||||||||||||||||||||||||||||||
| 1375 | { follow => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1376 | 0 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 1377 | 0 | ▶ | return if -d $_; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1378 | 0 | ▶ | return if !/[.](?:pm|pod)$/xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||
| 1380 | 0 | my $rel = $File::Find::name; | |||||||||||||||||||||||||||||||||
| 1381 | 0 | $rel =~ s{^\Q$pm_path\E/?}{}xsm; | |||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||
| 1383 | 0 | my $dest = "$builddir/lib/$rel"; | |||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||
| 1385 | 0 | make_path( File::Basename::dirname($dest) ); | |||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||
| 1387 | 0 | ▶ | cp( $File::Find::name, $dest ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1388 | or die "ERROR: could not copy $File::Find::name to $dest: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||||
| 1390 | 0 | return; | |||||||||||||||||||||||||||||||||
| 1391 | }, | ||||||||||||||||||||||||||||||||||
| 1392 | }, | ||||||||||||||||||||||||||||||||||
| 1393 | 0 | $pm_path, | |||||||||||||||||||||||||||||||||
| 1394 | ); | ||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||
| 1396 | 0 | my ( $fh, $provides_file ) = tempfile( 'cpan-maker-provides-XXXXXX', TMPDIR => $TRUE ); | |||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||||
| 1398 | 0 | close $fh; | |||||||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||||||||
| 1400 | 0 | $self->create_provides( | |||||||||||||||||||||||||||||||||
| 1401 | path => "$builddir/lib", | ||||||||||||||||||||||||||||||||||
| 1402 | file => $provides_file, | ||||||||||||||||||||||||||||||||||
| 1403 | ); | ||||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||||
| 1405 | # Explicit provides are additional package declarations, not replacements | ||||||||||||||||||||||||||||||||||
| 1406 | # for the staged module inventory. Preserve them for write_makefile(). | ||||||||||||||||||||||||||||||||||
| 1407 | 0 | ▶ | if ( my $declared = $buildspec->{provides} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1408 | 0 | ▶ | open my $out, '>>', $provides_file | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1409 | or croak "could not append to '$provides_file': $OS_ERROR"; | ||||||||||||||||||||||||||||||||||
| 1410 | 0 | $self->_write_provides( $out, $declared ); | |||||||||||||||||||||||||||||||||
| 1411 | 0 | ▶ | close $out | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1412 | or croak "could not close '$provides_file': $OS_ERROR"; | ||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||
| 1415 | 0 | $params{provides_file_ref} = \$provides_file; | |||||||||||||||||||||||||||||||||
| 1416 | } | ||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||
| 1418 | # --- bin/ (exe-files) --- | ||||||||||||||||||||||||||||||||||
| 1419 | 0 | ▶ | my $exe_path = $self->get_exec_path // $buildspec->{path}{'exe-files'}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_exec_path // $buildspec->{"path"}{"exe-files"}
MC/DC0%0/2
$self->get_exec_path // $buildspec->{"path"}{"exe-files"}
$self->get_exec_path
$buildspec->{"path"}{"exe-files"}
Truth table0%0/3
A // B
A= $self->get_exec_pathB= $buildspec->{"path"}{"exe-files"}
| |||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||
| 1421 | 0 | ▶ | if ($exe_path) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1422 | 0 | ▶ | if ( $exe_path !~ /^\//xsm ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1423 | 0 | $exe_path = "$project_root/$exe_path"; | |||||||||||||||||||||||||||||||||
| 1424 | } | ||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||
| 1426 | 0 | ▶ | if ( -d $exe_path ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1427 | 0 | make_path("$builddir/bin"); | |||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||
| 1429 | 0 | my ( $list_fh, $list_file ) = tempfile( 'cpan-maker-exe-XXXXXX', TMPDIR => $TRUE ); | |||||||||||||||||||||||||||||||||
| 1430 | |||||||||||||||||||||||||||||||||||
| 1431 | find( | ||||||||||||||||||||||||||||||||||
| 1432 | { follow => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1433 | 0 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 1434 | 0 | ▶ | return if -d $_ || !-x $_; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $_ or not -x $_
MC/DC0%0/2
-d $_ or not -x $_
-d $_
not -x $_
Truth table0%0/3
A or not(B)
A= -d $_B= not -x $_
| |||||||||||||||||||||||||||||||||||
| 1435 | 0 | my $dest = "$builddir/bin/" . File::Basename::basename($File::Find::name); | |||||||||||||||||||||||||||||||||
| 1436 | 0 | ▶ | cp( $File::Find::name, $dest ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1437 | or die "ERROR: could not copy $File::Find::name: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 1438 | 0 | print {$list_fh} "$dest\n"; | |||||||||||||||||||||||||||||||||
| 1439 | }, | ||||||||||||||||||||||||||||||||||
| 1440 | }, | ||||||||||||||||||||||||||||||||||
| 1441 | 0 | $exe_path, | |||||||||||||||||||||||||||||||||
| 1442 | ); | ||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||
| 1444 | 0 | close $list_fh; | |||||||||||||||||||||||||||||||||
| 1445 | 0 | $self->set_exec_path($list_file); | |||||||||||||||||||||||||||||||||
| 1446 | } | ||||||||||||||||||||||||||||||||||
| 1447 | } | ||||||||||||||||||||||||||||||||||
| 1448 | |||||||||||||||||||||||||||||||||||
| 1449 | # --- t/ --- | ||||||||||||||||||||||||||||||||||
| 1450 | 0 | ▶ | my $tests_path = $self->get_tests_path // $buildspec->{path}{tests}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_tests_path // $buildspec->{"path"}{"tests"}
MC/DC0%0/2
$self->get_tests_path // $buildspec->{"path"}{"tests"}
$self->get_tests_path
$buildspec->{"path"}{"tests"}
Truth table0%0/3
A // B
A= $self->get_tests_pathB= $buildspec->{"path"}{"tests"}
| |||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||
| 1452 | 0 | ▶ | if ($tests_path) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1453 | 0 | ▶ | $tests_path = "$project_root/$tests_path" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1454 | if $tests_path !~ /^\//xsm; | ||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||
| 1456 | 0 | ▶ | if ( -d $tests_path ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1457 | 0 | make_path("$builddir/t"); | |||||||||||||||||||||||||||||||||
| 1458 | find( | ||||||||||||||||||||||||||||||||||
| 1459 | { follow => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1460 | 0 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 1461 | 0 | ▶ | return if -d $_ || !/\.t$/xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $_ or not /\.t$/msx
MC/DC0%0/2
-d $_ or not /\.t$/msx
-d $_
not /\.t$/msx
Truth table0%0/3
A or not(B)
A= -d $_B= not /\.t$/msx
| |||||||||||||||||||||||||||||||||||
| 1462 | 0 | ▶ | cp( $File::Find::name, "$builddir/t/" . File::Basename::basename($File::Find::name) ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1463 | or die "ERROR: could not copy $File::Find::name: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 1464 | }, | ||||||||||||||||||||||||||||||||||
| 1465 | }, | ||||||||||||||||||||||||||||||||||
| 1466 | 0 | $tests_path, | |||||||||||||||||||||||||||||||||
| 1467 | ); | ||||||||||||||||||||||||||||||||||
| 1468 | } | ||||||||||||||||||||||||||||||||||
| 1469 | } | ||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||
| 1471 | # --- extra-files --- | ||||||||||||||||||||||||||||||||||
| 1472 | 0 | my $extra_files = $buildspec->{'extra-files'}; | |||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||
| 1474 | 0 | ▶ | if ($extra_files) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1475 | 0 | my @file_list; | |||||||||||||||||||||||||||||||||
| 1476 | 0 | $self->get_logger->debug( Dumper( [ extra_files => $extra_files ] ) ); | |||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||
| 1478 | 0 | for my $e ( @{$extra_files} ) { | |||||||||||||||||||||||||||||||||
| 1479 | 0 | $self->get_logger->debug( Dumper( [ e => $e ] ) ); | |||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||
| 1481 | 0 | ▶ | if ( !ref $e ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 1482 | 0 | push @file_list, | |||||||||||||||||||||||||||||||||
| 1483 | $self->fetch_file_list( | ||||||||||||||||||||||||||||||||||
| 1484 | file_list => [$e], | ||||||||||||||||||||||||||||||||||
| 1485 | destination => $EMPTY, | ||||||||||||||||||||||||||||||||||
| 1486 | project_root => $project_root, | ||||||||||||||||||||||||||||||||||
| 1487 | ); | ||||||||||||||||||||||||||||||||||
| 1488 | } | ||||||||||||||||||||||||||||||||||
| 1489 | elsif ( ref $e eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||
| 1490 | 0 | my ($destdir) = keys %{$e}; | |||||||||||||||||||||||||||||||||
| 1491 | 0 | my $file_list = $e->{$destdir}; | |||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||
| 1493 | 0 | $self->get_logger->debug( | |||||||||||||||||||||||||||||||||
| 1494 | Dumper( | ||||||||||||||||||||||||||||||||||
| 1495 | [ destdir => $destdir, | ||||||||||||||||||||||||||||||||||
| 1496 | file_list => $file_list, | ||||||||||||||||||||||||||||||||||
| 1497 | project_root => $project_root | ||||||||||||||||||||||||||||||||||
| 1498 | ] | ||||||||||||||||||||||||||||||||||
| 1499 | ) | ||||||||||||||||||||||||||||||||||
| 1500 | ); | ||||||||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||||||||
| 1502 | 0 | push @file_list, | |||||||||||||||||||||||||||||||||
| 1503 | $self->fetch_file_list( | ||||||||||||||||||||||||||||||||||
| 1504 | file_list => $file_list, | ||||||||||||||||||||||||||||||||||
| 1505 | destination => $destdir, | ||||||||||||||||||||||||||||||||||
| 1506 | project_root => $project_root, | ||||||||||||||||||||||||||||||||||
| 1507 | ); | ||||||||||||||||||||||||||||||||||
| 1508 | } | ||||||||||||||||||||||||||||||||||
| 1509 | } | ||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||
| 1511 | 0 | ▶ | $builddir ||= getcwd; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$builddir ||= getcwd()
MC/DC0%0/2
$builddir ||= getcwd()
$builddir
getcwd()
Truth table0%0/3
A ||= B
A= $builddirB= getcwd()
| |||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||
| 1513 | 0 | $self->get_logger->debug( Dumper( [ file_list => \@file_list, builddir => $builddir ] ) ); | |||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||
| 1515 | 0 | for my $entry (@file_list) { | |||||||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||||||||
| 1517 | 0 | my ( $src, $dest ) = split /\s+/xsm, $entry, 2; | |||||||||||||||||||||||||||||||||
| 1518 | 0 | $self->get_logger->debug( Dumper( [ src => $src, dest => $dest ] ) ); | |||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||
| 1520 | 0 | ▶ | $src = "$project_root/$src" if $src !~ /^\//xsm; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1521 | 0 | ▶ | $dest = $dest ? "$builddir/$dest" : "$builddir/" . File::Basename::basename($src); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||
| 1523 | 0 | $self->get_logger->debug( Dumper( [ src => $src, dest => $dest ] ) ); | |||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||
| 1525 | 0 | make_path( File::Basename::dirname($dest) ); | |||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||||
| 1527 | 0 | ▶ | cp( $src, $dest ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1528 | or die "ERROR: could not copy $src to $dest: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||
| 1530 | } | ||||||||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||||||||
| 1532 | # --- postamble --- | ||||||||||||||||||||||||||||||||||
| 1533 | 0 | ▶ | my $postamble = $self->get_postamble // $buildspec->{postamble}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->get_postamble // $buildspec->{"postamble"}
MC/DC0%0/2
$self->get_postamble // $buildspec->{"postamble"}
$self->get_postamble
$buildspec->{"postamble"}
Truth table0%0/3
A // B
A= $self->get_postambleB= $buildspec->{"postamble"}
| |||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||
| 1535 | 0 | ▶ | if ( $postamble && -e $postamble ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$postamble and -e $postamble
MC/DC0%0/2
$postamble and -e $postamble
$postamble
-e $postamble
Truth table0%0/3
A and B
A= $postambleB= -e $postamble
| |||||||||||||||||||||||||||||||||||
| 1536 | 0 | ▶ | cp( $postamble, "$builddir/postamble" ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1537 | or die "ERROR: could not copy postamble: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||
| 1538 | } | ||||||||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||||||||
| 1540 | 0 | ▶ | my $provides_file = $params{provides_file_ref} ? ${ $params{provides_file_ref} } : $EMPTY; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||||
| 1542 | 0 | return $provides_file; | |||||||||||||||||||||||||||||||||
| 1543 | } | ||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||
| 1545 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1546 | 0 | ▶ | sub main { | ||||||||||||||||||||||||||||||||
|
Subroutine
main: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 1547 | ######################################################################## | ||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||
| 1549 | 0 | my @option_specs = qw( | |||||||||||||||||||||||||||||||||
| 1550 | abstract|A=s | ||||||||||||||||||||||||||||||||||
| 1551 | author|a=s | ||||||||||||||||||||||||||||||||||
| 1552 | build-requires|B=s | ||||||||||||||||||||||||||||||||||
| 1553 | buildspec|b=s | ||||||||||||||||||||||||||||||||||
| 1554 | cleanup! | ||||||||||||||||||||||||||||||||||
| 1555 | core-modules! | ||||||||||||||||||||||||||||||||||
| 1556 | color! | ||||||||||||||||||||||||||||||||||
| 1557 | create-buildspec=s | ||||||||||||||||||||||||||||||||||
| 1558 | debug|D | ||||||||||||||||||||||||||||||||||
| 1559 | dependency-type=s | ||||||||||||||||||||||||||||||||||
| 1560 | dryrun | ||||||||||||||||||||||||||||||||||
| 1561 | exe-files|e=s | ||||||||||||||||||||||||||||||||||
| 1562 | exec-path=s | ||||||||||||||||||||||||||||||||||
| 1563 | extra-path=s | ||||||||||||||||||||||||||||||||||
| 1564 | help|h | ||||||||||||||||||||||||||||||||||
| 1565 | license=s | ||||||||||||||||||||||||||||||||||
| 1566 | log-level|l=s | ||||||||||||||||||||||||||||||||||
| 1567 | min-perl-version|M=s | ||||||||||||||||||||||||||||||||||
| 1568 | module-path=s | ||||||||||||||||||||||||||||||||||
| 1569 | module|m=s | ||||||||||||||||||||||||||||||||||
| 1570 | overwrite | ||||||||||||||||||||||||||||||||||
| 1571 | outfile|o=s | ||||||||||||||||||||||||||||||||||
| 1572 | pager|P! | ||||||||||||||||||||||||||||||||||
| 1573 | pl-files=s | ||||||||||||||||||||||||||||||||||
| 1574 | postamble=s | ||||||||||||||||||||||||||||||||||
| 1575 | project-root|p=s | ||||||||||||||||||||||||||||||||||
| 1576 | recommends=s | ||||||||||||||||||||||||||||||||||
| 1577 | recurse | ||||||||||||||||||||||||||||||||||
| 1578 | require-versions|R! | ||||||||||||||||||||||||||||||||||
| 1579 | requires|r=s | ||||||||||||||||||||||||||||||||||
| 1580 | resources=s | ||||||||||||||||||||||||||||||||||
| 1581 | destdir=s | ||||||||||||||||||||||||||||||||||
| 1582 | no-cleanup | ||||||||||||||||||||||||||||||||||
| 1583 | preserve-makefile | ||||||||||||||||||||||||||||||||||
| 1584 | scripts-path=s | ||||||||||||||||||||||||||||||||||
| 1585 | skip-tests | ||||||||||||||||||||||||||||||||||
| 1586 | suggests=s | ||||||||||||||||||||||||||||||||||
| 1587 | test-requires|t=s | ||||||||||||||||||||||||||||||||||
| 1588 | tests-path=s | ||||||||||||||||||||||||||||||||||
| 1589 | validate! | ||||||||||||||||||||||||||||||||||
| 1590 | verbose|V | ||||||||||||||||||||||||||||||||||
| 1591 | version-from=s | ||||||||||||||||||||||||||||||||||
| 1592 | version|v | ||||||||||||||||||||||||||||||||||
| 1593 | work-dir|w=s | ||||||||||||||||||||||||||||||||||
| 1594 | ); | ||||||||||||||||||||||||||||||||||
| 1595 | |||||||||||||||||||||||||||||||||||
| 1596 | 0 | my $is_json_validator_available = eval { require JSON::Validator; 1 }; ## scandeps: recommends | |||||||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||||||||
| 1598 | 0 | ▶ | my $default_options = { | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$is_json_validator_available // $CPAN::Maker::FALSE
MC/DC0%0/2
$is_json_validator_available // $CPAN::Maker::FALSE
$is_json_validator_available
$CPAN::Maker::FALSE
Truth table0%0/3
A // B
A= $is_json_validator_availableB= $CPAN::Maker::FALSE
| |||||||||||||||||||||||||||||||||||
| 1599 | cleanup => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1600 | pager => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1601 | require_versions => $TRUE, | ||||||||||||||||||||||||||||||||||
| 1602 | validate => $is_json_validator_available // $FALSE, | ||||||||||||||||||||||||||||||||||
| 1603 | }; | ||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||
| 1605 | 0 | my %commands = ( | |||||||||||||||||||||||||||||||||
| 1606 | 'build' => \&cmd_build, | ||||||||||||||||||||||||||||||||||
| 1607 | 'create-cpanfile' => \&cmd_create_cpanfile, | ||||||||||||||||||||||||||||||||||
| 1608 | 'default' => \&cmd_build, | ||||||||||||||||||||||||||||||||||
| 1609 | 'validate' => \&cmd_validate, | ||||||||||||||||||||||||||||||||||
| 1610 | 'version' => \&cmd_version, | ||||||||||||||||||||||||||||||||||
| 1611 | 'write-makefile' => \&cmd_makefile, | ||||||||||||||||||||||||||||||||||
| 1612 | ); | ||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||
| 1614 | 0 | my $cli = CPAN::Maker->new( | |||||||||||||||||||||||||||||||||
| 1615 | commands => \%commands, | ||||||||||||||||||||||||||||||||||
| 1616 | option_specs => \@option_specs, | ||||||||||||||||||||||||||||||||||
| 1617 | default_options => $default_options, | ||||||||||||||||||||||||||||||||||
| 1618 | ); | ||||||||||||||||||||||||||||||||||
| 1619 | |||||||||||||||||||||||||||||||||||
| 1620 | 0 | return $cli->run(); | |||||||||||||||||||||||||||||||||
| 1621 | } | ||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||
| 1623 | 1 | 1; | |||||||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||||||||
| 1625 | __END__ | ||||||||||||||||||||||||||||||||||