summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-02-05 14:54:38 +0000
committerNorbert Preining <preining@logic.at>2009-02-05 14:54:38 +0000
commit751e159080c2e64f88cf166869cb51090227e3e5 (patch)
treef750301ffc61dc24c893a2e38a9555c2d0bdff59 /Master/tlpkg
parentb9477c893814746095eaf0aad80b354620ac2421 (diff)
install-tl and intstall_package(s): rework the error behaviour logic: We
now return 1/0 (success/failure) in install_package(s) and give tlwarn there if something fails. This way the warnings appear in the log window of the GUI installers. Then we return 0 and install-tl itself creates the profile and dies. git-svn-id: svn://tug.org/texlive/trunk@12097 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm59
1 files changed, 35 insertions, 24 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 915888823b9..38a630b0ecf 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -905,6 +905,8 @@ the TLPDB C<$from_tlpdb>.
C<$opt_src> and C<$opt_doc> specify whether srcfiles and docfiles should be
installed (currently implemented only for installation from DVD).
+Returns 1 on success and 0 on error.
+
=cut
sub install_packages {
@@ -1013,8 +1015,13 @@ sub install_packages {
} elsif ($media eq 'NET') {
$container = "$root/$Archive/$package.$DefaultContainerExtension";
}
- install_package($container, $tlpobj->containersize, $tlpobj->containermd5,
- \@installfiles, $totlpdb->root, $vars{'this_platform'});
+ if (!install_package($container, $tlpobj->containersize,
+ $tlpobj->containermd5, \@installfiles,
+ $totlpdb->root, $vars{'this_platform'})) {
+ # we already warn in install_package that something bad happened,
+ # so only return here
+ return 0;
+ }
# if we are installing from CD or NET we have to fetch the respective
# source and doc packages $pkg.source and $pkg.doc and install them, too
if (($media eq 'NET') || ($media eq 'CD')) {
@@ -1030,17 +1037,21 @@ sub install_packages {
if ($container_src_split && $opt_src && $tlpobj->srcfiles) {
my $srccontainer = $container;
$srccontainer =~ s/(\.tar\.lzma|\.zip)$/.source$1/;
- install_package($srccontainer, $tlpobj->srccontainersize,
- $tlpobj->srccontainermd5, \@installfiles,
- $totlpdb->root, $vars{'this_platform'});
+ if (!install_package($srccontainer, $tlpobj->srccontainersize,
+ $tlpobj->srccontainermd5, \@installfiles,
+ $totlpdb->root, $vars{'this_platform'})) {
+ return 0;
+ }
}
if ($container_doc_split && $real_opt_doc && $tlpobj->docfiles) {
my $doccontainer = $container;
$doccontainer =~ s/(\.tar\.lzma|\.zip)$/.doc$1/;
- install_package($doccontainer,
- $tlpobj->doccontainersize,
- $tlpobj->doccontainermd5, \@installfiles,
- $totlpdb->root, $vars{'this_platform'});
+ if (!install_package($doccontainer,
+ $tlpobj->doccontainersize,
+ $tlpobj->doccontainermd5, \@installfiles,
+ $totlpdb->root, $vars{'this_platform'})) {
+ return 0;
+ }
}
}
# we don't want to have wrong information in the tlpdb, so remove the
@@ -1068,6 +1079,7 @@ sub install_packages {
info(sprintf("Time used for installing the packages: %02d:%02d\n",
$totmin, $totsec));
$totlpdb->save;
+ return 1;
}
@@ -1094,6 +1106,8 @@ file on the system and is likewise piped through C<lzmadec> and C<tar>.
In both of these cases currently the list C<$@filelistref> currently
is not taken into account (should be fixed!).
+Returns 1 on success and 0 on error.
+
=cut
sub install_package {
@@ -1105,7 +1119,8 @@ sub install_package {
my $wget = $::progs{'wget'};
my $lzmadec = $::progs{'lzmadec'};
if (!defined($wget) || !defined($lzmadec)) {
- die "install_package: wget/lzmadec programs not set up properly, strange";
+ tlwarn("install_package: wget/lzmadec programs not set up properly.\n");
+ return 0;
}
if (ref $what) {
# we are getting a ref to a list of files, so install from DVD
@@ -1183,18 +1198,8 @@ sub install_package {
# we are installing from the NET
# download the file and put it into temp
if (!download_file($what, $lzmafile) || (! -r $lzmafile)) {
- my $profile_name = "installation.profile";
- &main::create_profile($profile_name);
tlwarn("Downloading $what did not succeed.\n");
- tlwarn("Rerunning the installer will try to ",
- "restart the installation.\n");
- tlwarn("Or you can restart by running the installer with:\n");
- if (win32()) {
- tlwarn(" install-tl.bat --profile $profile_name [EXTRA-ARGS]\n");
- } else {
- tlwarn(" install-tl --profile $profile_name [EXTRA-ARGS]\n");
- }
- die "\n";
+ return 0;
}
} else {
# we are installing from CD
@@ -1205,12 +1210,18 @@ sub install_package {
debug("un-lzmaing $lzmafile to $tarfile\n");
system("$lzmadec < $lzmafile_quote > $tarfile_quote");
if (! -f $tarfile) {
- die "Unpacking $lzmafile did not succeed, please retry";
+ tlwarn("Unpacking $lzmafile did not succeed.\n");
+ return 0;
+ }
+ if (!TeXLive::TLUtils::untar($tarfile, $target, 1)) {
+ tlwarn("Un-tarring $tarfile did not succeed.\n");
+ return 0;
}
- TeXLive::TLUtils::untar($tarfile, $target, 1);
} else {
- die "sorry, don't know how to install $what";
+ tlwarn("Sorry, no idea how to install $what\n");
+ return 0;
}
+ return 1;
}