From aa4149b03f457733741370e4914fc1510e0c408b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 18 May 2018 23:46:56 +0000 Subject: more work on multiple compressor support git-svn-id: svn://tug.org/texlive/trunk@47760 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 8 ++++++++ Master/tlpkg/TeXLive/TLUtils.pm | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'Master') diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index ca1d1100931..e0e5db16dfe 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -630,6 +630,14 @@ sub make_container { tlwarn("$0: programs not set up, trying \"tar\".\n"); $tar = "tar"; } + + # determine compressor: + # * first try the one passed in as requested + # * if that one is not available, fall back to xz + if ($type ne "xz" && !defined($::progs{$CompressorProgram{$type}})) { + debug("$0: compressor of type $type not available, falling back to xz\n"); + $type = "xz"; + } my $compressor = $::progs{$CompressorProgram{$type}}; my @compressorargs = @{$CompressorArgs{$type}}; my $compressorextension = $CompressorExtension{$type}; diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 4a5aebbb304..b92f5cc28e1 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -2134,9 +2134,12 @@ sub unpack { } my $type; - for my $ext (@AcceptedCompressors) { + my $compressorextension; + for my $comptype (@AcceptedCompressors) { + my $ext = $CompressorExtension{$comptype}; if ($what =~ m/\.tar\.$ext$/) { - $type = $ext; + $type = $comptype; + $compressorextension = $ext; } } if (!$type) { @@ -2148,7 +2151,7 @@ sub unpack { # my $wget = $::progs{'wget'}; # only check the necessary compressor program my $decompressor = TeXLive::TLUtils::quotify_path_with_spaces($::progs{$DecompressorProgram{$type}}); - my $decompressorArgs = $::progs{$DecompressorArgs{$type}}; + my @decompressorArgs = @{$DecompressorArgs{$type}}; if (!defined($decompressor)) { return (0, "programs not set up properly"); } @@ -2156,12 +2159,11 @@ sub unpack { my $fn = basename($what); my $pkg = $fn; - # TODO use %CompressorExtensions here!!! - $pkg =~ s/\.tar\.$AcceptedCompressorsRegexp$//; - my $tarfile; + $pkg =~ s/\.tar\.$compressorextension$//; my $remove_containerfile = $remove; my $containerfile = "$tempdir/$fn"; - $tarfile = "$tempdir/$fn"; $tarfile =~ s/$AcceptedCompressorsRegexp$//; + my $tarfile = "$tempdir/$fn"; + $tarfile =~ s/\.$compressorextension$//; my $containerfile_quote; my $tarfile_quote; my $target_quote; @@ -2204,7 +2206,8 @@ sub unpack { $remove_containerfile = 1; } debug("decompressing $containerfile to $tarfile\n"); - system("$decompressor $decompressorArgs < $containerfile_quote > $tarfile_quote"); + debug("calling $decompressor @decompressorArgs < $containerfile_quote > $tarfile_quote\n"); + system("$decompressor @decompressorArgs < $containerfile_quote > $tarfile_quote"); if (! -f $tarfile) { unlink($tarfile, $containerfile); return(0, "Decompressing $containerfile failed"); -- cgit v1.2.3