diff options
author | Norbert Preining <preining@logic.at> | 2020-02-17 03:23:13 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2020-02-17 03:23:13 +0000 |
commit | 4cd4f4003232c8e0e50766507fe129ec5cce8603 (patch) | |
tree | 0769905d5da28e5ca269dff42cdad2e2cdb6ae9b /Master/tlpkg/TeXLive/TLPDB.pm | |
parent | 012d70bc65d961edc4646b4ce4c77f7344e0f57d (diff) |
refactor verify_checksum return code handling into separate function
git-svn-id: svn://tug.org/texlive/trunk@53820 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 55 |
1 files changed, 7 insertions, 48 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 5ff686d5a78..35255ce0228 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -1,6 +1,6 @@ # $Id$ # TeXLive::TLPDB.pm - tlpdb plain text database files. -# Copyright 2007-2019 Norbert Preining +# Copyright 2007-2020 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. @@ -370,57 +370,16 @@ sub from_file { # # before we open and proceed, verify the downloaded file if ($params{'verify'} && $media ne 'local_uncompressed') { - my ($r, $m) = TeXLive::TLCrypto::verify_checksum($tlpdbfile, "$path.$ChecksumExtension"); - if ($r == $VS_CHECKSUM_ERROR) { - tldie("$0: checksum error when downloading $tlpdbfile from $path: $m\n"); - } elsif ($r == $VS_SIGNATURE_ERROR) { - tldie("$0: signature verification error of $tlpdbfile from $path: $m\n"); - } elsif ($r == $VS_CONNECTION_ERROR) { - tldie("$0: cannot download: $m\n"); - } elsif ($r == $VS_UNSIGNED) { - debug("$0: remote database checksum is not signed, continuing anyway: $m\n"); - $self->verification_status($r); - } elsif ($r == $VS_GPG_UNAVAILABLE) { - debug("$0: TLPDB: no gpg available, continuing anyway!\n"); - $self->verification_status($r); - } elsif ($r == $VS_PUBKEY_MISSING) { - debug("$0: TLPDB: pubkey missing, continuing anyway!\n"); - $self->verification_status($r); - } elsif ($r == $VS_VERIFIED) { - $is_verified = 1; - $self->verification_status($r); - } else { - tldie("$0: unexpected return value from verify_checksum: $r\n"); - } + my ($verified, $status) = TeXLive::TLCrypto::verify_checksum_and_check_return($tlpdbfile, $path); + $is_verified = $verified; + $self->verification_status($status); } open($retfh, "<$tlpdbfile") || die "$0: open($tlpdbfile) failed: $!"; } else { if ($params{'verify'} && $media ne 'local_uncompressed') { - my ($r, $m) = TeXLive::TLCrypto::verify_checksum($path, "$path.$ChecksumExtension"); - if ($r == $VS_CHECKSUM_ERROR) { - tldie("$0: checksum error when downloading $path from $path: $m\n"); - } elsif ($r == $VS_SIGNATURE_ERROR) { - tldie("$0: signature verification error of $path from $path: $m\n"); - } elsif ($r == $VS_CONNECTION_ERROR) { - tldie("$0: cannot download: $m\n"); - } elsif ($r == $VS_UNSIGNED) { - debug("$0: remote database checksum is not signed, continuing anyway!\n"); - $self->verification_status($r); - } elsif ($r == $VS_GPG_UNAVAILABLE) { - debug("$0: TLPDB: no gpg available, continuing anyway!\n"); - $self->verification_status($r); - } elsif ($r == $VS_PUBKEY_MISSING) { - debug("$0: TLPDB: pubkey missing, continuing anyway!\n"); - $self->verification_status($r); - } elsif ($r == $VS_EXPKEYSIG) { - debug("$0: TLPDB: signature verified, but key expired, continuing anyway!\n"); - $self->verification_status($r); - } elsif ($r == $VS_VERIFIED) { - $is_verified = 1; - $self->verification_status($r); - } else { - tldie("$0: unexpected return value from verify_checksum: $r\n"); - } + my ($verified, $status) = TeXLive::TLCrypto::verify_checksum_and_check_return($path, $path); + $is_verified = $verified; + $self->verification_status($status); } open(TMP, "<$path") || die "$0: open($path) failed: $!"; $retfh = \*TMP; |