summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPDB.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2018-05-23 02:32:38 +0000
committerNorbert Preining <preining@logic.at>2018-05-23 02:32:38 +0000
commit1bc9a0565e5c03222bdeeb5a9aeaacdc90531d80 (patch)
treee6ae3eab2c3cef5c2dbcc8c6c19b6fc21faf40e9 /Master/tlpkg/TeXLive/TLPDB.pm
parentcc2f0463e08cdfb7e55b1b57b1c9b55c7af010b3 (diff)
get rid of xzdec requirement, use only xz
git-svn-id: svn://tug.org/texlive/trunk@47803 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm101
1 files changed, 13 insertions, 88 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 99050e34dd7..d2cd1edefda 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -32,7 +32,6 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages
$tlpdb->save;
$tlpdb->media;
$tlpdb->available_architectures();
- $tlpdb->add_tlpcontainer($pkg, $ziploc [, $archrefs [, $dest ]] );
$tlpdb->add_tlpobj($tlpobj);
$tlpdb->needed_by($pkg);
$tlpdb->remove_tlpobj($pkg);
@@ -320,9 +319,9 @@ sub from_file {
$tlpdbfile =~ s!/!\\!g;
}
$tlpdbfile_quote = "\"$tlpdbfile\"";
- # if we have xzdec available we try the xz file
+ # if we have xz available we try the xz file
my $xz_succeeded = 0 ;
- if (defined($::progs{'xzdec'})) {
+ if (defined($::progs{$DefaultCompressorFormat})) {
# we first try the xz compressed file
my ($xzfh, $xzfile) = TeXLive::TLUtils::tl_tmpfile();
close($xzfh);
@@ -331,31 +330,33 @@ sub from_file {
$xzfile =~ s!/!\\!g;
}
$xzfile_quote = "\"$xzfile\"";
- my $xzdec = TeXLive::TLUtils::quotify_path_with_spaces($::progs{'xzdec'});
- debug("trying to download $path.xz to $xzfile\n");
- my $ret = TeXLive::TLUtils::download_file("$path.xz", "$xzfile");
+ my $decompressor = TeXLive::TLUtils::quotify_path_with_spaces($::progs{$DecompressorProgram{$DefaultCompressorFormat}});
+ my $compressorextension = $CompressorExtension{$DefaultCompressorFormat};
+ my @decompressorArgs = @{$DecompressorArgs{$DefaultCompressorFormat}};
+ debug("trying to download $path.$compressorextension to $xzfile\n");
+ my $ret = TeXLive::TLUtils::download_file("$path.$compressorextension", "$xzfile");
# better to check both, the return value AND the existence of the file
if ($ret && (-r "$xzfile")) {
# ok, let the fun begin
- debug("xzdec-ing $xzfile to $tlpdbfile\n");
+ debug("decompressing $xzfile to $tlpdbfile\n");
# xzdec *hopefully* returns 0 on success and anything else on failure
# we don't have to negate since not zero means error in the shell
# and thus in perl true
- if (system("$xzdec <$xzfile_quote >$tlpdbfile_quote")) {
- debug("$xzdec $xzfile failed, trying plain file\n");
+ if (system("$decompressor @decompressorArgs <$xzfile_quote >$tlpdbfile_quote")) {
+ debug("$decompressor $xzfile failed, trying plain file\n");
# to be sure we unlink the xz file and the tlpdbfile
unlink($xzfile);
} else {
unlink($xzfile);
$xz_succeeded = 1;
- debug("found the uncompressed xz file\n");
+ debug("found the uncompressed $DefaultCompressorFormat file\n");
}
}
} else {
- debug("no xzdec defined, not trying tlpdb.xz ...\n");
+ debug("no $DefaultCompressorFormat defined, not trying tlpdb.$compressorextension ...\n");
}
if (!$xz_succeeded) {
- debug("TLPDB: downloading $path.xz didn't succeed, try $path\n");
+ debug("TLPDB: downloading $path.$compressorextension didn't succeed, try $path\n");
my $ret = TeXLive::TLUtils::download_file($path, $tlpdbfile);
# better to check both, the return value AND the existence of the file
if ($ret && (-r $tlpdbfile)) {
@@ -691,82 +692,6 @@ sub _available_architectures {
=pod
-=item C<< $tlpdb->add_tlpcontainer($pkg, $ziploc [, $archrefs [, $dest ]] ) >>
-
-Installs the package C<$pkg> from the container files in C<$ziploc>. If
-C<$archrefs> is given then it must be a reference to a list of
-architectures to be installed. If the normal (arch=all) package is
-architecture dependent then all arch packages in this list are installed.
-If C<$dest> is given then the files are
-installed into it, otherwise into the location of the TLPDB.
-
-Note that this procedure does NOT check for dependencies. So if your package
-adds new dependencies they are not necessarily fulfilled.
-
-=cut
-
-sub add_tlpcontainer {
- my ($self, $package, $ziplocation, $archrefs, $dest) = @_;
- if ($self->is_virtual) {
- tlwarn("TLPDB: cannot add_tlpcontainer to a virtual tlpdb\n");
- return 0;
- }
- my @archs;
- if (defined($archrefs)) {
- @archs = @$archrefs;
- }
- my $cwd = getcwd();
- if ($ziplocation !~ m,^/,) {
- $ziplocation = "$cwd/$ziplocation";
- }
- my $tlpobj = $self->_add_tlpcontainer($package, $ziplocation, "all", $dest);
- if ($tlpobj->is_arch_dependent) {
- foreach (@$archrefs) {
- $self->_add_tlpcontainer($package, $ziplocation, $_, $dest);
- }
- }
-}
-
-sub _add_tlpcontainer {
- my ($self, $package, $ziplocation, $arch, $dest) = @_;
- my $unpackprog;
- my $args;
- # WARNING: If you change the location of the texlive.tlpdb this
- # has to be changed, too!!
- if (not(defined($dest))) {
- $dest = $self->{'root'};
- }
- my $container = "$ziplocation/$package";
- if ($arch ne "all") {
- $container .= ".$arch";
- }
- if (-r "$container.zip") {
- $container .= ".zip";
- $unpackprog="unzip";
- $args="-o -qq $container -d $dest";
- } elsif (-r "$container.xz") {
- $container .= ".xz";
- $unpackprog="NO_IDEA_HOW_TO_UNPACK_LZMA";
- $args="NO IDEA WHAT ARGS IT NEEDS";
- die "$0: xz checked for but not implemented, maybe update TLPDB.pm";
- } else {
- die "$0: No package $container (.zip or .xz) in $ziplocation";
- }
- tlwarn("TLPDB: Hmmm, this needs testing and error checking!\n");
- tlwarn("Should we use -a -- adapt line endings etc?\n");
- `$unpackprog $args`;
- # we only create/add tlpobj for arch eq "all"
- if ($arch eq "all") {
- my $tlpobj = new TeXLive::TLPOBJ;
- $tlpobj->from_file("$dest/$InfraLocation/tlpobj/$package.tlpobj");
- $self->add_tlpobj($tlpobj);
- return $tlpobj;
- }
-}
-
-
-=pod
-
=item C<< $tlpdb->get_package("pkgname") >>
The C<get_package> function returns a reference to the C<TLPOBJ> object