Installer/OS.pm

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