| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # vim: set ts=2 sw=2 tw=0: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # vim: set expandtab: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | package Rex::Repositorio::Repository::Base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use common::sense; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use English; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use XML::LibXML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Params::Validate qw(:all); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use IO::All; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use File::Path 'make_path'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use File::Basename qw'dirname'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use File::Copy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Digest::SHA; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Digest::MD5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use JSON::XS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use List::MoreUtils 'firstidx'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | our $VERSION = '1.2.1'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | has app => ( is => 'ro' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | has repo => ( is => 'ro' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub ua { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ua: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my %option; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( exists $self->repo->{key} && exists $self->repo->{cert} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->repo->{"key"} and exists $self->repo->{"cert"}
MC/DC0%0/2
exists $self->repo->{"key"} and exists $self->repo->{"cert"}
exists $self->repo->{"key"}
exists $self->repo->{"cert"}
Truth table0%0/3
A and B
A= exists $self->repo->{"key"}B= exists $self->repo->{"cert"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # we need ssl client cert authentication | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | $option{ssl_opts} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | SSL_cert_file => $self->repo->{cert}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | SSL_key_file => $self->repo->{key}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | SSL_ca_file => $self->repo->{ca}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | return $self->app->ua(%option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub download_gzip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
download_gzip: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my ( $self, $url ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $content = $self->download($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | require Compress::Zlib; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my $t1 = time(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $un_content = Compress::Zlib::memGunzip($content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $tdiff = time() - $t1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $self->app->logger->debug("Uncompressing: $url took: ${tdiff} seconds"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ( !$un_content ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->app->logger->log_and_croak(level => 'error', message => 'Error uncompressing data.'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return $un_content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub gunzip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gunzip: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my ( $self, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | require Compress::Zlib; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return Compress::Zlib::memGunzip($data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub download { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
download: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my ( $self, $url ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my $retry_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | my $max_retries = $self->app->config->{DownloadRetryCount} // 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->app->config->{"DownloadRetryCount"} // 3
MC/DC0%0/1
$self->app->config->{"DownloadRetryCount"} // 3
$self->app->config->{"DownloadRetryCount"}
Truth table0%0/2
A
A= $self->app->config->{"DownloadRetryCount"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $success; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | my $content; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | while (!$success && $retry_count <= $max_retries ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $success and $retry_count <= $max_retries
MC/DC0%0/2
not $success and $retry_count <= $max_retries
not $success
$retry_count <= $max_retries
Truth table0%0/3
not(A) and B
A= not $successB= $retry_count <= $max_retries
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $t1 = time(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $resp = $self->ua->get($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $tdiff = time() - $t1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $self->app->logger->debug("Download: ${url} took: ${tdiff} seconds"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if ( !$resp->is_success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $self->app->logger->error("Download: ${url} failed with status: " . $resp->status_line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $retry_count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if ($retry_count <= $max_retries) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $self->app->logger->error("Download: ${url} retrying"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $self->app->logger->log_and_croak(level => 'error', message=> "download: ${url} failed and exhausted all retries."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $success = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $content = $resp->content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | return $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub get_xml { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_xml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my ( $self, $xml ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | return XML::LibXML->load_xml( string => $xml ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub decode_xml { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_xml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my ( $self, $xml ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | return XMLin( $xml, ForceArray => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub download_package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
download_package: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my %option = validate( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | name => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | url => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | dest => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | cb => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | type => CODEREF, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | update_file => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | type => BOOLEAN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | force => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | type => BOOLEAN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $repo_dir = $self->app->get_repo_dir(repo => $self->repo->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $package_file = File::Spec->catfile($repo_dir, $option{dest}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | $self->_download_binary_file( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | dest => $package_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | url => $option{url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | cb => $option{cb}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | force => $option{force}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | update_file => $option{update_file}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub download_metadata { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
download_metadata: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my %option = validate( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | url => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | dest => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | cb => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | type => CODEREF, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | force => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | type => BOOLEAN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $repo_dir = $self->app->get_repo_dir(repo => $self->repo->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $metadata_file = File::Spec->catfile($repo_dir, $option{dest}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | $self->_download_binary_file( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | dest => $metadata_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | url => $option{url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | cb => $option{cb}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | force => $option{force}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub _download_binary_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_download_binary_file: not called CC=21 SCAR=61.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my %option = validate( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | url => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | dest => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | cb => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | type => CODEREF | UNDEF, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | force => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | type => BOOLEAN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | update_file => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | type => BOOLEAN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->app->logger->debug("_download_binary_file: $option{url} -> $option{dest}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | make_path( dirname( $option{dest} ) ) if ( !-d dirname $option{dest} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if ( exists $option{cb} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
exists $option{"cb"} and ref $option{"cb"} eq "CODE" and $option{"update_file"} and -f $option{"dest"}
exists $option{"cb"} and ref $option{"cb"} eq "CODE" and $option{"update_file"}
exists $option{"cb"} and ref $option{"cb"} eq "CODE"
MC/DC0%0/4
exists $option{"cb"} and ref $option{"cb"} eq "CODE" and $option{"update_file"} and -f $option{"dest"}
exists $option{"cb"}
ref $option{"cb"} eq "CODE"
$option{"update_file"}
-f $option{"dest"}
Truth table0%0/5
A and B and C and D
A= exists $option{"cb"}B= ref $option{"cb"} eq "CODE"C= $option{"update_file"}D= -f $option{"dest"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | && ref $option{cb} eq "CODE" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | && $option{update_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | && -f $option{dest} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $option{cb}->( $option{dest} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | } or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # if callback is failing, we need to download the file once again. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # so just set force to true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $self->app->logger->debug( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | "_download_binary_file: $option{dest} Setting option force -> 1: update_file is enabled and callback failed." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $option{force} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ( -f $option{dest} && !$option{force} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-f $option{"dest"} and not $option{"force"}
MC/DC0%0/2
-f $option{"dest"} and not $option{"force"}
-f $option{"dest"}
not $option{"force"}
Truth table0%0/3
A and not(B)
A= -f $option{"dest"}B= not $option{"force"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->app->logger->debug("_download_binary_file: Skipping $option{dest}. File already exists and is the correct checksum"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if ( !-w dirname( $option{dest} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $self->app->logger->log_and_croak( level => 'error', message => "_download_binary_file: Can't write to " . dirname( $option{dest} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if ( -f $option{dest} && $option{force} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-f $option{"dest"} and $option{"force"}
MC/DC0%0/2
-f $option{"dest"} and $option{"force"}
-f $option{"dest"}
$option{"force"}
Truth table0%0/3
A and B
A= -f $option{"dest"}B= $option{"force"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $self->app->logger->debug("_download_binary_file: $option{dest} force enabled, unlinking"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | unlink $option{dest}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my $retry_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | my $max_retries = $self->app->config->{DownloadRetryCount} // 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->app->config->{"DownloadRetryCount"} // 3
MC/DC0%0/1
$self->app->config->{"DownloadRetryCount"} // 3
$self->app->config->{"DownloadRetryCount"}
Truth table0%0/2
A
A= $self->app->config->{"DownloadRetryCount"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my $success; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | while (!$success && $retry_count <= $max_retries ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $success and $retry_count <= $max_retries
MC/DC0%0/2
not $success and $retry_count <= $max_retries
not $success
$retry_count <= $max_retries
Truth table0%0/3
not(A) and B
A= not $successB= $retry_count <= $max_retries
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $t1 = time(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | open my $fh, '>', $option{dest}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | binmode $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | my $resp = $self->ua->get( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | $option{url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | ':content_cb' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my ( $data, $response, $protocol ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | print $fh $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my $tdiff = time() - $t1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $self->app->logger->debug("_download_binary_file: $option{url} took: ${tdiff} seconds"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ( !$resp->is_success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | unlink $option{dest}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $self->app->logger->error("_download_binary_file: $option{url} failed with status: " . $resp->status_line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $retry_count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | if ($retry_count <= $max_retries) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $self->app->logger->error("_download_binary_file: $option{url} retrying"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | if($self->app->config->{DownloadSkip404} && $resp->code == 404) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->app->config->{"DownloadSkip404"} and $resp->code == 404
MC/DC0%0/2
$self->app->config->{"DownloadSkip404"} and $resp->code == 404
$self->app->config->{"DownloadSkip404"}
$resp->code == 404
Truth table0%0/3
A and B
A= $self->app->config->{"DownloadSkip404"}B= $resp->code == 404
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $self->app->logger->error("_download_binary_file: $option{url} failed with status: " . $resp->status_line . ". Ignoring due to config option DownloadSkip404."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $self->app->logger->log_and_croak(level => 'error', message=> "_download_binary_file: $option{url} failed and exhausted all retries."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $success = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $self->app->logger->notice("Downloaded new file: $option{url}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | $option{cb}->( $option{dest} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | if ( exists $option{cb} && ref $option{cb} eq "CODE" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $option{"cb"} and ref $option{"cb"} eq "CODE"
MC/DC0%0/2
exists $option{"cb"} and ref $option{"cb"} eq "CODE"
exists $option{"cb"}
ref $option{"cb"} eq "CODE"
Truth table0%0/3
A and B
A= exists $option{"cb"}B= ref $option{"cb"} eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | sub add_file_to_repo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_file_to_repo: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | my %option = validate( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | source => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | type => SCALAR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | callbacks => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | valid_file => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | return -f $_[0] ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | dest => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if ( !-f $option{source} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self->app->logger->log_and_croak(level => 'error', message => "add_file_to_repo: File $option{source} not found."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $self->app->logger->debug("add_file_to_repo: Copy $option{source} -> $option{dest}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | my $ret = copy $option{source}, $option{dest}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | if ( !$ret ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $self->app->logger->log_and_croak(level => 'error', message => "add_file_to_repo: Error copying file $option{source} to $option{dest}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub remove_file_from_repo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_file_from_repo: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my %option = validate( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | file => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ( !-f $option{file} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $self->app->logger->error("Fild $option{file} not found."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | confess "Fild $option{file} not found."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $self->app->logger->debug("Deleting $option{file}."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | my $ret = unlink $option{file}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if ( !$ret ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $self->app->logger->error("Error deleting file $option{file}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | confess "Error deleting file $option{file}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | sub _checksum_md5 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checksum_md5: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my ( $self, $file, $wanted_checksum ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $md5 = Digest::MD5->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | open my $fh, "<", $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | binmode $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $md5->addfile($fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $file_checksum = $md5->hexdigest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $self->app->logger->debug("_checksum_md5: file: ${file} wanted_checksum: ${wanted_checksum} == ${file_checksum}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if ( $wanted_checksum ne $file_checksum ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | $self->app->logger->log_and_croak(level => 'error', message => "_checksum_md5: Checksum for ${file} wrong."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | sub _checksum_size { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checksum_size: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | my ( $self, $file, $wanted_size ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my @stats = stat($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $file_size = $stats[7]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $self->app->logger->debug("_checksum_size: file: ${file} wanted_size: ${wanted_size} == ${file_size}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | if ( $wanted_size ne $file_size ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $self->app->logger->log_and_croak(level => 'error', message => "_checksum_size: File size for ${file} wrong."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | sub _checksum_sha { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checksum_sha: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my ($self, $c_type, $file, $wanted_checksum) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my $sha = Digest::SHA->new($c_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $sha->addfile($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $file_checksum = $sha->hexdigest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $self->app->logger->debug("_checksum: file: ${file} wanted_checksum: ${wanted_checksum} == ${file_checksum}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | if ( $wanted_checksum ne $file_checksum ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $self->app->logger->log_and_croak(level => 'error', message => "_checksum_sha: Checksum for ${file} wrong."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | sub _checksum { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checksum: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my ( $self, $file, $type, $wanted_checksum ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my $c_type = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if ( $type eq "sha256" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $c_type = "256"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | return $self->_checksum_sha( $c_type, $file, $wanted_checksum ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | elsif ( $type eq "md5" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return $self->_checksum_md5( $file, $wanted_checksum ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | elsif ( $type eq 'size' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | return $self->_checksum_size( $file, $wanted_checksum ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | return $self->_checksum_sha( $c_type, $file, $wanted_checksum ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | sub verify_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if ( !exists $self->app->config->{RepositoryRoot} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->app->config->{'RepositoryRoot'} && $self->app->config->{'RepositoryRoot'}
MC/DC0%0/2
exists $self->app->config->{'RepositoryRoot'} && $self->app->config->{'RepositoryRoot'}
exists $self->app->config->{'RepositoryRoot'}
$self->app->config->{'RepositoryRoot'}
Truth table0%0/3
A && B
A= exists $self->app->config->{'RepositoryRoot'}B= $self->app->config->{'RepositoryRoot'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | || !$self->app->config->{RepositoryRoot} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | confess "No repository root (RepositoryRoot) given in configuration file."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | sub read_password { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_password: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my ( $self, $msg ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | $msg ||= "Password: "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$msg ||= "Password: "
MC/DC0%0/1
$msg ||= "Password: "
$msg
Truth table0%0/2
A
A= $msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | print $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $password = <STDIN>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | chomp $password; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | return $password; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | sub get_errata { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_errata: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my %option = validate( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | package => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | version => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | arch => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | type => SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | my $errata_dir = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $self->app->get_errata_dir( repo => $self->repo->{name}, tag => "head" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | !-f File::Spec->catfile( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | $errata_dir, $option{arch}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | substr( $option{package}, 0, 1 ), $option{package}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | "errata.json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | return {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | my $ref = decode_json( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | IO::All->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | File::Spec->catfile( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | $errata_dir, $option{arch}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | substr( $option{package}, 0, 1 ), $option{package}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | "errata.json" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | )->slurp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | my $package = $option{package}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $arch = $option{arch}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my $version = $option{version}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | my $pkg = $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my @versions = keys %{$pkg}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | @versions = sort { $a cmp $b } @versions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | my $idx = firstidx { ( $_ cmp $version ) == 1 } @versions; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | if ( $idx == -1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # no updates found | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | return {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | $idx = 0 if ( $idx <= 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my @update_versions = @versions[ $idx .. $#versions ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | for my $uv (@update_versions) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $ret->{$uv} = $pkg->{$uv}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub update_errata { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_errata: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | my $errata_type = $self->repo->{errata}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | $self->app->logger->debug("Updating errata of type: $errata_type"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | my $data = $self->download("http://errata.repositor.io/$errata_type.tar.gz"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # TODO: use File::Temp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | my $file = File::Spec->catfile(File::Spec->tmpdir(),"$errata_type.tar.gz"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | open( my $fh, '>', $file ) or confess($!); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | binmode $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | print $fh $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | close($fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | my $errata_dir = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | $self->app->get_errata_dir( repo => $self->repo->{name}, tag => "head" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | make_path($errata_dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | #XXX ewww | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | system "cd ${errata_dir} ; tar xzf ${file}"; #TODO: replace with perl | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | if ( $? != 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | confess "Error extracting errata database."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | unlink $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | $self->app->logger->debug("Updating errata of type: ${errata_type} (done)"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||