summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-04-21 00:31:43 +0000
committerNorbert Preining <preining@logic.at>2016-04-21 00:31:43 +0000
commit1bf271f3d5249f93f9c8f9b911f0a0ee0221194f (patch)
tree40852cc7dd20927ba6339e3e3d14197ea006cf30 /Master/tlpkg/TeXLive/TLUtils.pm
parent0977df7d314abf862bcbc9f0c231157c499e5016 (diff)
verification reporting reworked: be non-intrusive
git-svn-id: svn://tug.org/texlive/trunk@40640 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm32
1 files changed, 21 insertions, 11 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 8de05ee9d75..dc3c909df08 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -3750,9 +3750,11 @@ sub slurp_file {
=item C<< verify_checksum($file, $checksum_url) >>
-Verifies that C<$file> has checksum C<$checksum_url>.
+Verifies that C<$file> has checksum C<$checksum_url>, and if gpg is
+available also verifies that the checksum is signed.
-Returns 0 on success, -1 on connection error, 1 on checksum error.
+Returns 0 on success, -1 on connection error, 1 on checksum, and
+2 on signature errors.
In case of errors returns an informal message as second argument.
=cut
@@ -3829,7 +3831,7 @@ sub download_to_temp_or_file {
Verifies a download of C<$url> into C<$file> by cheking the
gpg signature in C<$url.asc>.
-Returns 0 on success, -1 on connection error, 1 on checksum error.
+Returns 0 on success, -1 on connection error, 2 on signature error.
In case of errors returns an informal message as second argument.
=cut
@@ -3842,23 +3844,32 @@ sub verify_signature {
if ($::gpg) {
my $signature_file = download_to_temp_or_file($signature_url);
if ($signature_file) {
- if (TeXLive::TLUtils::gpg_verify_signature($file, $signature_file)) {
- info("cryptographic signature of $url verified\n");
+ my ($ret, $out) = gpg_verify_signature($file, $signature_file);
+ if ($ret) {
+ # no need to show the output
+ debug("cryptographic signature of $url verified\n");
+ return(0);
} else {
- return(1, <<GPGERROR);
-cryptograpic verification of
+ return(2, <<GPGERROR);
+cryptographic signature verification of
$file
against
$signature_url
-failed. Please report to texlive\@tug.org
+failed. Output was
+$out
+Please report to texlive\@tug.org
GPGERROR
}
} else {
debug("no access to cryptographic signature $signature_url\n");
+ return(-1);
}
} else {
debug("gpg prog not defined, no checking of signatures\n");
+ # we return 0 (= success) if not gpg is available
+ return(0);
}
+ # not reached
return (0);
}
@@ -3874,10 +3885,9 @@ sub gpg_verify_signature {
my ($out, $ret) = run_cmd("$::gpg --verify $sig_quote $file_quote 2>&1");
if ($ret == 0) {
debug("verification succeeded, output:\n$out\n");
- return 1;
+ return (1, $out);
} else {
- tlwarn("verification failed, output:\n$out\n");
- return 0;
+ return (0, $out);
}
}