diff options
author | Norbert Preining <preining@logic.at> | 2016-04-21 02:42:47 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-04-21 02:42:47 +0000 |
commit | 800560e3139b1d2c41bc86a3fbf8659529ee39d8 (patch) | |
tree | b1028a226ce9ac27948b15424ae9babfd302584b /Master/tlpkg/TeXLive/TLPDB.pm | |
parent | ec007a1257638d2063647d9712b5ea5d41b1276a (diff) |
tlpdb: safe status of being verified, show status for each tlpdb
git-svn-id: svn://tug.org/texlive/trunk@40646 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 65999bfc9a5..2e85fb82e1f 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -57,6 +57,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->package_revision("packagename"); $tlpdb->location; $tlpdb->platform; + $tlpdb->is_verified; $tlpdb->config_src_container; $tlpdb->config_doc_container; $tlpdb->config_container_format; @@ -132,7 +133,8 @@ sub new { my %params = @_; my $self = { root => $params{'root'}, - tlps => $params{'tlps'} + tlps => $params{'tlps'}, + verified => 0 }; my $verify = defined($params{'verify'}) ? $params{'verify'} : 0; ddebug("TLPDB new: args: @_ ; verify = $verify\n"); @@ -276,6 +278,7 @@ sub from_file { } my $retfh; my $tlpdbfile; + my $is_verified = 0; # do media detection my $rootpath = $self->root; if ($rootpath =~ m,http://|ftp://,) { @@ -374,8 +377,10 @@ sub from_file { tldie("$0: signature verification error of $tlpdbfile from $path: $m\n"); } elsif ($r == -1) { tldie("$0: connection problems, cannot download: $m\n"); + } elsif ($r == -2) { + debug("$0: remote database checksum is not signed, continuing anyway!\n"); } elsif ($r == 0) { - # all is fine, do nothing + $is_verified = 1; } else { tldie("$0: unexpected return value from verify_checksum: $r\n"); } @@ -390,8 +395,10 @@ sub from_file { tldie("$0: signature verification error of $tlpdbfile from $path: $m\n"); } elsif ($r == -1) { tldie("$0: connection problems, cannot download: $m\n"); + } elsif ($r == -2) { + debug("$0: remote database checksum is not signed, continuing anyway!\n"); } elsif ($r == 0) { - # all is fine, do nothing + $is_verified = 1; } else { tldie("$0: unexpected return value from verify_checksum: $r\n"); } @@ -414,6 +421,8 @@ sub from_file { debug(" $path\n"); } + $self->{'verified'} = $is_verified; + # remove the un-xz-ed tlpdb file from temp dir # THAT IS RACY!!! we should fix that in some better way with tempfile close($retfh); @@ -1137,6 +1146,20 @@ sub platform { =pod +=item C<< $tlpdb->is_verified >> + +Returns 0/1 depending on whether the tlpdb was verified by checking +the cryptographic signature. + +=cut + +sub is_verified { + my $self = shift; + return $self->{'verified'}; +} + +=pod + =item C<< $tlpdb->listdir >> The function C<listdir> allows to read and set the packages variable |