summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPDB.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm53
1 files changed, 31 insertions, 22 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 90738ee0d54..fa4c0965e51 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -1369,9 +1369,12 @@ sub install_package_files {
# - create a tmp directory
my $tmpdir = TeXLive::TLUtils::tl_tmpdir();
# - unpack everything there
- if (!TeXLive::TLUtils::unpack($f, $tmpdir)) {
- tlwarn("TLPDB::install_package_files: couldn't install $f\n");
- next;
+ {
+ my ($ret, $msg) = TeXLive::TLUtils::unpack($f, $tmpdir);
+ if (!$ret) {
+ tlwarn("TLPDB::install_package_files: $msg\n");
+ next;
+ }
}
# we are still here, so the files have been unpacked properly
# we need now to find the tlpobj in $tmpdir/tlpkg/tlpobj/
@@ -1404,9 +1407,9 @@ sub install_package_files {
#
# remove the RELOC prefix, but do NOT replace it with RelocTree
@installfiles = map { s!^$TeXLive::TLConfig::RelocPrefix/!!; $_; } @installfiles;
- # if the first argument of _install_package is scalar, it is the
+ # if the first argument of _install_data is scalar, it is the
# place from where files should be installed
- if (!_install_package ($tmpdir, \@installfiles, $reloc, \@installfiles, $self)) {
+ if (!_install_data ($tmpdir, \@installfiles, $reloc, \@installfiles, $self)) {
tlwarn("TLPDB::install_package_files: couldn't install $what!\n");
next;
}
@@ -1535,18 +1538,16 @@ sub not_virtual_install_package {
if ($media eq 'local_uncompressed') {
$container = \@installfiles;
} elsif ($media eq 'local_compressed') {
- if (-r "$root/$Archive/$pkg.zip") {
- $container = "$root/$Archive/$pkg.zip";
- } elsif (-r "$root/$Archive/$pkg.tar.xz") {
+ if (-r "$root/$Archive/$pkg.tar.xz") {
$container = "$root/$Archive/$pkg.tar.xz";
} else {
- tlwarn("TLPDB: cannot find package $pkg (.zip or .xz) in $root/$Archive\n");
+ tlwarn("TLPDB: cannot find package $pkg.tar.xz) in $root/$Archive\n");
next;
}
} elsif (&media eq 'NET') {
$container = "$root/$Archive/$pkg.$TeXLive::TLConfig::DefaultContainerExtension";
}
- $self->_install_package ($container, $reloc, \@installfiles, $totlpdb)
+ $self->_install_data ($container, $reloc, \@installfiles, $totlpdb, $tlpobj->containersize, $tlpobj->containermd5)
|| return(0);
# if we are installing from local_compressed or NET we have to fetch the respective
# source and doc packages $pkg.source and $pkg.doc and install them, too
@@ -1565,13 +1566,13 @@ sub not_virtual_install_package {
if ($container_src_split && $opt_src && $tlpobj->srcfiles) {
my $srccontainer = $container;
$srccontainer =~ s/(\.tar\.xz|\.zip)$/.source$1/;
- $self->_install_package ($srccontainer, $reloc, \@installfiles, $totlpdb)
+ $self->_install_data ($srccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->srccontainersize, $tlpobj->srccontainermd5)
|| return(0);
}
if ($container_doc_split && $real_opt_doc && $tlpobj->docfiles) {
my $doccontainer = $container;
$doccontainer =~ s/(\.tar\.xz|\.zip)$/.doc$1/;
- $self->_install_package ($doccontainer, $reloc, \@installfiles, $totlpdb)
+ $self->_install_data ($doccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->doccontainersize, $tlpobj->doccontainermd5)
|| return(0);
}
#
@@ -1614,8 +1615,13 @@ sub not_virtual_install_package {
# archives (.tar.xz) but at DVD install time we don't have them
my $tlpod = $totlpdb->root . "/tlpkg/tlpobj";
mkdirhier( $tlpod );
- open(TMP,">$tlpod/".$tlpobj->name.".tlpobj") or
- die("Cannot open tlpobj file for ".$tlpobj->name);
+ my $count = 0;
+ until (open(TMP,">$tlpod/".$tlpobj->name.".tlpobj")) {
+ # The open might fail for no good reason on Windows.
+ # Try again for a while, but not forever.
+ if ($count++ == 100) { die "$0: open($tlpobj_file) failed: $!"; }
+ select (undef, undef, undef, .1); # sleep briefly
+ }
$tlpobj->writeout(\*TMP);
close(TMP);
$totlpdb->add_tlpobj($tlpobj);
@@ -1642,12 +1648,15 @@ sub not_virtual_install_package {
}
#
-# _install_package
+# _install_data
# actually does the installation work
# returns 1 on success and 0 on error
#
-sub _install_package {
- my ($self, $what, $reloc, $filelistref, $totlpdb) = @_;
+# if the first argument is a string, then files are taken from this directory
+# otherwise it is a tlpdb from where to install
+#
+sub _install_data {
+ my ($self, $what, $reloc, $filelistref, $totlpdb, $whatsize, $whatcheck) = @_;
my $target = $totlpdb->root;
my $tempdir = "$target/temp";
@@ -1658,7 +1667,7 @@ sub _install_package {
my $wget = $::progs{'wget'};
my $xzdec = TeXLive::TLUtils::quotify_path_with_spaces($::progs{'xzdec'});
if (!defined($wget) || !defined($xzdec)) {
- tlwarn("TLPDB::_install_package: programs not set up properly; hmm.\n");
+ tlwarn("TLPDB::_install_data: programs not set up properly; hmm.\n");
return(0);
}
@@ -1689,15 +1698,15 @@ sub _install_package {
}
# we always assume that copy will work
return(1);
- } elsif ($what =~ m,\.tar(\.xz)?$,) {
+ } elsif ($what =~ m,\.tar\.xz$,) {
if ($reloc) {
if (!$totlpdb->setting("usertree")) {
$target .= "/$TeXLive::TLConfig::RelocTree";
}
}
- my $pkg = TeXLive::TLUtils::unpack($what, $target);
- if (!$pkg) {
- tlwarn("TLPDB::_install_package: couldn't unpack $what to $target\n");
+ my ($ret, $pkg) = TeXLive::TLUtils::unpack($what, $target, 'size' => $whatsize, 'checksum' => $whatcheck);
+ if (!$ret) {
+ tlwarn("TLPDB::_install_package: $pkg\n");
return(0);
}
# remove the $pkg.tlpobj, we recreate it anyway again