summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-05-07 11:26:56 +0000
committerNorbert Preining <preining@logic.at>2009-05-07 11:26:56 +0000
commit4f001567777c6055ae8dd8253b2715c813a107ce (patch)
tree5d319261ac7cb36d445361d995a024b7d9e172d9
parent0890e85716c25cda9b197bd1195dcba20b819a5d (diff)
use only one temp dir in _install_package given by $totlpdb->root ."/temp"
and remove any useless stuff git-svn-id: svn://tug.org/texlive/branches/branch2009-dev@12979 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/tlpkg/TeXLive/TLMedia.pm32
1 files changed, 21 insertions, 11 deletions
diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm
index 50d9ddbe8f6..70c5cd67679 100644
--- a/Master/tlpkg/TeXLive/TLMedia.pm
+++ b/Master/tlpkg/TeXLive/TLMedia.pm
@@ -155,7 +155,8 @@ sub install_package {
} elsif (&media eq 'NET') {
$container = "$location/$Archive/$pkg.$DefaultContainerExtension";
}
- $self->_install_package($container,$reloc,\@installfiles,$totlpdb) || return(0);
+ $self->_install_package ($container, $reloc, \@installfiles, $totlpdb)
+ || 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')) {
@@ -173,12 +174,14 @@ sub 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) || return(0);
+ $self->_install_package ($srccontainer, $reloc, \@installfiles, $totlpdb)
+ || 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) || return(0);
+ $self->_install_package ($doccontainer, $reloc, \@installfiles, $totlpdb)
+ || return(0);
}
#
# if we installed from NET/CD and we got a relocatable container
@@ -186,9 +189,15 @@ sub install_package {
# in USER MODE that should NOT be done because we keep the information
# there, but for now do it unconditionally
if ($tlpobj->relocated) {
- my $tlpod = $totlpdb->root . "/" . $TeXLive::TLConfig::RelocTree .
- "/tlpkg/tlpobj";
- rmtree($tlpod) if (-d $tlpod);
+ my $reloctree = $totlpdb->root . "/" . $TeXLive::TLConfig::RelocTree;
+ my $tlpkgdir = $reloctree . "/" . $TeXLive::TLConfig::InfraLocation;
+ my $tlpod = $tlpkgdir . "/tlpobj";
+ TeXLive::TLUtils::rmtree($tlpod) if (-d $tlpod);
+ # we try to remove the tlpkg directory, that will succeed only
+ # if it is empty. So in normal installations it won't be, but
+ # if we are installing a relocated package it is texmf-dist/tlpkg
+ # which will be (hopefully) empty
+ rmdir($tlpkgdir) if (-d "$tlpkgdir");
}
}
# we don't want to have wrong information in the tlpdb, so remove the
@@ -235,6 +244,7 @@ sub _install_package {
my $media = $self->media;
my $target = $totlpdb->root;
+ my $tempdir = "$target/temp";
my @filelist = @$filelistref;
@@ -271,12 +281,12 @@ sub _install_package {
my $fn = basename($what);
my $pkg = $fn;
$pkg =~ s/\.tar(\.xz)?$//;
- mkdirhier("$target/temp");
+ mkdirhier("$tempdir");
my $tarfile;
my $remove_tarfile = 1;
if ($type eq "xz") {
- my $xzfile = "$target/temp/$fn";
- $tarfile = "$target/temp/$fn"; $tarfile =~ s/\.xz$//;
+ my $xzfile = "$tempdir/$fn";
+ $tarfile = "$tempdir/$fn"; $tarfile =~ s/\.xz$//;
my $xzfile_quote = $xzfile;
my $tarfile_quote = $tarfile;
my $target_quote = $target;
@@ -301,7 +311,7 @@ sub _install_package {
} else {
# we are installing from CD
# copy it to temp
- copy($what, "$target/temp");
+ copy($what, $tempdir);
}
debug("un-xzing $xzfile to $tarfile\n");
system("$xzdec < $xzfile_quote > $tarfile_quote");
@@ -312,7 +322,7 @@ sub _install_package {
}
unlink($xzfile);
} else {
- $tarfile = "$target/temp/$fn";
+ $tarfile = "$tempdir/$fn";
if ($what =~ m,http://|ftp://,) {
if (!download_file($what, $tarfile) || (! -r $tarfile)) {
tlwarn("Downloading \n");