Installer/OS.pm

filter: Statementstmt 36.0% 18 / 50 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 40.0% 6 / 15 Podpod 0.0% 0 / 9 totaltotal 24.4% 24 / 98 CC 14 SCAR 46.6
CC
14
Cov
25%
have_cmd
210.0
am_system_perl
2.0
executable_name
2.0
CRAP 105.8
« Installer.pm ↑ Summary Installer/OS/linux.pm »
1 package LedgerSMB::Installer::OS v0.999.11;
2  
3 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental qw(signatures);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Cwd qw( getcwd );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::Basename qw( fileparse );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 ▶sub am_system_perl($self) {
Subroutine am_system_perl: not called CC=1 SCAR=6.9
Pod undocumented
13 0 return !!0;
14 }
15  
16 0 ▶sub have_cmd($self, $cmd, $fatal = 1, $extra_path = []) {
Subroutine have_cmd: not called CC=14 SCAR=53.5
Pod undocumented
17 0 ▶ if ($self->{cmd} and $self->{cmd}->{$cmd}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"cmd"} and $self->{"cmd"}{$cmd}) 0 0 0
Condition0%0/3
$self->{"cmd"} and $self->{"cmd"}{$cmd}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"cmd"} and $self->{"cmd"}{$cmd}
$self->{"cmd"} $self->{"cmd"}{$cmd}
Truth table0%0/3
A and B
A= $self->{"cmd"}B= $self->{"cmd"}{$cmd}
ABresult
0X0
100
111
18 0 $log->debug( "Found cached command $self->{cmd}->{$cmd}" );
19 0 return $self->{cmd}->{$cmd};
20 }
21  
22 0 my $executable = '';
23 0 ▶ if (File::Spec->file_name_is_absolute( $cmd )) {
Branch: 1 branch
BranchTrueFalseTotal
if ('File::Spec'->file_name_is_absolute($cmd)) { } 0 0 0
24 0 ▶ $executable = $cmd if -x $cmd;
Branch: 1 branch
BranchTrueFalseTotal
if -x $cmd 0 0 0
25 }
26 else {
27 0 my (undef, $dirs) = File::Spec->splitpath( $cmd );
28 0 ▶ if ($dirs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dirs) { } 0 0 0
29 0 $cmd = File::Spec->catfile( getcwd(), $cmd );
30 0 ▶ $executable = $cmd if -x $cmd;
Branch: 1 branch
BranchTrueFalseTotal
if -x $cmd 0 0 0
31 }
32 else {
33 # Prefer specific added paths over system path; we may have
34 # installed something specific; if we did, we don't want to
35 # find the system global thing in its place.
36 0 for my $path ($extra_path->@*, File::Spec->path) {
37 0 my $expanded = File::Spec->catfile( $path, $cmd );
38 0 ▶ next if not -x $expanded;
Branch: 1 branch
BranchTrueFalseTotal
unless -x $expanded 0 0 0
39  
40 0 $executable = $expanded;
41 0 last;
42 }
43 }
44 }
45 0 ▶ if ($executable) {
Branch: 2 branches
BranchTrueFalseTotal
if ($executable) { } 0 0 0
elsif (not $fatal) { } 0 0 0
46 0 ▶ $self->{cmd} //= {};
Condition0%0/2
$self->{"cmd"} //= {}
l!l
00
MC/DC0%0/1
$self->{"cmd"} //= {}
$self->{"cmd"}
Truth table0%0/2
A
A= $self->{"cmd"}
Aresult
11
00
47 0 $self->{cmd}->{$cmd} = $executable;
48 0 $log->info( "Command $cmd found as $executable" );
49 }
50 elsif (not $fatal) {
51 0 $log->info( "Command $cmd not found" );
52 }
53 else {
54 0 die "Missing '$cmd'";
55 }
56 0 return $executable;
57 }
58  
59 ▶sub executable_name($self, $command) {
Subroutine executable_name: not called CC=1 SCAR=6.9
Pod undocumented
60 0 return $command;
61 }
62  
63 sub have_pkgs($self, $pkgs) {
64 }
65  
66 ▶sub pg_config_extra_paths($self) {
Subroutine pg_config_extra_paths: not called CC=1 SCAR=6.9
Pod undocumented
67 0 return ();
68 }
69  
70 ▶sub pkgs_from_modules($self, $mod) {
Subroutine pkgs_from_modules: not called CC=1 SCAR=6.9
Pod undocumented
71 0 die 'Operating system and distribution support needs to override the "pkgs_from_modules" method';
72 }
73  
74 ▶sub pkg_can_install($self) {
Subroutine pkg_can_install: not called CC=1 SCAR=6.9
Pod undocumented
75 0 return 0; # there's no such thing as generic installer support across operating systems
76 }
77  
78 ▶sub pkg_install($self) {
Subroutine pkg_install: not called CC=1 SCAR=6.9
Pod undocumented
79 0 die 'Operating system and distribution support needs to override the "pkg_install" method';
80 }
81  
82 ▶sub pkg_uninstall($self) {
Subroutine pkg_uninstall: not called CC=1 SCAR=6.9
Pod undocumented
83 0 die 'Operating system and distribution support needs to override the "pkg_uninstall" method';
84 }
85  
86 ▶sub name($self) {
Subroutine name: not called CC=1 SCAR=6.9
Pod undocumented
87 0 die 'Operating system and distribution support needs to override the "name" method';
88 }
89  
90 sub cleanup_env($self, $config, %args) {
91 }
92  
93 1 1;
« Installer.pm ↑ Summary Installer/OS/linux.pm »