diff options
author | Norbert Preining <preining@logic.at> | 2020-01-07 10:55:10 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2020-01-07 10:55:10 +0000 |
commit | 9ff245e555f9e304eb1e767be8693ecaa01b439f (patch) | |
tree | 03c39e0bdb4ee3422dc47c04d17b415d60e57b12 /Master/tlpkg/TeXLive | |
parent | 3c846341e3091cb6d72d78f66a290ca3ea7be101 (diff) |
Automatically retry to download packages again later if failed (by Yusuke Terada)
I often encounter the following error during network installation of TeX Live.
```
TLPDB::_install_package: downloading did not succeed
Installation failed.
```
This occurs irregularly, that is, at which package the installation aborts
varies every time. So, it is probably due to some random network troubles.
Once the error occurs, the entire installation aborts there, and users should
retry from the beginning. So I have tried implementing a workaround in the
installation routine based on Hironobu Yamashita's suggestion. His idea is:
If download of some packages fails, skip them and store them in @packs_again.
After the installation of other packages completed, retry to install the
packages stored in @packs_again.
If it fails again, the installation process is to be aborted this time around.
However, if the errors are due to random network troubles, the probability of
an error occurring twice on the same package should be quite small.
As an experiment, I tried raising network troubles intentionally during network
installation. This workaround seems to work well.
git-svn-id: svn://tug.org/texlive/trunk@53343 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index b038abecf28..d4ad4a4b47f 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1,6 +1,6 @@ # $Id$ # TeXLive::TLUtils.pm - the inevitable utilities for TeX Live. -# Copyright 2007-2019 Norbert Preining, Reinhard Kotucha +# Copyright 2007-2020 Norbert Preining, Reinhard Kotucha # This file is licensed under the GNU General Public License version 2 # or any later version. @@ -1520,6 +1520,7 @@ sub install_packages { $totalsize += $tlpsizes{$p}; } my $starttime = time(); + my @packs_again; # packages that we failed to download and should retry later foreach my $package (@packs) { my $tlpobj = $tlpobjs{$package}; my $reloc = $tlpobj->relocated; @@ -1532,7 +1533,21 @@ sub install_packages { foreach my $h (@::install_packages_hook) { &$h($n,$totalnr); } - # return false if something went wrong + # push $package to @packs_again if download failed + if (!$fromtlpdb->install_package($package, $totlpdb)) { + tlwarn("TLUtils::install_packages: Failed to install $package\n" + ."Will be retried later.\n"); + push @packs_again, $package; + } else { + $donesize += $tlpsizes{$package}; + } + } + # try to download packages in @packs_again again + foreach my $package (@packs_again) { + my $infostr = sprintf("Retrying to install: $package [%dk]", + int($tlpsizes{$package}/1024) + 1); + info("$infostr\n"); + # return false if download failed again if (!$fromtlpdb->install_package($package, $totlpdb)) { return 0; } |