From 1736c6642dcc6ddfddb8338b2722aab914971b13 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 6 Jan 2016 04:20:30 +0000 Subject: TLUtils::unpack - only support .tar.xz, no .tar only anymore git-svn-id: svn://tug.org/texlive/trunk@39285 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLUtils.pm | 109 ++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 65 deletions(-) (limited to 'Master/tlpkg') 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; -- cgit v1.2.3