| 1 | # ABSTRACT: apt/dpkg packaging layer of the NVIDIA driver setups (experimental) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Rex::GPU::NVIDIA::Setup::Apt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 36 | our $VERSION = '0.005'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 36 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 36 | ▶ | use Rex::Logger (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 36 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 36 | extends 'Rex::GPU::NVIDIA::Setup'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 36 | has apt_lock_timeout => ( is => 'ro', default => 120 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 197 | ▶ | sub _build_arch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_arch: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 197 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 197 | my $arch = $self->run_cmd('dpkg --print-architecture', auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 197 | chomp $arch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 197 | return $arch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 501 | ▶ | sub apt_get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apt_get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 501 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 501 | return 'apt-get -o DPkg::Lock::Timeout='.$self->apt_lock_timeout; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 243 | ▶ | sub kernel_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
kernel_packages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 243 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 243 | $self->arch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 243 | return 'linux-headers-'.$self->kernel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 203 | ▶ | sub prepare_host { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_host: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 203 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 203 | $self->run_cmd('systemctl stop unattended-upgrades apt-daily.service apt-daily-upgrade.service 2>/dev/null || true', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | auto_die => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 198 | ▶ | sub prepare_source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_source: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 198 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 198 | $self->refresh_package_index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 215 | ▶ | sub refresh_package_index { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh_package_index: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 215 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 215 | $self->run_cmd($self->apt_get.' update -q', auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 15 | ▶ | sub installed_fabric_managers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
installed_fabric_managers: called CC=8 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 15 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 15 | my $out = $self->run_cmd(q{dpkg-query -W -f='${Package} ${db:Status-Abbrev} ${Version}\n' 'nvidia-fabric*manager*' 2>/dev/null}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | auto_die => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 15 | my @present; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 15 | ▶ | for my $line (split /\n/, $out // '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$out // ""
MC/DC0%0/1
$out // ""
$out
Truth table50%1/2
A
A= $out
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 8 | my ( $name, $status, $version ) = split ' ', $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 8 | ▶ | next unless $self->_is_fabric_manager_name($name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 7 | ▶ | next unless defined $status && $status =~ /\A[a-z]([a-zA-Z])/ && $1 ne 'n' && $1 ne 'c'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
defined $status and $status =~ /\A[a-z]([a-zA-Z])/ and $1 ne "n" and $1 ne "c"
defined $status and $status =~ /\A[a-z]([a-zA-Z])/ and $1 ne "n"
defined $status and $status =~ /\A[a-z]([a-zA-Z])/
MC/DC25%1/4
defined $status and $status =~ /\A[a-z]([a-zA-Z])/ and $1 ne "n" and $1 ne "c"
defined $status
$status =~ /\A[a-z]([a-zA-Z])/
$1 ne "n"
$1 ne "c"
Truth table40%2/5
A and B and C and D
A= defined $statusB= $status =~ /\A[a-z]([a-zA-Z])/C= $1 ne "n"D= $1 ne "c"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 6 | push @present, [ $name, $self->_dpkg_upstream_version($version) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 15 | return @present; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 9 | ▶ | sub fabric_manager_version_unavailable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_manager_version_unavailable: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 9 | my ( $self, $pkg, $version ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 9 | my $madison = $self->run_cmd("apt-cache madison $pkg 2>/dev/null", auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 9 | my $full = $self->_madison_version_for($madison, $version); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 9 | ▶ | return 'apt-cache madison '.$pkg.' lists no version '.$version unless defined $full; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 6 | my $sim = $self->run_cmd('LC_ALL=C '.$self->apt_get.' -s install '.$pkg.'='.$full.' 2>&1', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | auto_die => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 6 | ▶ | return 'apt-get -s install '.$pkg.'='.$full.' fails' if $? != 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 5 | ▶ | my @removed = map { /^Remv (\S+)/ ? $1 : () } split /\n/, $sim // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$sim // ""
MC/DC0%0/1
$sim // ""
$sim
Truth table50%1/2
A
A= $sim
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 5 | ▶ | return 'installing '.$pkg.'='.$full.' would remove '.join(', ', @removed) if @removed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 199 | ▶ | sub install_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_packages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 199 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 199 | Rex::Logger::info(' Installing: '.join(', ', @{ $plan->{packages} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 199 | my $pkg_str = join(' ', @{ $plan->{packages} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 199 | $self->run_cmd('DEBIAN_FRONTEND=noninteractive '.$self->apt_get.' install -y '.$pkg_str, auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 261 | ▶ | sub verify_packages { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify_packages: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 261 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 261 | for my $driver_pkg (@{ $plan->{verify} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 390 | my $check = $self->run_cmd("dpkg -l $driver_pkg 2>/dev/null | grep -q '^ii'", auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 390 | ▶ | die "$driver_pkg not installed after apt-get install — check apt output\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | if $? != 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 15 | ▶ | sub fabric_manager_unavailable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_manager_unavailable: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 15 | my ( $self, $pkg ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 15 | my $policy = $self->run_cmd("LC_ALL=C apt-cache policy $pkg 2>/dev/null", auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 15 | ▶ | return if $self->_apt_candidate_present($policy); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | return $pkg.' has no installation candidate after apt-get update'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 14 | ▶ | sub installed_driver_version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
installed_driver_version: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 14 | my ( $self, $source ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 14 | my $pkg = $self->_with_branch($source->{fabric_manager_match}, $source); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 14 | ▶ | die "The driver source names no package to read the driver version from " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ."(fabric_manager_match); the driver is installed, Fabric Manager is not\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | unless defined $pkg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 13 | return $self->_dpkg_upstream_version($self->_dpkg_version($pkg)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 17 | ▶ | sub install_versioned_package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_versioned_package: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 17 | my ( $self, $pkg, $version ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 17 | my $madison = $self->run_cmd("apt-cache madison $pkg 2>/dev/null", auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 17 | my $full = $self->_madison_version_for($madison, $version); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 17 | ▶ | die "apt has no $pkg of driver version $version (apt-cache madison $pkg); Fabric " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | ."Manager must match the driver exactly, so none was installed. The driver is " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ."installed, Fabric Manager is not\n" unless defined $full; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 16 | $self->run_cmd('DEBIAN_FRONTEND=noninteractive '.$self->apt_get.' install -y '.$pkg.'='.$full, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | auto_die => 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 16 | ▶ | sub verify_versioned_package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify_versioned_package: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 16 | my ( $self, $pkg, $version ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 16 | $self->verify_packages({ verify => [ $pkg ] }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 16 | my $installed = $self->_dpkg_upstream_version($self->_dpkg_version($pkg)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 16 | ▶ | die "$pkg is ".( $installed // 'unknown' )." after apt-get install, not the driver's " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
defined $installed and $installed eq $version
$installed // "unknown"
MC/DC50%1/2
defined $installed and $installed eq $version
defined $installed
$installed eq $version
MC/DC0%0/1
$installed // "unknown"
$installed
Truth table66%2/3
A and B
A= defined $installedB= $installed eq $version
Truth table50%1/2
A
A= $installed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ."$version\n" unless defined $installed && $installed eq $version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 29 | ▶ | sub _dpkg_version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dpkg_version: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 29 | my ( $self, $pkg ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 29 | my $v = $self->run_cmd("dpkg-query -W -f='\${Version}' $pkg 2>/dev/null", auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 29 | ▶ | return if $? != 0 || !defined $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$? != 0 or not defined $v
MC/DC0%0/2
$? != 0 or not defined $v
$? != 0
not defined $v
Truth table33%1/3
A or not(B)
A= $? != 0B= not defined $v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 29 | chomp $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 29 | return $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # Pure: "1:580.95.05-0ubuntu1" -> "580.95.05". undef/empty -> undef. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 72 | ▶ | sub _dpkg_upstream_version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dpkg_upstream_version: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 72 | my ( $self, $version ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 72 | ▶ | return unless defined $version && length $version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $version and length $version
MC/DC100%2/2
defined $version and length $version
defined $version
length $version
Truth table100%3/3
A and B
A= defined $versionB= length $version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 70 | ( my $up = $version ) =~ s/^\d+://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 70 | $up =~ s/-[^-]*$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 70 | return $up; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # Pure: the first `apt-cache madison` version (madison lists newest first) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # whose upstream part is $upstream; undef if none. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 26 | ▶ | sub _madison_version_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_madison_version_for: called CC=7 SCAR=20.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 26 | my ( $self, $madison, $upstream ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 26 | ▶ | for my $line (split /\n/, $madison // '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$madison // ""
MC/DC0%0/1
$madison // ""
$madison
Truth table50%1/2
A
A= $madison
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 35 | my ( undef, $full ) = map { s/^\s+|\s+$//gr } split /\|/, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 35 | ▶ | next unless defined $full && length $full; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $full and length $full
MC/DC0%0/2
defined $full and length $full
defined $full
length $full
Truth table33%1/3
A and B
A= defined $fullB= length $full
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 35 | my $up = $self->_dpkg_upstream_version($full); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 35 | ▶ | return $full if defined $up && $up eq $upstream; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $up and $up eq $upstream
MC/DC50%1/2
defined $up and $up eq $upstream
defined $up
$up eq $upstream
Truth table66%2/3
A and B
A= defined $upB= $up eq $upstream
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # karr #56, research of 2026-09-24: the nvlsm .deb (CUDA repo, 2025.12.211) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # Depends on libibumad3; NVIDIA's gpu-driver-container installs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # `nvlsm infiniband-diags` unversioned; the Fabric Manager start script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # needs ibstat (infiniband-diags). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 11 | ▶ | sub nvlink_fabric_packages { ( 'nvlsm', 'infiniband-diags', 'libibumad3' ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvlink_fabric_packages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 159 | ▶ | sub initramfs_command { 'update-initramfs -u 2>/dev/null' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initramfs_command: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | # Pure (karr #26): does `apt-cache policy PKG` output (LC_ALL=C) show an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # installation candidate? An unknown package prints nothing; a known one with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # nothing installable prints "Candidate: (none)". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 42 | ▶ | sub _apt_candidate_present { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_apt_candidate_present: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 42 | my ( $self, $policy ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 42 | ▶ | return 0 unless defined $policy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 41 | my ($candidate) = $policy =~ /^\s*Candidate:\s*(\S+)/m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 41 | ▶ | return (defined $candidate && $candidate ne '(none)') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $candidate and $candidate ne "(none)"
MC/DC100%2/2
defined $candidate and $candidate ne "(none)"
defined $candidate
$candidate ne "(none)"
Truth table100%3/3
A and B
A= defined $candidateB= $candidate ne "(none)"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 36 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||