alienfile

filter: Statementstmt 81.2% 65 / 80 Branchbran 33.3% 8 / 24 Conditioncond 35.2% 6 / 17 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 81.8% 9 / 11 Podpod n/a totaltotal 63.3% 88 / 139 CC 14 SCAR 21.3
CC
14
Cov
65%
pause
20.0
__ANON__
11.5
get_alien_state_hash
3.0
CRAP 8.4
↑ Summary blib/lib/Alien/libtiff/Install/Files.pm »
1 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use alienfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Sort::Versions;
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 1 my $on_windows = $^O =~ /mswin/i;
6 my $on_automated_rig
7 = $ENV{PERL_CPAN_REPORTER_DIR}
8 || $ENV{PERL_CPAN_REPORTER_CONFIG}
9 || $ENV{AUTOMATED_TESTING}
10 || $ENV{TRAVIS}
11 || $ENV{APPVEYOR}
12 1 ▶ || $ENV{CI};
Condition33%5/15
$ENV{'PERL_CPAN_REPORTER_DIR'} || $ENV{'PERL_CPAN_REPORTER_CONFIG'} || $ENV{'AUTOMATED_TESTING'} || $ENV{'TRAVIS'} || $ENV{'APPVEYOR'} || $ENV{'CI'}
l!l&&r!l&&!r
100
$ENV{"PERL_CPAN_REPORTER_DIR"} or $ENV{"PERL_CPAN_REPORTER_CONFIG"} or $ENV{"AUTOMATED_TESTING"} or $ENV{"TRAVIS"} or $ENV{"APPVEYOR"}
l!l&&r!l&&!r
100
$ENV{"PERL_CPAN_REPORTER_DIR"} or $ENV{"PERL_CPAN_REPORTER_CONFIG"} or $ENV{"AUTOMATED_TESTING"} or $ENV{"TRAVIS"}
l!l&&r!l&&!r
100
$ENV{"PERL_CPAN_REPORTER_DIR"} or $ENV{"PERL_CPAN_REPORTER_CONFIG"} or $ENV{"AUTOMATED_TESTING"}
l!l&&r!l&&!r
010
$ENV{"PERL_CPAN_REPORTER_DIR"} or $ENV{"PERL_CPAN_REPORTER_CONFIG"}
l!l&&r!l&&!r
001
MC/DC0%0/6
$ENV{'PERL_CPAN_REPORTER_DIR'} || $ENV{'PERL_CPAN_REPORTER_CONFIG'} || $ENV{'AUTOMATED_TESTING'} || $ENV{'TRAVIS'} || $ENV{'APPVEYOR'} || $ENV{'CI'}
$ENV{"PERL_CPAN_REPORTER_DIR"} $ENV{"PERL_CPAN_REPORTER_CONFIG"} $ENV{"AUTOMATED_TESTING"} $ENV{"TRAVIS"} $ENV{"APPVEYOR"} $ENV{'CI'}
Truth table14%1/7
A or B or C or D or E || F
A= $ENV{"PERL_CPAN_REPORTER_DIR"}B= $ENV{"PERL_CPAN_REPORTER_CONFIG"}C= $ENV{"AUTOMATED_TESTING"}D= $ENV{"TRAVIS"}E= $ENV{"APPVEYOR"}F= $ENV{'CI'}
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
13
14
15 1 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 my $base_dir = getcwd();
17
18 1 ▶use Env qw { @PATH };
Subroutine BEGIN: called CC=1 SCAR=0.0
19
20
21 1 my $min_target_version = '4.0.0';
22
23 1 plugin 'PkgConfig' => (
24 pkg_name => 'libtiff-4',
25 minimum_version => $min_target_version,
26 );
27
28
29 1 ▶share {
Subroutine __ANON__: called CC=9 SCAR=24.4
30
31 1 my $with_local = '';
32 1 my $with_cpp11 = '';
33
34 # need to work out how to get latest without updating next lines
35 1 start_url 'https://download.osgeo.org/libtiff/';
36 1 plugin Download => (
37 filter => qr/^tiff-([0-9\.]+)\.tar\.gz$/,
38 version => qr/^tiff-([0-9\.]+)\.tar\.gz$/,
39 );
40
41
42
43 1 ▶ my $lib_version = get_lib_version() // 'not yet defined';
Condition50%1/2
get_lib_version() // "not yet defined"
l!l
10
MC/DC0%0/1
get_lib_version() // "not yet defined"
get_lib_version()
Truth table50%1/2
A
A= get_lib_version()
Aresult
11
00
44 1 say "Downloaded version is $lib_version";
45
46 1 plugin Extract => (format => 'tar.gz');
47
48
49 1 plugin 'Build::Autoconf' => ();
50
51 1 ▶ my $build_static = ($^O =~ /mswin/i) ? '' : '--disable-shared';
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /mswin/i ? : 0 1 1
52 1 $build_static = '';
53 1 $build_static = '--enable-static=no'; # override - needed? leftover from gdal
54 1 ▶ $build_static = '' if $ENV{FORCE_DYNAMIC};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"FORCE_DYNAMIC"} 0 1 1
55
56
57 1 ▶ if ($^O =~ /bsd/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($^O =~ /bsd/) { } 0 1 1
elsif ($^O =~ /dragonfly/) { } 0 1 1
58 0 plugin 'Build::Make' => 'gmake';
59 0 ▶ if (-d '/usr/local') {
Branch: 1 branch
BranchTrueFalseTotal
if (-d "/usr/local") 0 0 0
60 0 $with_local = ' --with-local=/usr/local ';
61 }
62 }
63 elsif ($^O =~ /dragonfly/) {
64 # might need to be combined with bsd check above
65 # but not sure if /usr/local is needed yet
66 0 plugin 'Build::Make' => 'gmake';
67 }
68
69 1 my $make_cmd = '%{make}';
70 1 my $make_inst_cmd = '%{make} install';
71 1 my @make_clean;
72 # try not to exceed the cpan-testers log limits
73 1 ▶ if ($on_automated_rig) {
Branch: 1 branch
BranchTrueFalseTotal
if ($on_automated_rig) 1 0 1
74 1 say "Running under CI or automated testing";
75 1 $make_cmd .= q/ | perl -ne "BEGIN {$|=1; open our $log, q|>|, q|build.log|}; print qq|\n| if 0 == ($. %% 100); print q|.|; print {$log} $_;" || type build.log/;
76 1 $make_inst_cmd .= q/ | perl -ne "BEGIN {$|=1; open our $log, q|>|, q|install.log|}; print qq|\n| if 0 == ($. %% 100); print q|.|; print {$log} $_;" || type install.log/;
77 1 ▶ if (!$on_windows) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($on_windows) 1 0 1
78 1 $make_cmd =~ s/%%/%/;
79 1 $make_cmd =~ s/type/cat/;
80 1 $make_cmd =~ s/"/'/g;
81 1 $make_inst_cmd =~ s/%%/%/;
82 1 $make_inst_cmd =~ s/type/cat/;
83 1 $make_inst_cmd =~ s/"/'/g;
84 }
85 #if (! ($ENV{TRAVIS} || $ENV{APPVEYOR})) {
86 # push @make_clean, '%{make} clean';
87 #}
88 # clean up the build dir on cpan testers etc
89 1 plugin 'Cleanse::BuildDir';
90 }
91
92 ## remove any git utils from the path
93 ##say join ' ', @PATH;
94 #my $have_git_in_path = grep {$_ =~ m|Git[/\\]usr[/\\]bin|} @PATH;
95 #if ($on_windows && $have_git_in_path) {
96 # warn 'Found Git/usr/bin in path and removed it for compilation';
97 # #say $ENV{PATH};
98 # @PATH = grep {not $_ =~ m|Git[/\\]usr[/\\]bin$|} @PATH;
99 # #say $ENV{PATH};
100 #}
101 meta->around_hook(
102 0 ▶ build => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
103 0 my ($orig, $build, @args) = @_;
104 0 $build->log("Setting CCACHE_BASEDIR to " . getcwd());
105 0 local $ENV{CCACHE_BASEDIR} = getcwd();
106 0 $orig->($build, @args);
107 }
108 1 );
109
110
111 1 build [
112 "%{configure} $with_local $with_cpp11 $build_static --disable-docs",
113 \&pause,
114 $make_cmd,
115 $make_inst_cmd,
116 #@make_clean,
117 ];
118
119 1 };
120
121 0 ▶sub pause {
Subroutine pause: not called CC=4 SCAR=30.0
122 0 return; # re-enable in case of debug
123 0 ▶ return if $on_automated_rig;
Branch: 1 branch
BranchTrueFalseTotal
if $on_automated_rig 0 0 0
124 0 ▶ return if !$on_windows;
Branch: 1 branch
BranchTrueFalseTotal
unless $on_windows 0 0 0
125
126 0 say "CONTINUE?";
127 0 my $response = <>;
128 0 ▶ while (not $response =~ /yes/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $response =~ /yes/) 0 0 0
129 0 $response = <>;
130 }
131 }
132
133
134 1 ▶sub get_lib_version {
Subroutine get_lib_version: called CC=1 SCAR=0.0
135 1 my $h = get_alien_state_hash();
136 1 return $h->{runtime}{version};
137 }
138
139 1 ▶sub get_alien_state_hash {
Subroutine get_alien_state_hash: called CC=3 SCAR=11.0
140 1 ▶ use JSON::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
141 1 my $root = "$base_dir/_alien";
142 1 my $f = "$root/state.json";
143 1 my $h = {};
144 1 ▶ if (-e $f) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $f) 1 0 1
145 1 ▶ open my $fh, '<', $f or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $f or die $! 1 0 1
146 1 my $d = do {
147 1 local $/ = undef;
148 1 <$fh>;
149 };
150 1 $h = JSON::PP::decode_json($d);
151 }
152 1 return $h;
153 }
154
↑ Summary blib/lib/Alien/libtiff/Install/Files.pm »