diff options
author | Norbert Preining <preining@logic.at> | 2016-01-06 04:20:30 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-01-06 04:20:30 +0000 |
commit | 1736c6642dcc6ddfddb8338b2722aab914971b13 (patch) | |
tree | 77f467e0c170e39c6e9da4617302fc7fdc2f67b0 /Master/tlpkg/TeXLive/TLUtils.pm | |
parent | 567167c97ae0cb636a1e49e8cf4fde3b0807acb8 (diff) |
TLUtils::unpack - only support .tar.xz, no .tar only anymore
git-svn-id: svn://tug.org/texlive/trunk@39285 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 109 |
1 files changed, 44 insertions, 65 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index ab333f80e21..8558df0809a 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -2259,85 +2259,64 @@ sub unpack { } my $type; - if ($what =~ m,\.tar(\.xz)?$,) { - $type = defined($what) ? "xz" : "tar"; - } else { + if ($what !~ m/\.tar\.xz$/) { tlwarn("TLUtils::unpack: don't know how to unpack this: $what\n"); return; } - # we are still here, so something was handed in and we have either - # .tar or .tar.xz my $fn = basename($what); my $pkg = $fn; - $pkg =~ s/\.tar(\.xz)?$//; + $pkg =~ s/\.tar\.xz$//; my $tarfile; - my $remove_tarfile = 1; my $remove_xzfile = $remove; - if ($type eq "xz") { - my $xzfile = "$tempdir/$fn"; - $tarfile = "$tempdir/$fn"; $tarfile =~ s/\.xz$//; - my $xzfile_quote; - my $tarfile_quote; - my $target_quote; - if (win32()) { - $xzfile =~ s!/!\\!g; - $tarfile =~ s!/!\\!g; - $target =~ s!/!\\!g; - } - $xzfile_quote = "\"$xzfile\""; - $tarfile_quote = "\"$tarfile\""; - $target_quote = "\"$target\""; - if ($what =~ m,^(http|ftp)://,) { - # we are installing from the NET - # check for the presence of $what in $tempdir - if (-r $xzfile) { - check_file($xzfile, $checksum, $size); - } - # if the file is now not present, we can use it - if (! -r $xzfile) { - # try download the file and put it into temp - download_file($what, $xzfile); - # remove false downloads - check_file($xzfile, $checksum, $size); - if ( -r $xzfile ) { - tlwarn("Downloading\n"); - tlwarn(" $what\n"); - tlwarn("did not succeed, please retry.\n"); - return; - } - } - } else { - # we are installing from local compressed files - # copy it to temp - TeXLive::TLUtils::copy($what, $tempdir); - # we can remove it afterwards - $remove_xzfile = 1; - } - debug("un-xzing $xzfile to $tarfile\n"); - system("$xzdec < $xzfile_quote > $tarfile_quote"); - if (! -f $tarfile) { - tlwarn("TLUtils::unpack: Unpacking $xzfile failed, please retry.\n"); - unlink($tarfile, $xzfile); - return; + my $xzfile = "$tempdir/$fn"; + $tarfile = "$tempdir/$fn"; $tarfile =~ s/\.xz$//; + my $xzfile_quote; + my $tarfile_quote; + my $target_quote; + if (win32()) { + $xzfile =~ s!/!\\!g; + $tarfile =~ s!/!\\!g; + $target =~ s!/!\\!g; + } + $xzfile_quote = "\"$xzfile\""; + $tarfile_quote = "\"$tarfile\""; + $target_quote = "\"$target\""; + if ($what =~ m,^(http|ftp)://,) { + # we are installing from the NET + # check for the presence of $what in $tempdir + if (-r $xzfile) { + check_file($xzfile, $checksum, $size); } - unlink($xzfile) if $remove_xzfile; - } else { - $tarfile = "$tempdir/$fn"; - if ($what =~ m,http://|ftp://,) { - if (!download_file($what, $tarfile) || (! -r $tarfile)) { - tlwarn("Downloading \n"); + # if the file is now not present, we can use it + if (! -r $xzfile) { + # try download the file and put it into temp + download_file($what, $xzfile); + # remove false downloads + check_file($xzfile, $checksum, $size); + if ( -r $xzfile ) { + tlwarn("Downloading\n"); tlwarn(" $what\n"); - tlwarn("failed, please retry.\n"); - unlink($tarfile); + tlwarn("did not succeed, please retry.\n"); return; } - } else { - $tarfile = $what; - $remove_tarfile = 0; } + } else { + # we are installing from local compressed files + # copy it to temp + TeXLive::TLUtils::copy($what, $tempdir); + # we can remove it afterwards + $remove_xzfile = 1; + } + debug("un-xzing $xzfile to $tarfile\n"); + system("$xzdec < $xzfile_quote > $tarfile_quote"); + if (! -f $tarfile) { + tlwarn("TLUtils::unpack: Unpacking $xzfile failed, please retry.\n"); + unlink($tarfile, $xzfile); + return; } - if (untar($tarfile, $target, $remove_tarfile)) { + unlink($xzfile) if $remove_xzfile; + if (untar($tarfile, $target, 1)) { return "$pkg"; } else { return; |