diff options
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 1 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 40 |
2 files changed, 24 insertions, 17 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 15766d2950f..134b4f4360b 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -1655,7 +1655,6 @@ sub not_virtual_install_package { sub _install_data { my ($self, $what, $reloc, $filelistref, $totlpdb, $whatsize, $whatcheck) = @_; -printf STDERR "_install_data for $what whatsize $whatsize whatcheck $whatcheck\n"; my $target = $totlpdb->root; my $tempdir = "$target/temp"; 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) { |