summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-01-06 04:21:21 +0000
committerNorbert Preining <preining@logic.at>2016-01-06 04:21:21 +0000
commite7dbc0c56fafe5717774ff29b80bc262e210676b (patch)
tree3615f7ca913d5817bf5489cff6d823a55947906b /Master/tlpkg/TeXLive/TLUtils.pm
parentb2789fe251264aceb4417b14edb31f8fe880b3e5 (diff)
checksum verification update, unwinding works again
git-svn-id: svn://tug.org/texlive/trunk@39292 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm40
1 files changed, 24 insertions, 16 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 0b251b2f060..74ff59a0a52 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -1948,25 +1948,18 @@ sub w32_remove_from_path {
=pod
-=item C<unpack($what, $targetdir, @opts>
+=item C<check_file($what, $checksum, $checksize>
-If necessary, downloads C$what>, and then unpacks it into C<$targetdir>.
-C<@opts> is assigned to a hash and can contain the following
-options: C<tmpdir> (use this directory for downloaded files),
-C<checksum> (check downloaded file against this checksum),
-C<size> (check downloaded file against this size),
-C<remove> (remove temporary files after operation).
-Returns the name of the unpacked package (determined from the name of C<$what>)
-in case of success, otherwise undefined.
+Remove C<$what> if either the given C<$checksum> or C<$checksize> does
+not agree. Does nothing if neither of the check arguments is given.
=cut
sub check_file {
my ($xzfile, $checksum, $size) = @_;
- printf STDERR "checking $xzfile for size $size sum $checksum\n";
if ($checksum) {
if (tlmd5($xzfile) ne $checksum) {
- tlwarn("Found $what in $tempdir, but hashsums differ, removing it.\n");
+ tlwarn("Found $xzfile, but hashsums differ, removing it.\n");
unlink($xzfile);
}
} elsif ($size) {
@@ -1978,11 +1971,29 @@ sub check_file {
tlwarn("Found $xzfile, with equal size, continuing fingers crossed.\n");
}
} else {
- tlwarn("Found $xzfile but no size or checksum information, removing it.\n");
- unlink($xzfile);
+ # We cannot remove the file here, otherwise restoring of backups
+ # or unwind packages might die.
+ #
+ #tlwarn("Found $xzfile but no size or checksum information, removing it.\n");
+ # unlink($xzfile);
}
}
+=pod
+
+=item C<unpack($what, $targetdir, @opts>
+
+If necessary, downloads C$what>, and then unpacks it into C<$targetdir>.
+C<@opts> is assigned to a hash and can contain the following
+options: C<tmpdir> (use this directory for downloaded files),
+C<checksum> (check downloaded file against this checksum),
+C<size> (check downloaded file against this size),
+C<remove> (remove temporary files after operation).
+Returns the name of the unpacked package (determined from the name of C<$what>)
+in case of success, otherwise undefined.
+
+=cut
+
sub unpack {
my ($what, $target, %opts) = @_;
# remove by default
@@ -1990,7 +2001,6 @@ sub unpack {
my $tempdir = (defined($opts{'tmpdir'}) ? $opts{'tmpdir'} : tl_tmpdir());
my $checksum = (defined($opts{'checksum'}) ? $opts{'checksum'} : 0);
my $size = (defined($opts{'size'}) ? $opts{'size'} : 0);
- printf STDERR " unpack $what size $size checksum $checksum\n";
if (!defined($what)) {
tlwarn("TLUtils::unpack: nothing to unpack!\n");
@@ -2029,7 +2039,6 @@ sub unpack {
$xzfile_quote = "\"$xzfile\"";
$tarfile_quote = "\"$tarfile\"";
$target_quote = "\"$target\"";
-printf STDERR "BBB xzfile $xzfile for size $size sum $checksum\n";
if ($what =~ m,^(http|ftp)://,) {
# we are installing from the NET
# check for the presence of $what in $tempdir
@@ -2053,7 +2062,6 @@ printf STDERR "BBB xzfile $xzfile for size $size sum $checksum\n";
# we are installing from local compressed files
# copy it to temp
TeXLive::TLUtils::copy($what, $tempdir);
-printf STDERR "AAA xzfile $xzfile for size $size sum $checksum\n";
check_file($xzfile, $checksum, $size);
if (! -r $xzfile) {