summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2018-05-18 23:46:06 +0000
committerNorbert Preining <preining@logic.at>2018-05-18 23:46:06 +0000
commitaf61d4d340b46609b9d88deb0d64cbdefcf4882f (patch)
treeff6a61db8794740a601cfd510e6f837937f2ab9c /Master/tlpkg/TeXLive/TLUtils.pm
parentc0c3a120c5f2557f063fd2be039693cdbeaa3515 (diff)
work on supporting lz4 and possibly other codices
git-svn-id: svn://tug.org/texlive/trunk@47754 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm68
1 files changed, 39 insertions, 29 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index b8af0fe476f..476ebf5b5ef 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -2133,51 +2133,60 @@ sub unpack {
return (0, "nothing to unpack");
}
+ my $type;
+ for my $ext (@AcceptedCompressors) {
+ if ($what =~ m/\.tar\.$ext$/) {
+ $type = $ext;
+ }
+ }
+ if (!$type) {
+ return(0, "don't know how to unpack");
+ }
+
# we assume that $::progs has been set up!
- my $wget = $::progs{'wget'};
- my $xzdec = TeXLive::TLUtils::quotify_path_with_spaces($::progs{'xzdec'});
- if (!defined($wget) || !defined($xzdec)) {
+ # wget is again checked by download file
+ # my $wget = $::progs{'wget'};
+ # only check the necessary compressor program
+ my $decompressor = TeXLive::TLUtils::quotify_path_with_spaces($::progs{$CompressorProgram{$type}});
+ my $decompressorArgs = $::progs{$DecompressorArgs{$type}};
+ if (!defined($decompressor)) {
return (0, "programs not set up properly");
}
- my $type;
- if ($what !~ m/\.tar\.xz$/) {
- return(0, "don't know how to unpack");
- }
my $fn = basename($what);
my $pkg = $fn;
- $pkg =~ s/\.tar\.xz$//;
+ $pkg =~ s/\.tar\.$AcceptedCompressorsRegexp$//;
my $tarfile;
- my $remove_xzfile = $remove;
- my $xzfile = "$tempdir/$fn";
- $tarfile = "$tempdir/$fn"; $tarfile =~ s/\.xz$//;
- my $xzfile_quote;
+ my $remove_containerfile = $remove;
+ my $containerfile = "$tempdir/$fn";
+ $tarfile = "$tempdir/$fn"; $tarfile =~ s/$AcceptedCompressorsRegexp$//;
+ my $containerfile_quote;
my $tarfile_quote;
my $target_quote;
if (win32()) {
- $xzfile =~ s!/!\\!g;
+ $containerfile =~ s!/!\\!g;
$tarfile =~ s!/!\\!g;
$target =~ s!/!\\!g;
}
- $xzfile_quote = "\"$xzfile\"";
+ $containerfile_quote = "\"$containerfile\"";
$tarfile_quote = "\"$tarfile\"";
$target_quote = "\"$target\"";
if ($what =~ m,^(https?|ftp)://,) {
# we are installing from the NET
# check for the presence of $what in $tempdir
- if (-r $xzfile) {
- check_file($xzfile, $checksum, $size);
+ if (-r $containerfile) {
+ check_file($containerfile, $checksum, $size);
}
# if the file is now not present, we can use it
- if (! -r $xzfile) {
+ if (! -r $containerfile) {
# try download the file and put it into temp
- if (!download_file($what, $xzfile)) {
+ if (!download_file($what, $containerfile)) {
return(0, "downloading did not succeed");
}
# remove false downloads
- check_file($xzfile, $checksum, $size);
- if ( ! -r $xzfile ) {
+ check_file($containerfile, $checksum, $size);
+ if ( ! -r $containerfile ) {
return(0, "downloading did not succeed");
}
}
@@ -2186,20 +2195,20 @@ sub unpack {
# copy it to temp
TeXLive::TLUtils::copy($what, $tempdir);
- check_file($xzfile, $checksum, $size);
- if (! -r $xzfile) {
+ check_file($containerfile, $checksum, $size);
+ if (! -r $containerfile) {
return (0, "consistency checks failed");
}
# we can remove it afterwards
- $remove_xzfile = 1;
+ $remove_containerfile = 1;
}
- debug("un-xzing $xzfile to $tarfile\n");
- system("$xzdec < $xzfile_quote > $tarfile_quote");
+ debug("decompressing $containerfile to $tarfile\n");
+ system("$decompressor $decompressorArgs < $containerfile_quote > $tarfile_quote");
if (! -f $tarfile) {
- unlink($tarfile, $xzfile);
- return(0, "Unpacking $xzfile failed");
+ unlink($tarfile, $containerfile);
+ return(0, "Decompressing $containerfile failed");
}
- unlink($xzfile) if $remove_xzfile;
+ unlink($containerfile) if $remove_containerfile;
if (untar($tarfile, $target, 1)) {
return (1, "$pkg");
} else {
@@ -2348,7 +2357,8 @@ sub setup_programs {
my $s = 0;
$s += setup_unix_one('wget', "$bindir/wget/wget.$platform", "--version");
$s += setup_unix_one('xzdec',"$bindir/xz/xzdec.$platform","--help");
- $s += setup_unix_one('xz', "$bindir/xz/xz.$platform", "notest");
+ $s += setup_unix_one('xz', "$bindir/xz/xz.$platform", "notest");
+ $s += setup_unix_one('lz4', "$bindir/lz4/lz4.$platform", "--version");
$ok = ($s == 3); # failure return unless all are present.
}