| 1 | package CPAN::Plugin::Sysdeps; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 8 | our $VERSION = '0.81'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use List::Util 'first'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | our $TRAVERSE_ONLY; # only for testing | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use constant SUPPORTED_NUMERICAL_OPS => ['<','<=','==','>','>=']; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | use constant SUPPORTED_NUMERICAL_OPS_RX => do { | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | my $rx = '^(' . join('|', map { quotemeta } @{SUPPORTED_NUMERICAL_OPS()}) . ')$'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | qr{$rx}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 8 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 8 | our @OS_RELEASE_PATH_CANDIDATES = ('/etc/os-release', '/usr/lib/os-release'); | |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 42 | ▶ | my($class, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=42 SCAR=44.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 42 | my $installer; | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 42 | my $batch = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 42 | my $dryrun = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 42 | my $debug = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 42 | my @additional_mappings; | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | my @args_errors; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 42 | my $options; | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 42 | for my $arg (@args) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 117 | ▶ | if (ref $arg eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 15 | ▶ | if ($options) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | die "Cannot handle multiple option hashes"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 15 | $options = $arg; | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } elsif ($arg =~ m{^(apt-get|aptitude|pkg|pkg_add|yum|dnf|chocolatey|homebrew|apk)$}) { # XXX are there more package installers? | ||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 24 | $installer = $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } elsif ($arg eq 'batch') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 31 | $batch = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } elsif ($arg eq 'interactive') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | $batch = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } elsif ($arg eq 'dryrun') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 30 | $dryrun = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } elsif ($arg =~ m{^mapping=(.*)$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 16 | push @additional_mappings, $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } elsif ($arg =~ m{^debug(?:=(\d+))?$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $debug = defined $1 ? $1 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | push @args_errors, $arg; | |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 42 | ▶ | if (@args_errors) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | die 'Unrecognized ' . __PACKAGE__ . ' argument' . (@args_errors != 1 ? 's' : '') . ": @args_errors\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 42 | ▶ | if (exists $ENV{CPAN_PLUGIN_SYSDEPS_DEBUG}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $debug = $ENV{CPAN_PLUGIN_SYSDEPS_DEBUG}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 42 | ▶ | if ($debug) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | require Data::Dumper; # we'll need it | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 42 | ▶ | my $os = $options->{os} || $^O; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$options->{'os'} || $^O
MC/DC0%0/2
$options->{'os'} || $^O
$options->{'os'}
$^O
Truth table66%2/3
A || B
A= $options->{'os'}B= $^O
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 42 | my $osvers = ''; | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 42 | my $linuxdistro = ''; | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 42 | my $linuxdistroversion = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 42 | my $linuxdistrocodename = ''; | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 42 | ▶ | if ($os eq 'linux') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 33 | my $linux_info; | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | my $get_linux_info = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 81 | ▶ | return $linux_info if $linux_info; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 27 | return $linux_info = _detect_linux_distribution(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 33 | }; | |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 33 | ▶ | if (defined $options->{linuxdistro}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 6 | $linuxdistro = $options->{linuxdistro}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 27 | $linuxdistro = $get_linux_info->()->{linuxdistro}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 33 | ▶ | if (defined $options->{linuxdistroversion}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 6 | $linuxdistroversion = $options->{linuxdistroversion}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 27 | $linuxdistroversion = $get_linux_info->()->{linuxdistroversion}; # XXX make it a version object? or make sure it's just X.Y? | |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 33 | ▶ | if (defined $options->{linuxdistrocodename}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 6 | $linuxdistrocodename = $options->{linuxdistrocodename}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 27 | $linuxdistrocodename = $get_linux_info->()->{linuxdistrocodename}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ▶ | } elsif (($os eq 'freebsd') || ($os eq 'openbsd') || ($os eq 'dragonfly')) { | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$os eq "freebsd" or $os eq "openbsd" or $os eq "dragonfly"
$os eq "freebsd" or $os eq "openbsd"
MC/DC0%0/3
$os eq "freebsd" or $os eq "openbsd" or $os eq "dragonfly"
$os eq "freebsd"
$os eq "openbsd"
$os eq "dragonfly"
Truth table25%1/4
A or B or C
A= $os eq "freebsd"B= $os eq "openbsd"C= $os eq "dragonfly"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # Note: don't use $Config{osvers}, as this is just the OS | ||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # version of the system which built the current perl, not the | ||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # actually running OS version. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 9 | ▶ | if (defined $options->{osvers}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 9 | $osvers = $options->{osvers}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | chomp($osvers = `/sbin/sysctl -n kern.osrelease`); | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 42 | ▶ | if (!$installer) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 18 | ▶ | if ($os eq 'freebsd' || $os eq 'dragonfly') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition66%2/3
$os eq "freebsd" or $os eq "dragonfly"
MC/DC50%1/2
$os eq "freebsd" or $os eq "dragonfly"
$os eq "freebsd"
$os eq "dragonfly"
Truth table66%2/3
A or B
A= $os eq "freebsd"B= $os eq "dragonfly"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 9 | $installer = 'pkg'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } elsif ($os eq 'gnukfreebsd') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $installer = 'apt-get'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } elsif ($os eq 'openbsd') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $installer = 'pkg_add'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } elsif ($os eq 'linux') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 9 | ▶ | if (__PACKAGE__->_is_linux_debian_like($linuxdistro)) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 8 | $installer = 'apt-get'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } elsif (__PACKAGE__->_is_linux_fedora_like($linuxdistro)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | ▶ | if (_detect_dnf()) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $installer = 'dnf'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | $installer = 'yum'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } elsif (__PACKAGE__->_is_linux_alpine_like($linuxdistro)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $installer = 'apk'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | die __PACKAGE__ . " has no support for linux distribution $linuxdistro $linuxdistroversion\n"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } elsif( $os eq 'MSWin32' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $installer = 'chocolatey'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } elsif ($os eq 'darwin') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $installer = 'homebrew'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | die __PACKAGE__ . " has no support for operating system $os\n"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 42 | my @mapping; | |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 42 | for my $mapping (@additional_mappings, 'CPAN::Plugin::Sysdeps::Mapping') { | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 58 | ▶ | if (-r $mapping) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 16 | ▶ | open my $fh, '<', $mapping | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | or die "Can't load $mapping: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 16 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 16 | my $buf = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 16 | push @mapping, eval $buf; | |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 16 | ▶ | die "Error while loading $mapping: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 42 | ▶ | eval "require $mapping"; die "Can't load $mapping: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 42 | push @mapping, $mapping->mapping; | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 42 | my %config = | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | installer => $installer, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | batch => $batch, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | dryrun => $dryrun, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | debug => $debug, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | os => $os, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | osvers => $osvers, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | linuxdistro => $linuxdistro, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | linuxdistroversion => $linuxdistroversion, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | linuxdistrocodename => $linuxdistrocodename, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | mapping => \@mapping, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 42 | my $self = bless \%config, $class; | |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 42 | ▶ | if (eval { require Hash::Util; 1 }) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 42 | Hash::Util::lock_keys($self); | |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 42 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # CPAN.pm plugin hook method | ||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | sub post_get { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 15 | ▶ | my($self, $dist) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_get: called CC=6 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 15 | my @packages = $self->_map_cpandist($dist); | |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 14 | ▶ | if (@packages) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | my @uninstalled_packages = $self->_filter_uninstalled_packages(@packages); | |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | ▶ | if (@uninstalled_packages) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | my @cmds = $self->_install_packages_commands(@uninstalled_packages); | |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 2 | for my $cmd (@cmds) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | ▶ | if ($self->{dryrun}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | warn "DRYRUN: @$cmd\n"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | warn "INFO: run @$cmd...\n"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | system @$cmd; | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | if ($? != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | die "@$cmd failed, stop installation"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # Helpers/Internal functions/methods | ||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | sub _detect_linux_distribution { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 28 | ▶ | my $info = _detect_linux_distribution_os_release(); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_linux_distribution: called CC=3 SCAR=17.3
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 28 | ▶ | return $info if $info; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if (-x '/usr/bin/lsb_release') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | _detect_linux_distribution_lsb_release(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | _detect_linux_distribution_fallback(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | sub _detect_linux_distribution_os_release { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 41 | ▶ | my %info; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_linux_distribution_os_release: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 41 | for my $candidate_file (@OS_RELEASE_PATH_CANDIDATES) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 41 | ▶ | if (open my $fh, '<', $candidate_file) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 40 | my %c; | |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 40 | ▶ | while(<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 478 | ▶ | if (my($k,$v) = $_ =~ m{^(.*?)=["']?(.*?)["']?$}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 470 | $c{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 40 | $info{linuxdistro} = $c{ID}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 40 | $info{linuxdistroversion} = $c{VERSION_ID}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 40 | $info{linuxdistrocodename} = $c{VERSION_CODENAME}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # heuristics | ||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 40 | ▶ | if (!defined $info{linuxdistrocodename} && $info{linuxdistro} eq 'debian' && $c{VERSION} =~ m{^\d+\s+\((.+)\)$}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not defined $info{"linuxdistrocodename"} and $info{"linuxdistro"} eq "debian" and $c{"VERSION"} =~ /^\d+\s+\((.+)\)$/
not defined $info{"linuxdistrocodename"} and $info{"linuxdistro"} eq "debian"
MC/DC66%2/3
not defined $info{"linuxdistrocodename"} and $info{"linuxdistro"} eq "debian" and $c{"VERSION"} =~ /^\d+\s+\((.+)\)$/
not defined $info{"linuxdistrocodename"}
$info{"linuxdistro"} eq "debian"
$c{"VERSION"} =~ /^\d+\s+\((.+)\)$/
Truth table75%3/4
not(A) and B and C
A= not defined $info{"linuxdistrocodename"}B= $info{"linuxdistro"} eq "debian"C= $c{"VERSION"} =~ /^\d+\s+\((.+)\)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | $info{linuxdistrocodename} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 40 | return \%info; | |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 1 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | sub _detect_linux_distribution_lsb_release { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | my %info; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_linux_distribution_lsb_release: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my @cmd = ('lsb_release', '-irc'); | |||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | open my $fh, '-|', @cmd | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | or die "Error while running '@cmd': $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | while(<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if (m{^Distributor ID:\s+(.*)}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $info{linuxdistro} = lc $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } elsif (m{^Release:\s+(.*)}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $info{linuxdistroversion} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } elsif (m{^Codename:\s+(.*)}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $info{linuxdistrocodename} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | warn "WARNING: unexpected '@cmd' output '$_'"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | close $fh | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | or die "Error while running '@cmd': $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | \%info; | |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | sub _detect_linux_distribution_fallback { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (open my $fh, '<', '/etc/redhat-release') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_linux_distribution_fallback: not called CC=8 SCAR=42.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $contents = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if ($contents =~ m{^(CentOS|Rocky|RedHat|Fedora) (?:Linux )?release (\d+)\S*( \((.*?)\))?}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | return {linuxdistro => lc $1, linuxdistroversion => $2, linuxdistrocodename => defined $3 ? $3 : ''}; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if (open my $fh, '<', '/etc/issue') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | chomp(my $line = <$fh>); | |||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | if ($line =~ m{^Linux Mint (\d+) (\S+)}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | return {linuxdistro => lc('LinuxMint'), linuxdistroversion => $1, linuxdistrocodename => $2}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } elsif ($line =~ m{^(Debian) GNU/Linux (\d+)}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | my %info = (linuxdistro => lc $1, linuxdistroversion => $2); | |||||||||||||||||||||||||||||||||||||||||||||||
| 262 | $info{linuxdistrocodename} = | ||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 6 => 'squeeze', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 7 => 'wheezy', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 8 => 'jessie', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 9 => 'stretch', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 10 => 'buster', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 11 => 'bullseye', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 12 => 'bookworm', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 13 => 'trixie', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | }->{$info{linuxdistroversion}}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | return \%info; | |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } elsif ($line =~ m{^(Ubuntu) (\d+\.\d+)}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my %info = (linuxdistro => lc $1, linuxdistroversion => $2); | |||||||||||||||||||||||||||||||||||||||||||||||
| 276 | $info{linuxdistrocodename} = | ||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | '12.04' => 'precise', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | '14.04' => 'trusty', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | '16.04' => 'xenial', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | '18.04' => 'bionic', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | '20.04' => 'focal', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | '22.04' => 'jammy', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | '24.04' => 'noble', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | }->{$info{linuxdistroversion}}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | return \%info; | |||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | warn "WARNING: don't know how to handle '$line'"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | warn "WARNING: no /etc/issue available"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | return {}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | sub _is_linux_debian_like { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 4318 | ▶ | my(undef, $linuxdistro) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_linux_debian_like: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 4318 | $linuxdistro =~ m{^(debian|ubuntu|linuxmint)$}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | sub _is_linux_fedora_like { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 2713 | ▶ | my(undef, $linuxdistro) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_linux_fedora_like: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 2713 | $linuxdistro =~ m{^(fedora|redhat|centos|rocky)$}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | sub _is_linux_alpine_like { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 12 | ▶ | my(undef, $linuxdistro) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_linux_alpine_like: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 12 | $linuxdistro =~ m{^(alpine)$}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 17 | ▶ | sub _is_apt_installer { shift->{installer} =~m{^(apt-get|aptitude)$} } | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_apt_installer: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # Run a process in an elevated window, wait for its exit | ||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | sub _win32_run_elevated { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | my($exe, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_win32_run_elevated: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | my $args = join " ", map { if(/[ "]/) { s!"!\\"!g; qq{"$_"} } else { $_ }} @args; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $ps1 = sprintf q{powershell -NonInteractive -NoProfile -Command "$process = Start-Process '%s' -PassThru -ErrorAction Stop -ArgumentList '%s' -Verb RunAs -Wait; Exit $process.ExitCode"}, | |||||||||||||||||||||||||||||||||||||||||||||||
| 320 | $exe, $args; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $ps1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | sub _debug { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 94417 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debug: called CC=3 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 94417 | ▶ | if ($self->{debug}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | print STDERR 'DEBUG: '; | |||||||||||||||||||||||||||||||||||||||||||||||
| 329 | print STDERR join('', map { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if (ref $_) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | Data::Dumper->new([$_])->Terse(1)->Indent(0)->Dump; | |||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } @_); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | print STDERR "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | sub _map_cpandist { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 29 | ▶ | my($self, $dist) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_cpandist: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # compat for older CPAN.pm (1.76) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 29 | ▶ | if (!$dist->can('base_id')) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 8 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | *CPAN::Distribution::base_id = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $id = $self->id(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | my $base_id = File::Basename::basename($id); | |||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $base_id =~ s{\.(?:tar\.(bz2|gz|Z)|t(?:gz|bz)|zip)$}{}i; | |||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | return $base_id; | |||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | # smartmatch for regexp/string/array without ~~, 5.8.x compat! | ||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # also add support for numerical comparisons | ||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | my $smartmatch = sub ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 15402 | ▶ | my($left, $right) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=25.6
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 8 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 15402 | ▶ | if (ref $right eq 'Regexp') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 180 | ▶ | return 1 if $left =~ $right; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } elsif (ref $right eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 1951 | ▶ | return 1 if first { (!defined $left && !defined $_) || ($_ eq $left) } @$right; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.3
Branch: 2 branches
Condition66%2/3
defined $left || defined $_
MC/DC0%0/2
defined $left || defined $_
defined $left
defined $_
Truth table66%2/3
A || B
A= defined $leftB= defined $_
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } elsif (ref $right eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 425 | for my $op (keys %$right) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 434 | ▶ | if ($op !~ SUPPORTED_NUMERICAL_OPS_RX) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | die "Unsupported operator '$op', only supported: @{SUPPORTED_NUMERICAL_OPS()}"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 434 | my $val = $right->{$op}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 434 | my $code = 'no warnings q(numeric); $left '.$op.' $val'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 434 | ▶ | my $res = eval $code; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 434 | ▶ | die "Evaluation of '$code' failed: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 434 | ▶ | return 0 if !$res; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 166 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 12846 | ▶ | return 1 if !defined $left && !defined $right; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $left or defined $right
MC/DC0%0/2
defined $left or defined $right
defined $left
defined $right
Truth table66%2/3
A or B
A= defined $leftB= defined $right
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 12846 | ▶ | return 1 if $left eq $right; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 29 | }; | |||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 29 | my $handle_mapping_entry; $handle_mapping_entry = sub { | |||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 36149 | ▶ | my($entry, $level) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=36 SCAR=36.4
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 36149 | ▶ | for(my $map_i=0; $map_i <= $#$entry; $map_i++) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 65502 | my $key_or_subentry = $entry->[$map_i]; | |||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 65502 | ▶ | if (ref $key_or_subentry eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 28656 | $self->_debug(' ' x $level . ' traverse another tree level'); | |||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 28656 | my $res = $handle_mapping_entry->($key_or_subentry, $level+1); | |||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 28655 | ▶ | return $res if $res && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$res and not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC100%2/2
$res and not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
$res
not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table100%3/3
A and not(B)
A= $resB= not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } elsif (ref $key_or_subentry eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 1 | my $res = $key_or_subentry->($self, $dist); | |||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 1 | ▶ | return $res if $res && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res and not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC0%0/2
$res and not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
$res
not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table33%1/3
A and not(B)
A= $resB= not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 36845 | my $key = $key_or_subentry; | |||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 36845 | my $match = $entry->[++$map_i]; | |||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 36845 | $self->_debug(' ' x $level . " match '$key' against '", $match, "'"); | |||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 36845 | ▶ | if ($key eq 'cpandist') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 19 | ▶ | return 0 if !$smartmatch->($dist->base_id, $match) && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
&$smartmatch($dist->base_id, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC100%2/2
&$smartmatch($dist->base_id, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
&$smartmatch($dist->base_id, $match)
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table100%3/3
A or B
A= &$smartmatch($dist->base_id, $match)B= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } elsif ($key eq 'cpanmod') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 7474 | my $found = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 7474 | for my $mod ($dist->containsmods) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 7474 | $self->_debug(' ' x $level . " found module '$mod' in dist, check now against '", $match, "'"); | |||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 7474 | ▶ | if ($smartmatch->($mod, $match)) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 15 | $found = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 15 | last; | |||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 7474 | ▶ | return 0 if !$found && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$found or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC100%2/2
$found or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
$found
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table100%3/3
A or B
A= $foundB= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } elsif ($key eq 'os') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 5271 | ▶ | return 0 if !$smartmatch->($self->{os}, $match) && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
&$smartmatch($self->{"os"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC100%2/2
&$smartmatch($self->{"os"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
&$smartmatch($self->{"os"}, $match)
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table100%3/3
A or B
A= &$smartmatch($self->{"os"}, $match)B= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } elsif ($key eq 'osvers') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 178 | ▶ | return 0 if !$smartmatch->($self->{osvers}, $match) && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
&$smartmatch($self->{"osvers"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC100%2/2
&$smartmatch($self->{"osvers"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
&$smartmatch($self->{"osvers"}, $match)
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table100%3/3
A or B
A= &$smartmatch($self->{"osvers"}, $match)B= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } elsif ($key eq 'linuxdistro') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 7766 | ▶ | if ($match =~ m{^~(debian|fedora|alpine)$}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 7033 | my $method = "_is_linux_$1_like"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 7033 | $self->_debug(' ' x $level . " translate $match to $method"); | |||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 7033 | ▶ | return 0 if !$self->$method($self->{linuxdistro}) && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->$method($self->{"linuxdistro"}) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC0%0/2
$self->$method($self->{"linuxdistro"}) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
$self->$method($self->{"linuxdistro"})
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table66%2/3
A or B
A= $self->$method($self->{"linuxdistro"})B= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } elsif ($match =~ m{^~}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | die "'like' matches only for debian, fedora, and alpine"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 732 | ▶ | return 0 if !$smartmatch->($self->{linuxdistro}, $match) && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
&$smartmatch($self->{"linuxdistro"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC0%0/2
&$smartmatch($self->{"linuxdistro"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
&$smartmatch($self->{"linuxdistro"}, $match)
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table66%2/3
A or B
A= &$smartmatch($self->{"linuxdistro"}, $match)B= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } elsif ($key eq 'linuxdistroversion') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 420 | ▶ | return 0 if !$smartmatch->($self->{linuxdistroversion}, $match) && !$TRAVERSE_ONLY; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
&$smartmatch($self->{"linuxdistroversion"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC0%0/2
&$smartmatch($self->{"linuxdistroversion"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
&$smartmatch($self->{"linuxdistroversion"}, $match)
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table66%2/3
A or B
A= &$smartmatch($self->{"linuxdistroversion"}, $match)B= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } elsif ($key eq 'linuxdistrocodename') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 1308 | ▶ | return 0 if !$smartmatch->($self->{linuxdistrocodename}, $match) && !$TRAVERSE_ONLY; # XXX should also do a smart codename comparison additionally! | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
&$smartmatch($self->{"linuxdistrocodename"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC0%0/2
&$smartmatch($self->{"linuxdistrocodename"}, $match) or $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
&$smartmatch($self->{"linuxdistrocodename"}, $match)
$CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table66%2/3
A or B
A= &$smartmatch($self->{"linuxdistrocodename"}, $match)B= $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } elsif ($key eq 'package') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 14409 | $self->_debug(' ' x $level . " found $match"); # XXX array? | |||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 14409 | return { package => $match }; | |||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | die "Invalid key '$key'"; # XXX context/position? | |||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 29 | }; | |||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 29 | ▶ | for my $entry (@{ $self->{mapping} || [] }) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 7493 | my $res = $handle_mapping_entry->($entry, 0); | |||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 7492 | ▶ | if ($res && !$TRAVERSE_ONLY) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$res and not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
MC/DC50%1/2
$res and not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
$res
not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
Truth table66%2/3
A and not(B)
A= $resB= not $CPAN::Plugin::Sysdeps::TRAVERSE_ONLY
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 10 | ▶ | return ref $res->{package} eq 'ARRAY' ? @{ $res->{package} } : $res->{package}; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 18 | (); | |||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | sub _detect_dnf { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | ▶ | my @cmd = ('dnf', '--help'); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_dnf: called CC=2 SCAR=7.8
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | require IPC::Open3; | |||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | require Symbol; | |||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 1 | my $err = Symbol::gensym(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 1 | my $fh; | |||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 1 | return eval { | |||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 1 | ▶ | if (my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd)) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | waitpid $pid, 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | return $? == 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | sub _find_missing_deb_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 5 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_missing_deb_packages: called CC=8 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 5 | ▶ | return () if !@packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # taken from ~/devel/deb-install.pl | ||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 4 | my %seen_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 467 | my @missing_packages; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 4 | my @cmd = ('dpkg-query', '-W', '-f=${Package} ${Status}\n', @packages); | |||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 4 | require IPC::Open3; | |||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 4 | require Symbol; | |||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 4 | my $err = Symbol::gensym(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 4 | my $fh; | |||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 4 | ▶ | my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd) | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | or die "Error running '@cmd': $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 4 | ▶ | while(<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | if (m{^(\S+) (.*)}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | if ($2 ne 'install ok installed') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | push @missing_packages, $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | $seen_packages{$1} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | warn "ERROR: cannot parse $_, ignore line...\n"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 4 | waitpid $pid, 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 4 | for my $package (@packages) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 6 | ▶ | if (!$seen_packages{$package}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 6 | push @missing_packages, $package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 4 | @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | sub _find_missing_rpm_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 6 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_missing_rpm_packages: called CC=11 SCAR=24.2
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 6 | ▶ | return () if !@packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 5 | my @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 501 | { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 5 | my %packages = map{($_,1)} @packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 5 | local $ENV{LC_ALL} = 'C'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 5 | my @cmd = ('rpm', '-q', @packages); | |||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 5 | ▶ | open my $fh, '-|', @cmd | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | or die "Error running '@cmd': $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 5 | ▶ | while(<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 8 | ▶ | if (m{^package (\S+) is not installed}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 4 | my $package = $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 4 | ▶ | if (!exists $packages{$package}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | die "Unexpected: package $package listed as non-installed, but not queried in '@cmd'?!"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 4 | push @missing_packages, $package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 5 | ▶ | return () if !@missing_packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | # maybe the packages are just provided by another package? | ||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 4 | my @definitively_missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 522 | { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 4 | my %packages = map{($_,1)} @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 4 | local $ENV{LC_ALL} = 'C'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 4 | my @cmd = ('rpm', '-q', '--whatprovides', @missing_packages); | |||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 4 | ▶ | open my $fh, '-|', @cmd | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | or die "Error running '@cmd': $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 4 | ▶ | while(<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 5 | ▶ | if (m{^no package provides (\S+)}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 3 | my $package = $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 3 | ▶ | if (!exists $packages{$package}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | die "Unexpected: package $package listed as non-installed, but not queried in '@cmd'?!"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 3 | push @definitively_missing_packages, $package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 4 | @definitively_missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | sub _find_missing_freebsd_pkg_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_missing_freebsd_pkg_packages: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | return () if !@packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | for my $package (@packages) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | my @cmd = ('pkg', 'info', '--exists', $package); | |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | system @cmd; | |||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if ($? != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | push @missing_packages, $package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | sub _find_missing_openbsd_pkg_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_missing_openbsd_pkg_packages: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | return () if !@packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | require IPC::Open3; | |||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | require Symbol; | |||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | my @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | for my $package (@packages) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | my $err = Symbol::gensym(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my $fh; | |||||||||||||||||||||||||||||||||||||||||||||||
| 570 | my $package_in_repository; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | if (my $pid = IPC::Open3::open3(undef, $fh, $err, 'pkg_info', $package)) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | waitpid $pid, 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | if ($? == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $package_in_repository = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | if ($package_in_repository) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | my @cmd = ('pkg_info', '-q', '-e', "${package}->=0"); | |||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | system @cmd; | |||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | if ($? != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | push @missing_packages, $package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | sub _find_missing_homebrew_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_missing_homebrew_packages: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | return () if !@packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | my @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | for my $package (@packages) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | my @cmd = ('brew', 'ls', '--versions', $package); | |||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | open my $fh, '-|', @cmd | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | or die "Error running @cmd: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | my $has_package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | while(<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $has_package = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | close $fh; # earlier homebrew versions returned always 0, | |||||||||||||||||||||||||||||||||||||||||||||||
| 606 | # newer (since Oct 2016) return 1 if the package is | ||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | # missing | ||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | ▶ | if (!$has_package) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | push @missing_packages, $package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | sub _find_missing_chocolatey_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_missing_chocolatey_packages: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | return () if !@packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | my %installed_packages = map { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | /^(.*)\|(.*)$/ | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | or next; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $1 => $2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } grep { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | /^(.*)\|(.*)$/ | |||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } `choco list --localonly --limit-output`; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | my @missing_packages = grep { ! $installed_packages{ $_ }} @packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | sub _find_missing_apk_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_missing_apk_packages: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | return () if !@packages; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | for my $package (@packages) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | my @cmd = ('apk', 'info', '-e', $package); | |||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | system @cmd; | |||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | ▶ | if ($? != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | push @missing_packages, $package; | |||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | sub _filter_uninstalled_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 4 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filter_uninstalled_packages: called CC=14 SCAR=39.2
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 4 | my $find_missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 4 | ▶ | if ($self->_is_apt_installer) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 4 | $find_missing_packages = '_find_missing_deb_packages'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 651 | ▶ | } elsif (($self->{installer} eq 'yum') || ($self->{installer} eq 'dnf')) { | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"installer"} eq "yum" or $self->{"installer"} eq "dnf"
MC/DC0%0/2
$self->{"installer"} eq "yum" or $self->{"installer"} eq "dnf"
$self->{"installer"} eq "yum"
$self->{"installer"} eq "dnf"
Truth table0%0/3
A or B
A= $self->{"installer"} eq "yum"B= $self->{"installer"} eq "dnf"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $find_missing_packages = '_find_missing_rpm_packages'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 653 | ▶ | } elsif ($self->{os} eq 'freebsd' || $self->{os} eq 'dragonfly') { | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"os"} eq "freebsd" or $self->{"os"} eq "dragonfly"
MC/DC0%0/2
$self->{"os"} eq "freebsd" or $self->{"os"} eq "dragonfly"
$self->{"os"} eq "freebsd"
$self->{"os"} eq "dragonfly"
Truth table0%0/3
A or B
A= $self->{"os"} eq "freebsd"B= $self->{"os"} eq "dragonfly"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | $find_missing_packages = '_find_missing_freebsd_pkg_packages'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 655 | } elsif ($self->{os} eq 'openbsd') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | $find_missing_packages = '_find_missing_openbsd_pkg_packages'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } elsif ($self->{os} eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | $find_missing_packages = '_find_missing_chocolatey_packages'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } elsif ($self->{installer} eq 'homebrew') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | $find_missing_packages = '_find_missing_homebrew_packages'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } elsif ($self->{installer} eq 'apk') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | $find_missing_packages = '_find_missing_apk_packages'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | warn "check for installed packages is NYI for $self->{os}/$self->{linuxdistro}"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 4 | ▶ | if ($find_missing_packages) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 4 | my @plain_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 668 | my @missing_packages; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 4 | for my $package_spec (@packages) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 5 | ▶ | if ($package_spec =~ m{\|}) { # has alternatives | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 1 | my @single_packages = split /\s*\|\s*/, $package_spec; | |||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 1 | my @missing_in_packages_spec = $self->$find_missing_packages(@single_packages); | |||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 1 | ▶ | if (@missing_in_packages_spec == @single_packages) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 1 | push @missing_packages, $single_packages[0]; # XXX this could go wrong if the first alternative is not available at all; see problem with jpeg|jpeg-turbo in Mapping.pm | |||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 4 | push @plain_packages, $package_spec; | |||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 4 | push @missing_packages, $self->$find_missing_packages(@plain_packages); | |||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 4 | @packages = @missing_packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 4 | @packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | sub _install_packages_commands { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 13 | ▶ | my($self, @packages) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_install_packages_commands: called CC=31 SCAR=38.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 13 | my @pre_cmd; | |||||||||||||||||||||||||||||||||||||||||||||||
| 689 | my @install_cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | # sudo or not? | ||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 13 | ▶ | if ($self->{installer} eq 'homebrew') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | # may run as unprivileged user | ||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } elsif ($self->{installer} eq 'chocolatey') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | # no sudo on Windows systems? | ||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 12 | ▶ | if ($< != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 12 | push @install_cmd, 'sudo'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | # the installer executable | ||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 13 | ▶ | if ($self->{installer} eq 'homebrew') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 1 | push @install_cmd, 'brew'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } elsif ($self->{installer} eq 'chocolatey') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | push @install_cmd, 'choco'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 12 | push @install_cmd, $self->{installer}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | # batch, default or interactive | ||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 13 | ▶ | if ($self->{batch}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 4 | ▶ | if ($self->_is_apt_installer) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 3 | push @install_cmd, '-y'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 715 | ▶ | } elsif (($self->{installer} eq 'yum') || ($self->{installer} eq 'dnf')) { | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"installer"} eq "yum" or $self->{"installer"} eq "dnf"
MC/DC0%0/2
$self->{"installer"} eq "yum" or $self->{"installer"} eq "dnf"
$self->{"installer"} eq "yum"
$self->{"installer"} eq "dnf"
Truth table33%1/3
A or B
A= $self->{"installer"} eq "yum"B= $self->{"installer"} eq "dnf"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | push @install_cmd, '-y'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } elsif ($self->{installer} eq 'pkg') { # FreeBSD's pkg | ||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # see below | ||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | } elsif ($self->{installer} eq 'homebrew') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # batch by default | ||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } elsif ($self->{installer} eq 'apk') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # batch by default | ||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | warn "batch=1 NYI for $self->{installer}"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 9 | ▶ | if ($self->_is_apt_installer) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 3 | @pre_cmd = ('sh', '-c', 'echo -n "Install package(s) '."@packages".'? (y/N) "; read yn; [ "$yn" = "y" ]'); | |||||||||||||||||||||||||||||||||||||||||||||||
| 729 | ▶ | } elsif (($self->{installer} eq 'yum') || ($self->{installer} eq 'dnf')) { | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->{"installer"} eq "yum" or $self->{"installer"} eq "dnf"
MC/DC100%2/2
$self->{"installer"} eq "yum" or $self->{"installer"} eq "dnf"
$self->{"installer"} eq "yum"
$self->{"installer"} eq "dnf"
Truth table100%3/3
A or B
A= $self->{"installer"} eq "yum"B= $self->{"installer"} eq "dnf"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | # interactive by default | ||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } elsif ($self->{installer} eq 'pkg') { # FreeBSD's pkg | ||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | # see below | ||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } elsif ($self->{installer} =~ m{^(chocolatey)$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | # Nothing to do here | ||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } elsif ($self->{installer} eq 'homebrew') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | # the sh builtin echo does not understand -n -> use printf | ||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 1 | @pre_cmd = ('sh', '-c', 'printf %s "Install package(s) '."@packages".'? (y/N) "; read yn; [ "$yn" = "y" ]'); | |||||||||||||||||||||||||||||||||||||||||||||||
| 738 | } elsif ($self->{installer} eq 'apk') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 1 | @pre_cmd = ('sh', '-c', 'printf %s "Install package(s) '."@packages".'? (y/N) "; read yn; [ "$yn" = "y" ]'); | |||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 1 | warn "batch=0 NYI for $self->{installer}"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | # special options | ||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 13 | ▶ | if ($self->{installer} eq 'pkg') { # FreeBSD's pkg | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 1 | push @install_cmd, '--option', 'LOCK_RETRIES=86400'; # wait quite long in case there are concurrent pkg runs | |||||||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | # the installer subcommand | ||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 13 | ▶ | if ($self->{installer} eq 'apk') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 2 | push @install_cmd, 'add'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } elsif ($self->{installer} ne 'pkg_add') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 10 | push @install_cmd, 'install'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | # post options | ||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 13 | ▶ | if ($self->{batch} && $self->{installer} eq 'pkg') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"batch"} and $self->{"installer"} eq "pkg"
MC/DC0%0/2
$self->{"batch"} and $self->{"installer"} eq "pkg"
$self->{"batch"}
$self->{"installer"} eq "pkg"
Truth table66%2/3
A and B
A= $self->{"batch"}B= $self->{"installer"} eq "pkg"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | push @install_cmd, '-y'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 13 | ▶ | if ($self->{batch} && $self->{installer} eq 'chocolatey') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"batch"} and $self->{"installer"} eq "chocolatey"
MC/DC0%0/2
$self->{"batch"} and $self->{"installer"} eq "chocolatey"
$self->{"batch"}
$self->{"installer"} eq "chocolatey"
Truth table66%2/3
A and B
A= $self->{"batch"}B= $self->{"installer"} eq "chocolatey"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | push @install_cmd, '-y'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 13 | ▶ | if ($self->{batch} && $self->{installer} eq 'pkg_add') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"batch"} and $self->{"installer"} eq "pkg_add"
MC/DC0%0/2
$self->{"batch"} and $self->{"installer"} eq "pkg_add"
$self->{"batch"}
$self->{"installer"} eq "pkg_add"
Truth table66%2/3
A and B
A= $self->{"batch"}B= $self->{"installer"} eq "pkg_add"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | push @install_cmd, '-I'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 13 | push @install_cmd, @packages; | |||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 13 | ▶ | if ($self->{os} eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | # Wrap the thing in our small powershell program | ||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | @install_cmd = _win32_run_elevated(@install_cmd); | |||||||||||||||||||||||||||||||||||||||||||||||
| 773 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 13 | ▶ | ((@pre_cmd ? \@pre_cmd : ()), \@install_cmd); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||