alienfile

filter: Statementstmt 68.6% 70 / 102 Branchbran 23.3% 7 / 30 Conditioncond 30.4% 7 / 23 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 71.4% 10 / 14 Podpod n/a totaltotal 52.2% 94 / 180 CC 19 SCAR 26.4
CC
19
Cov
54%
remove_gitfw_from_path
42.0
pause
20.0
__ANON__
10.9
CRAP 14.1
↑ Summary blib/lib/Alien/sqlite/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 1 ▶use Path::Tiny qw /path/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6
7 1 my $on_windows = $^O =~ /mswin/i;
8 my $on_automated_rig
9 = $ENV{PERL_CPAN_REPORTER_DIR}
10 || $ENV{PERL_CPAN_REPORTER_CONFIG}
11 || $ENV{AUTOMATED_TESTING}
12 || $ENV{TRAVIS}
13 || $ENV{APPVEYOR}
14 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
15
16
17 1 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 my $base_dir = getcwd();
19
20 # make libtool noisy for debug purposes
21 #$ENV{LTFLAGS} = "--debug --verbose" if $on_windows;
22
23 1 ▶use Env qw { @PATH };
Subroutine BEGIN: called CC=1 SCAR=0.0
24
25
26 # ubuntu 22.04 LTS has this
27 1 my $min_target_version = '3.37.2';
28
29 1 plugin 'PkgConfig' => (
30 pkg_name => 'sqlite3',
31 minimum_version => $min_target_version,
32 );
33
34 1 plugin 'Probe::CommandLine' => (
35 command => 'sqlite3',
36 #args => [ '--version' ],
37 #match => qr/\d+\.\d+\.\d+ \d{4}-\d{2}-\d{2}/,
38 #version => qr/gzip ([0-9\.]+)/,
39 secondary => 1, # secondary to pkgconf probe
40 );
41
42 # need to check if we have sqlite headers
43 # as dependent aliens like proj need them
44 #probe sub {
45 # my($build) = @_; # $build is the Alien::Build instance.
46 # system 'pkg-config --exists libfoo';
47 # $? == 0 ? 'system' : 'share';
48 #};
49
50
51 1 ▶share {
Subroutine __ANON__: called CC=8 SCAR=23.9
52
53 1 my $with_local = '';
54 1 my $with_cpp11 = '';
55
56 # need to work out how to get latest without updating next lines
57 1 start_url 'https://www.sqlite.org/2026/sqlite-autoconf-3540100.tar.gz';
58 1 plugin Download => (
59 version => '3.54.1',
60 );
61
62
63 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
64 1 say "Downloaded version is $lib_version";
65
66 1 plugin Extract => (format => 'tar.gz');
67
68
69 1 plugin 'Build::Autoconf' => (with_pic => 0);
70
71 1 ▶ my $build_static = ($^O =~ /mswin/i) ? '' : '--disable-shared';
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /mswin/i ? : 0 1 1
72 1 $build_static = '';
73 #$build_static = '--enable-static=no'; # override - needed? leftover from gdal
74 1 $build_static = '--disable-static';
75 #$build_static = '' if $ENV{FORCE_DYNAMIC};
76
77
78 1 ▶ if ($^O =~ /bsd$|dragonfly/ or $on_windows) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /bsd$|dragonfly/ or $on_windows) 0 1 1
Condition33%1/3
$^O =~ /bsd$|dragonfly/ or $on_windows
l!l&&r!l&&!r
001
MC/DC0%0/2
$^O =~ /bsd$|dragonfly/ or $on_windows
$^O =~ /bsd$|dragonfly/ $on_windows
Truth table33%1/3
A or B
A= $^O =~ /bsd$|dragonfly/B= $on_windows
ABresult
1X1
011
000
79 0 plugin 'Build::Make' => 'gmake';
80 }
81
82 1 my $make_cmd = '%{make}';
83 1 my $make_inst_cmd = '%{make} install';
84 1 my @make_clean;
85 # try not to exceed the cpan-testers log limits
86 1 ▶ if ($on_automated_rig) {
Branch: 1 branch
BranchTrueFalseTotal
if ($on_automated_rig) 1 0 1
87 1 say "Running under CI or automated testing";
88 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/;
89 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/;
90 1 ▶ if (!$on_windows) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($on_windows) 1 0 1
91 1 $make_cmd =~ s/%%/%/;
92 1 $make_cmd =~ s/type/cat/;
93 1 $make_cmd =~ s/"/'/g;
94 1 $make_inst_cmd =~ s/%%/%/;
95 1 $make_inst_cmd =~ s/type/cat/;
96 1 $make_inst_cmd =~ s/"/'/g;
97 }
98 #if (! ($ENV{TRAVIS} || $ENV{APPVEYOR})) {
99 # push @make_clean, '%{make} clean';
100 #}
101 # clean up the build dir on cpan testers etc
102 1 plugin 'Cleanse::BuildDir';
103 }
104
105 1 meta->around_hook( build => \&remove_gitfw_from_path );
106 meta->around_hook(
107 0 ▶ build => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
108 0 my ($orig, $build, @args) = @_;
109 0 $build->log("Setting CCACHE_BASEDIR to " . getcwd());
110 0 local $ENV{CCACHE_BASEDIR} = getcwd();
111 0 $orig->($build, @args);
112 }
113 1 );
114 1 ▶ if ($on_windows) {
Branch: 1 branch
BranchTrueFalseTotal
if ($on_windows) 0 1 1
115 # avoid some double-path shenanigens on Windows
116 meta->around_hook (
117 0 ▶ build => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
118 0 my ($orig, $build, @args) = @_;
119 local $ENV{DESTDIR} = "$ENV{DESTDIR}/"
120 0 ▶ if not $ENV{DESTDIR} =~ m{/$};
Branch: 1 branch
BranchTrueFalseTotal
unless $ENV{"DESTDIR"} =~ m[/$] 0 0 0
121 0 $build->install_prop->{prefix} = '.';
122 0 local $ENV{CFLAGS} .= ' -D_WIN32_WINNT=0x0600'; # for older Strawberry toolchains
123 0 $orig->($build, @args);
124 }
125 0 );
126 }
127
128 build [
129 1 "%{configure} $build_static $with_local $with_cpp11",
130 #\&pause,
131 $make_cmd,
132 $make_inst_cmd,
133 #@make_clean,
134 ];
135
136 1 };
137
138 # git for windows clashes with MSYS
139 # if its /usr/bin dir is in the path
140 0 ▶sub remove_gitfw_from_path {
Subroutine remove_gitfw_from_path: not called CC=6 SCAR=37.4
141 0 my ($orig, $build, @args) = @_;
142
143 0 ▶ return $orig->($build, @args)
Branch: 1 branch
BranchTrueFalseTotal
unless $on_windows 0 0 0
144 if !$on_windows;
145
146 0 local $ENV{PATH} = $ENV{PATH};
147
148 0 my $msys_path = eval {
149 0 path('Alien::MSYS'->msys_path())
150 };
151 0 ▶ return if !defined $msys_path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $msys_path 0 0 0
152 0 my $count = @PATH;
153
154 @PATH
155 0 ▶ = grep {path($_)->stringify =~ m|/usr/bin$| && path($_) ne $msys_path ? () : $_}
Branch: 1 branch
BranchTrueFalseTotal
path($_)->stringify =~ m[/usr/bin$] && path($_) ne $msys_path ? : 0 0 0
Condition0%0/3
path($_)->stringify =~ m[/usr/bin$] and path($_) ne $msys_path
!ll&&!rl&&r
000
MC/DC0%0/2
path($_)->stringify =~ m[/usr/bin$] and path($_) ne $msys_path
path($_)->stringify =~ m[/usr/bin$] path($_) ne $msys_path
Truth table0%0/3
A and B
A= path($_)->stringify =~ m[/usr/bin$]B= path($_) ne $msys_path
ABresult
0X0
100
111
156 0 grep {defined $_} # undef paths cause issues with Path::Tiny
157 @PATH;
158
159 0 my $removed = $count - @PATH;
160 0 ▶ if ($removed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($removed) 0 0 0
161 0 $build->log ("$removed additional .../usr/bin dirs were removed from the path for compilation");
162 }
163
164 0 $orig->($build, @args);
165 }
166
167 0 ▶sub pause {
Subroutine pause: not called CC=4 SCAR=30.0
168 0 return; # re-enable in case of debug
169 0 ▶ return if $on_automated_rig;
Branch: 1 branch
BranchTrueFalseTotal
if $on_automated_rig 0 0 0
170 0 ▶ return if !$on_windows;
Branch: 1 branch
BranchTrueFalseTotal
unless $on_windows 0 0 0
171
172 0 say "CONTINUE?";
173 0 my $response = <>;
174 0 ▶ while (not $response =~ /yes/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $response =~ /yes/) 0 0 0
175 0 $response = <>;
176 }
177 }
178
179
180 1 ▶sub get_lib_version {
Subroutine get_lib_version: called CC=1 SCAR=0.0
181 1 my $h = get_alien_state_hash();
182 1 return $h->{runtime}{version};
183 }
184
185 1 ▶sub get_alien_state_hash {
Subroutine get_alien_state_hash: called CC=3 SCAR=11.0
186 1 ▶ use JSON::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
187 1 my $root = "$base_dir/_alien";
188 1 my $f = "$root/state.json";
189 1 my $h = {};
190 1 ▶ if (-e $f) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $f) 1 0 1
191 1 ▶ open my $fh, '<', $f or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $f or die $! 1 0 1
192 1 my $d = do {
193 1 local $/ = undef;
194 1 <$fh>;
195 };
196 1 $h = JSON::PP::decode_json($d);
197 }
198 1 return $h;
199 }
200
↑ Summary blib/lib/Alien/sqlite/Install/Files.pm »