From 261f477ef1fce70a7a628f6b549665643980df79 Mon Sep 17 00:00:00 2001 From: krimdomu Date: Sat, 15 Jan 2022 11:10:56 +0100 Subject: [PATCH 1/2] chore: added venv and .envrc to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 747ca91..02d57aa 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ tmp repo .build *~ +venv +.envrc From 3efbb6c487ad800d548bac9e4c5aada09396db85 Mon Sep 17 00:00:00 2001 From: krimdomu Date: Sat, 15 Jan 2022 22:01:45 +0100 Subject: [PATCH 2/2] fix: use sha256 checksums if no other is available --- lib/Rex/Repositorio/Repository/Apt.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/Rex/Repositorio/Repository/Apt.pm b/lib/Rex/Repositorio/Repository/Apt.pm index a8204d4..1d603a2 100644 --- a/lib/Rex/Repositorio/Repository/Apt.pm +++ b/lib/Rex/Repositorio/Repository/Apt.pm @@ -70,9 +70,9 @@ sub mirror { $self->app->logger->notice('Downloading file listing...'); my $f_count = 0; - my $f_total = scalar( @{ $ref->{SHA1} || $ref->{SHA1Sum} } ); + my $f_total = scalar( @{ $ref->{SHA1} || $ref->{SHA1Sum} || $ref->{SHA256} } ); - for my $file_data ( @{ $ref->{SHA1} || $ref->{SHA1Sum} } ) { + for my $file_data ( @{ $ref->{SHA1} || $ref->{SHA1Sum} || $ref->{SHA256} } ) { my $file_url = $url . "/" . $file_data->{file}; my $file = $file_data->{file}; @@ -140,13 +140,14 @@ sub mirror { $self->app->logger->info("${p_count}/$p_total ${package_url}"); my $local_file = File::Spec->catfile($package->{Filename}); + my $sha1 = ( $package->{SHA1} || $package->{SHA1Sum} ); + my $shasum = ( $package->{SHA1} || $package->{SHA1Sum} || $package->{SHA256} || $package->{SHA256Sum} ); $self->download_package( url => $package_url, name => $package_name, dest => $local_file, cb => sub { - $self->_checksum( @_, "sha1", - ( $package->{SHA1} || $package->{SHA1Sum} ) ); + $self->_checksum( @_, ($sha1 ? "sha1" : "sha256"), $shasum); }, force => $option{force}, update_file => $option{update_files}, @@ -206,13 +207,15 @@ sub mirror { $self->app->logger->info("${p_count}/${p_total} ${package_url}"); my $local_file = File::Spec->catfile($package->{Filename}); + my $sha1 = ( $package->{SHA1} || $package->{SHA1Sum} ); + my $shasum = ( $package->{SHA1} || $package->{SHA1Sum} || $package->{SHA256} || $package->{SHA256Sum} ); + $self->download_package( url => $package_url, name => $package_name, dest => $local_file, cb => sub { - $self->_checksum( @_, "sha1", - ( $package->{SHA1} || $package->{SHA1Sum} ) ); + $self->_checksum( @_, ($sha1 ? "sha1" : "sha256"), $shasum ); }, force => $option{update_files} );