alienfile

filter: Statementstmt 37.5% 27 / 72 Branchbran 20.0% 6 / 30 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 75.0% 6 / 8 Podpod n/a totaltotal 33.3% 43 / 129 CC 10 SCAR 26.5
CC
10
Cov
32%
__ANON__
26.7
__ANON__
12.0
__ANON__
6.0
CRAP 14.1
↑ Summary blib/lib/Alien/LibreSSL/Install/Files.pm »
1 1 ▶use alienfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Env qw( @PKG_CONFIG_PATH @PKG_CONFIG_LIBDIR );
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Path::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶configure {
Subroutine __ANON__: called CC=1 SCAR=0.0
7 1 requires 'Path::Tiny'
8 1 };
9  
10 1 ▶if(defined $ENV{OPENSSL_PREFIX} && -d "$ENV{OPENSSL_PREFIX}/lib/pkgconfig") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ENV{"OPENSSL_PREFIX"} and -d qq[$ENV{"OPENSSL_PREFIX"}/lib/pkgconfig]) 0 1 1
Condition33%1/3
defined $ENV{"OPENSSL_PREFIX"} and -d qq[$ENV{"OPENSSL_PREFIX"}/lib/pkgconfig]
!ll&&!rl&&r
100
MC/DC0%0/2
defined $ENV{"OPENSSL_PREFIX"} and -d qq[$ENV{"OPENSSL_PREFIX"}/lib/pkgconfig]
defined $ENV{"OPENSSL_PREFIX"} -d qq[$ENV{"OPENSSL_PREFIX"}/lib/pkgconfig]
Truth table33%1/3
A and B
A= defined $ENV{"OPENSSL_PREFIX"}B= -d qq[$ENV{"OPENSSL_PREFIX"}/lib/pkgconfig]
ABresult
0X0
100
111
11 0 unshift @PKG_CONFIG_PATH, "$ENV{OPENSSL_PREFIX}/lib/pkgconfig";
12 }
13  
14 1 ▶if($^O eq 'darwin' && ! -d '/usr/include/openssl')
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "darwin" and not -d "/usr/include/openssl") 0 1 1
Condition33%1/3
$^O eq "darwin" and not -d "/usr/include/openssl"
!ll&&!rl&&r
100
MC/DC0%0/2
$^O eq "darwin" and not -d "/usr/include/openssl"
$^O eq "darwin" not -d "/usr/include/openssl"
Truth table33%1/3
A and not(B)
A= $^O eq "darwin"B= not -d "/usr/include/openssl"
ABresult
0X0
100
111
15 {
16 # The OpenSSL that ships with recent OS X is completely broken
17 # from a developer perspective. They provide an openssl binary,
18 # libraries and a .pc file, but no headers. I guess the reason
19 # is OpenSSL is considered deprecated on the platform, but then
20 # why ship the .pc file? We set PKG_CONFIG_LIBDIR to just the
21 # to skip /usr/lib/pkgconfig, unless the user has specified it.
22 # (presumably if they have set it, they have done so for a reason).
23 0 ▶ unless(defined $ENV{PKG_CONFIG_LIBDIR}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $ENV{"PKG_CONFIG_LIBDIR"}) 0 0 0
24 0 @PKG_CONFIG_LIBDIR = qw(
25 /usr/local/lib/pkgconfig
26 /usr/local/share/pkgconfig
27 )
28 }
29  
30 0 ▶ if( -d '/usr/local/Cellar/libressl' )
Branch: 1 branch
BranchTrueFalseTotal
if (-d "/usr/local/Cellar/libressl") 0 0 0
31 {
32 0 require File::Glob;
33 0 my($dir) = File::Glob::bsd_glob('/usr/local/Cellar/libressl/*/lib/pkgconfig');
34 0 push @PKG_CONFIG_LIBDIR, $dir;
35 }
36  
37 0 ▶ if( -d '/usr/local/Cellar/openssl' )
Branch: 1 branch
BranchTrueFalseTotal
if (-d "/usr/local/Cellar/openssl") 0 0 0
38 {
39 0 require File::Glob;
40 0 my($dir) = File::Glob::bsd_glob('/usr/local/Cellar/openssl/*/lib/pkgconfig');
41 0 push @PKG_CONFIG_LIBDIR, $dir;
42 }
43  
44 0 ▶ if( -l '/opt/local/bin/openssl' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-l "/opt/local/bin/openssl") 0 0 0
45 0 my $dir = Path::Tiny->new(readlink '/opt/local/bin/openssl');
46 0 ▶ $dir = $dir->relative('/opt/local/bin') if $dir->is_relative;
Branch: 1 branch
BranchTrueFalseTotal
if $dir->is_relative 0 0 0
47 0 $dir = $dir
48 ->parent
49 ->parent
50 ->child('lib')
51 ->child('pkgconfig');
52 0 push @PKG_CONFIG_LIBDIR, "$dir";
53 }
54  
55 0 log "overidding PKG_CONFIG_LIBDIR on macOS: $ENV{PKG_CONFIG_LIBDIR}";
56 }
57  
58 1 ▶if($^O eq 'MSWin32' && $Config{myuname} =~ /strawberry-?perl 5\.([0-9]+)\./ && $1 < 20)
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32' and $Alien::Build::Auto::X0::Alienfile::Config{'myuname'} =~ /strawberry-?perl 5\.([0-9]+)\./ and $1 < 20) { } 0 1 1
Condition33%2/6
$^O eq "MSWin32" and $Alien::Build::Auto::X0::Alienfile::Config{"myuname"} =~ /strawberry-?perl 5\.([0-9]+)\./ and $1 < 20
!ll&&!rl&&r
100
$^O eq "MSWin32" and $Alien::Build::Auto::X0::Alienfile::Config{"myuname"} =~ /strawberry-?perl 5\.([0-9]+)\./
!ll&&!rl&&r
100
MC/DC0%0/3
$^O eq "MSWin32" and $Alien::Build::Auto::X0::Alienfile::Config{"myuname"} =~ /strawberry-?perl 5\.([0-9]+)\./ and $1 < 20
$^O eq "MSWin32" $Alien::Build::Auto::X0::Alienfile::Config{"myuname"} =~ /strawberry-?perl 5\.([0-9]+)\./ $1 < 20
Truth table25%1/4
A and B and C
A= $^O eq "MSWin32"B= $Alien::Build::Auto::X0::Alienfile::Config{"myuname"} =~ /strawberry-?perl 5\.([0-9]+)\./C= $1 < 20
ABCresult
0XX0
10X0
1100
1111
59 {
60 0 my $libdir = Path::Tiny->new($^X)->parent->parent->parent->child('c/lib');
61 # older versions of Straberry didn't have a working pkg-config
62 plugin 'Probe::CBuilder' => (
63 libs => $_,
64 version => qr/version = \|(.*?)\|/,
65 program => <<'EOF',
66 #include <stdio.h>
67 #include <openssl/crypto.h>
68 int main()
69 {
70 const char *version;
71 #ifdef OPENSSL_VERSION
72 version = OpenSSL_version(OPENSSL_VERSION);
73 #else
74 version = SSLeay_version(SSLEAY_VERSION);
75 #endif
76 printf("version = |%s|\n", version);
77 return 0;
78 }
79 EOF
80 0 ) for (
81 '-leay32 -lssl32',
82 '-lssl -lcrypto',
83 '-lcrypto -lssl',
84 "-L$libdir -leay32 -lssl32",
85 "-L$libdir -lssl -lcrypto",
86 "-L$libdir -lcrypto -lssl",
87 );
88  
89 0 ▶ meta->after_hook(gather_system => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
90 0 my $build = shift;
91 0 ▶ if($build->runtime_prop->{version} =~ /^(open|libre)ssl (\S+)/i)
Branch: 1 branch
BranchTrueFalseTotal
if ($build->runtime_prop->{"version"} =~ /^(open|libre)ssl (\S+)/i) 0 0 0
92 {
93 0 $build->runtime_prop->{version} = $2;
94 }
95 0 });
96 }
97 else
98 {
99 1 plugin 'PkgConfig' => 'openssl';
100 }
101  
102 1 ▶share {
Subroutine __ANON__: called CC=7 SCAR=32.8
103  
104 1 start_url 'https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/';
105 1 plugin Download => (
106 version => qr/^libressl-([0-9\.]+)\.tar\.gz$/,
107 bootstrap_ssl => 1,
108 );
109  
110 1 ▶ unless(meta->has_hook('fetch'))
Branch: 1 branch
BranchTrueFalseTotal
unless (meta()->has_hook("fetch")) 0 1 1
111 {
112 0 my $ftp_ok = $ENV{ALIEN_OPENSSL_FTP};
113 0 ▶ $ftp_ok = 1 unless defined $ftp_ok;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ftp_ok 0 0 0
114 0 ▶ if($ftp_ok)
Branch: 1 branch
BranchTrueFalseTotal
if ($ftp_ok) { } 0 0 0
115 {
116 0 log(" ************************************************* ");
117 0 log(" * WARNING downloading LibreSSL via HTTP * ");
118 0 log(" ************************************************* ");
119 0 start_url 'http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/';
120 0 plugin 'Fetch::HTTPTiny';
121 }
122 else
123 {
124 0 log("Unable to download LibreSSL via https without OpenSSL!");
125 0 log("Recommend installing wget or curl to bootstrap Alien::LibreSSL");
126 0 die "unable to download LibreSSL via https";
127 }
128 }
129  
130 1 plugin Extract => 'tar.gz';
131  
132 1 meta->prop->{out_of_source} = 1;
133  
134 1 ▶ if($^O eq 'MSWin32')
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
135 {
136 0 plugin 'Build::CMake';
137  
138 0 ▶ if(meta->prop->{platform}->{compiler_type} eq 'microsoft')
Branch: 1 branch
BranchTrueFalseTotal
if (meta()->prop->{"platform"}{"compiler_type"} eq "microsoft") 0 0 0
139 {
140 0 ▶ gather sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
141 0 my($build) = @_;
142 0 my $prefix = $build->runtime_prop->{prefix};
143  
144 0 my @libs = grep /^[a-z]+\.lib$/, map { $_->basename } Path::Tiny->new('.')->child('lib')->children;
145
146 0 $build->runtime_prop->{$_} = "-I$prefix/include " for qw( cflags cflags_static );
147 0 $build->runtime_prop->{$_} = "-LIBPATH:$prefix/lib @libs " for qw( libs libs_static );
148 0 };
149 }
150 }
151 else
152 {
153 1 plugin 'Build::Autoconf';
154  
155 1 ▶ if($^O eq 'darwin')
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "darwin") 0 1 1
156 {
157 0 build [
158 '%{configure} --enable-shared --enable-static',
159 '%{make}',
160 '%{make} install',
161 ];
162  
163 0 plugin 'Gather::IsolateDynamic';
164 }
165 }
166 1 }
↑ Summary blib/lib/Alien/LibreSSL/Install/Files.pm »