summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-11 00:15:21 +0000
committerKarl Berry <karl@freefriends.org>2008-11-11 00:15:21 +0000
commit2538da2559798a42a68a81ee2311521e256c6e33 (patch)
tree338440b6163d231a1f815333c1ffa8e61dbec5bb
parentd9509412dd1f1eeeb049e6f5594a1108af8159e8 (diff)
revert from premature commit
git-svn-id: svn://tug.org/texlive/trunk@11252 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/tlpkg/TeXLive/TLMedia.pm24
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm40
2 files changed, 30 insertions, 34 deletions
diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm
index 0fbf9f49743..218987dbcb3 100644
--- a/Master/tlpkg/TeXLive/TLMedia.pm
+++ b/Master/tlpkg/TeXLive/TLMedia.pm
@@ -84,6 +84,7 @@ sub new
return $self;
}
+#
# returns a scalar (0) on error
# returns a reference to a hash with actions on success
sub install_package {
@@ -118,7 +119,7 @@ sub install_package {
$real_opt_doc = 1;
}
foreach my $h (@::install_packages_hook) {
- &$h("install: $pkg");
+ &$h("install: $package");
}
my $container;
my @installfiles;
@@ -233,7 +234,8 @@ sub _install_package {
# we assume that $::progs has been set up!
my $wget = $::progs{'wget'};
my $lzmadec = $::progs{'lzmadec'};
- if (!defined($wget) || !defined($lzmadec)) {
+ my $tar = $::progs{'tar'};
+ if (!defined($wget) || !defined($lzmadec) || !defined($tar)) {
tlwarn("_install_package: programs not set up properly, strange.\n");
return(0);
}
@@ -291,10 +293,10 @@ sub _install_package {
# copy it to temp
copy($what, "$target/temp");
}
- debug("un-lzmaing $lzmafile to $tarfile\n");
+ debug("Un-lzmaing $lzmafile to $tarfile\n");
system("$lzmadec < $lzmafile_quote > $tarfile_quote");
if (! -f $tarfile) {
- tlwarn("_install_package: Unpacking $lzmafile failed, please retry.\n");
+ tlwarn("Unpacking $lzmafile did not succeed, please retry!\n");
unlink($tarfile, $lzmafile);
return(0);
}
@@ -305,7 +307,7 @@ sub _install_package {
if (!download_file($what, $tarfile) || (! -r $tarfile)) {
tlwarn("Downloading \n");
tlwarn(" $what\n");
- tlwarn("failed, please retry.\n");
+ tlwarn("did not succeed, please retry!\n");
unlink($tarfile);
return(0);
}
@@ -314,9 +316,17 @@ sub _install_package {
$remove_tarfile = 0;
}
}
- return TeXLive::TLUtils::untar($tarfile, $target, $remove_tarfile);
+ debug("Unpacking $tarfile\n");
+ if (system($tar,"-x","-C",$target,"-f",$tarfile) != 0) {
+ tlwarn("Untarring $tarfile did not succeed, please retry!\n");
+ unlink($tarfile) if $remove_tarfile;
+ return(0);
+ }
+ # we are still here, so success!
+ unlink($tarfile) if $remove_tarfile;
+ return(1);
} else {
- tlwarn("_install_package: Don't know how to install $what\n");
+ tlwarn("Don't know how to install $what!\n");
return(0);
}
}
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index db10017f4b0..9f1f6b5ed30 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -873,10 +873,10 @@ sub install_packages {
}
$totlpdb->save;
}
-
+
=pod
-=item C<install_package($what, $size, $md5, $filelistref, $target, $platform)>
+=item C<install_package($what, $size, $filelistref, $target, $platform)>
This function installs the files given in @$filelistref from C<$what>
into C<$target>.
@@ -894,9 +894,10 @@ downloaded from the net and piped through C<lzmadec> and C<tar>.
If $what ends with C<.tar.lzma> (but does not start with C<http://> or
C<ftp://>, but possibly with C<file:/>) it is assumed to be a readable
-file on the system and is likewise piped through C<lzmadec> and C<tar>.
+file on the system and is
+piped through C<lzmadec> and C<tar> in the very same way.
-In both of these cases currently the list C<$@filelistref> currently
+In both of the last cases currently the list C<$@filelistref> currently
is not taken into account (should be fixed!).
=cut
@@ -909,7 +910,8 @@ sub install_package {
# we assume that $::progs has been set up!
my $wget = $::progs{'wget'};
my $lzmadec = $::progs{'lzmadec'};
- if (!defined($wget) || !defined($lzmadec)) {
+ my $tar = $::progs{'tar'};
+ if (!defined($wget) || !defined($lzmadec) || !defined($tar)) {
die "install_package: programs not set up properly, strange";
}
if (ref $what) {
@@ -934,6 +936,7 @@ sub install_package {
my $tarfile = "$target/temp/$fn"; $tarfile =~ s/\.lzma$//;
my $lzmafile_quote = $lzmafile;
my $tarfile_quote = $tarfile;
+ my $target_quote = $target;
if (win32()) {
$lzmafile =~ s!/!\\!g;
$tarfile =~ s!/!\\!g;
@@ -941,6 +944,7 @@ sub install_package {
}
$lzmafile_quote = "\"$lzmafile\"";
$tarfile_quote = "\"$tarfile\"";
+ $target_quote = "\"$target\"";
my $gotfiledone = 0;
if (-r $lzmafile) {
# check that the downloaded file is not partial
@@ -1008,34 +1012,16 @@ sub install_package {
if (! -f $tarfile) {
die "Unpacking $lzmafile did not succeed, please retry";
}
- TeXLive::TLUtils::untar($tarfile, $target, 1);
+ debug("unpacking $tarfile\n");
+ system($tar,"-x","-C",$target,"-f",$tarfile);
+ unlink($tarfile);
debug("keeping $lzmafile for restarting ...\n");
# unlink($lzmafile);
} else {
- die "install_package: Don't know how to install $what\n";
- }
-}
-
-# 1 if success, 0 if failure.
-sub untar {
- my ($tarfile, $targetdir, $remove_tarfile) = @_;
- my $ret;
-
- my $tar = $::progs{'tar'}; # assume it's been set up
-
- debug("unpacking $tarfile in $targetdir\n");
- # cd $targetdir xx
- if (system($tar, "xf", $tarfile) != 0) {
- tlwarn("untarring $tarfile failed, please retry\n");
- $ret = 0;
- } else {
- $ret = 1;
+ die "Don't know how to install $what!\n";
}
- unlink($tarfile) if $remove_tarfile;
- return $ret;
}
-
=pod
=item C<setup_programs( $bindir, $platform )>