From a5eb764bf2b6f48b060a238df33fe168b049df57 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 18 May 2018 23:46:50 +0000 Subject: more work on lz4 compression, working build containers git-svn-id: svn://tug.org/texlive/trunk@47759 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm') diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index c662596f43a..ca1d1100931 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -12,6 +12,7 @@ sub module_revision { return $_modulerevision; } use TeXLive::TLConfig qw($DefaultCategory $CategoriesRegexp $MetaCategoriesRegexp $InfraLocation + @AcceptedCompressors %CompressorArgs %CompressorProgram %CompressorExtension $RelocPrefix $RelocTree); use TeXLive::TLCrypto; use TeXLive::TLTREE; @@ -558,8 +559,8 @@ sub common_texmf_tree { sub make_container { my ($self,$type,$instroot,$destdir,$containername,$relative) = @_; - if (($type ne "xz") && ($type ne "tar")) { - die "$0: TLPOBJ supports tar and xz containers, not $type"; + if (!TeXLive::TLUtils::member($type, @AcceptedCompressors)) { + die "$0: TLPOBJ supports @AcceptedCompressors containers, not $type"; } if (!defined($containername)) { $containername = $self->name; @@ -622,25 +623,22 @@ sub make_container { close(TMP); push(@files, "$tlpobjdir/$self->{'name'}.tlpobj"); $tarname = "$containername.tar"; - if ($type eq "tar") { - $containername = $tarname; - } else { - $containername = "$tarname.xz"; - } # start the fun my $tar = $::progs{'tar'}; - my $xz; if (!defined($tar)) { tlwarn("$0: programs not set up, trying \"tar\".\n"); $tar = "tar"; } - if ($type eq "xz") { - $xz = $::progs{'xz'}; - if (!defined($xz)) { - tlwarn("$0: programs not set up, trying \"xz\".\n"); - $xz = "xz"; - } + my $compressor = $::progs{$CompressorProgram{$type}}; + my @compressorargs = @{$CompressorArgs{$type}}; + my $compressorextension = $CompressorExtension{$type}; + $containername = "$tarname.$compressorextension"; + debug("selected compressor: $compressor with @compressorargs\n"); + if (!defined($compressor)) { + # fall back to $type as compressor, but that shouldn't happen + tlwarn("$0: programs not set up, trying \"$type\".\n"); + $compressor = $type; } # Here we need to distinguish between making the master containers for @@ -721,13 +719,11 @@ sub make_container { xsystem(@cmdline); # compress it. - if ($type eq "xz") { - if (-r "$destdir/$tarname") { - system($xz, "--force", "-z", "$destdir/$tarname"); - } else { - tlwarn("$0: Couldn't find $destdir/$tarname to run $xz\n"); - return (0, 0, ""); - } + if (-r "$destdir/$tarname") { + system($compressor, @compressorargs, "$destdir/$tarname"); + } else { + tlwarn("$0: Couldn't find $destdir/$tarname to run $xz\n"); + return (0, 0, ""); } # compute the size. -- cgit v1.2.3