summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMaster/install-tl7
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl2
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm2
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm27
-rwxr-xr-xMaster/tlpkg/bin/tl-update-install-pkg5
5 files changed, 22 insertions, 21 deletions
diff --git a/Master/install-tl b/Master/install-tl
index ce3bd80de75..9ef3b4ab6a9 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -48,7 +48,7 @@ use Pod::Usage;
use TeXLive::TLUtils qw(platform platform_desc sort_archs
which getenv win32 unix info log debug tlwarn ddebug tldie
- get_system_tmpdir member process_logging_options rmtree wsystem
+ member process_logging_options rmtree wsystem
mkdirhier make_var_skeleton make_local_skeleton install_package copy
install_packages dirname setup_programs native_slashify forward_slashify);
use TeXLive::TLPOBJ;
@@ -334,10 +334,11 @@ my $location;
my $finished = 0;
@::info_hook = ();
-my $system_tmpdir=get_system_tmpdir();
our $media;
our @media_available;
+TeXLive::TLUtils::initialize_global_tmpdir();
+
# special uses of install-tl:
if ($opt_print_arch) {
print platform()."\n";
@@ -708,7 +709,7 @@ sub final_remote_init {
} else {
info("Distribution: $media\n");
}
- info("Directory for temporary files: $system_tmpdir\n");
+ info("Directory for temporary files: $::tl_tmpdir\n");
if ($opt_in_place and ($media ne "local_uncompressed")) {
print "TeX Live not local or not decompressed; 'in_place' option not applicable\n";
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 666db5255bb..ac972a97605 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -2533,7 +2533,7 @@ sub action_update {
# these two variables are used throughout this function
my $root = $localtlpdb->root;
- my $temp = "$root/temp";
+ my $temp = TeXLive::TLUtils::tl_tmpdir();
# remove old _BACKUP packages that have piled up in temp
# they can be recognized by their name starting with __BACKUP_
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm
index e569b15455c..e4c260e31d5 100644
--- a/Master/tlpkg/TeXLive/TLPOBJ.pm
+++ b/Master/tlpkg/TeXLive/TLPOBJ.pm
@@ -625,7 +625,7 @@ sub make_container {
my $tartempfile = "";
if (win32()) {
# Since we provide our own (GNU) tar on Windows, we know it has -T.
- my $tmpdir = TeXLive::TLUtils::get_system_tmpdir();
+ my $tmpdir = TeXLive::TLUtils::tl_tmpdir();
$tartempfile = "$tmpdir/mc$$";
open(TMP, ">$tartempfile") || die "open(>$tartempfile) failed: $!";
print TMP map { "$_\n" } @files_to_backup;
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 588536d05db..4b3ea16117d 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -32,7 +32,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure
TeXLive::TLUtils::getenv($string);
TeXLive::TLUtils::which($string);
- TeXLive::TLUtils::get_system_tmpdir();
+ TeXLive::TLUtils::initialize_global_tmpdir();
TeXLive::TLUtils::tl_tmpdir();
TeXLive::TLUtils::tl_tmpfile();
TeXLive::TLUtils::xchdir($dir);
@@ -125,7 +125,7 @@ BEGIN {
&unix
&getenv
&which
- &get_system_tmpdir
+ &initialize_global_tmpdir
&dirname
&basename
&dirname_and_basename
@@ -456,20 +456,17 @@ sub which {
return 0;
}
-=item C<get_system_tmpdir>
+=item C<initialize_global_tmpdir();>
-Evaluate the environment variables C<TMPDIR>, C<TMP>, and C<TEMP> in
-order to find the system temporary directory.
+Initializes a directory for all temporary files. This uses C<File::Temp>
+and thus honors various env variables like C<TMPDIR>, C<TMP>, and C<TEMP>.
=cut
-sub get_system_tmpdir {
- my $systmp=0;
- $systmp||=getenv 'TMPDIR';
- $systmp||=getenv 'TMP';
- $systmp||=getenv 'TEMP';
- $systmp||='/tmp';
- return "$systmp";
+sub initialize_global_tmpdir {
+ $::tl_tmpdir = File::Temp::tempdir(CLEANUP => 1);
+ debug("tl_tempdir: creating global tempdir $::tl_tmpdir\n");
+ return ($::tl_tmpdir);
}
=item C<tl_tmpdir>
@@ -480,7 +477,8 @@ is terminated.
=cut
sub tl_tmpdir {
- my $tmp = File::Temp::tempdir(CLEANUP => 1);
+ initialize_global_tmpdir() if (!defined($::tl_tmpdir));
+ my $tmp = File::Temp::tempdir(DIR => $::tl_tmpdir, CLEANUP => 1);
debug("tl_tempdir: creating tempdir $tmp\n");
return ($tmp);
}
@@ -494,7 +492,8 @@ Arguments are passed on to C<File::Temp::tempfile>.
=cut
sub tl_tmpfile {
- my ($fh, $fn) = File::Temp::tempfile(@_, UNLINK => 1);
+ initialize_global_tmpdir() if (!defined($::tl_tmpdir));
+ my ($fh, $fn) = File::Temp::tempfile(@_, DIR => $::tl_tmpdir, UNLINK => 1);
debug("tl_tempfile: creating tempfile $fn\n");
return ($fh, $fn);
}
diff --git a/Master/tlpkg/bin/tl-update-install-pkg b/Master/tlpkg/bin/tl-update-install-pkg
index d66c6f48325..0591a383dad 100755
--- a/Master/tlpkg/bin/tl-update-install-pkg
+++ b/Master/tlpkg/bin/tl-update-install-pkg
@@ -31,7 +31,7 @@ $Getopt::Long::autoabbrev=0;
use TeXLive::TLPDB;
use TeXLive::TLPOBJ;
-use TeXLive::TLUtils qw(:DEFAULT mkdirhier copy get_system_tmpdir);
+use TeXLive::TLUtils qw(:DEFAULT mkdirhier copy);
use TeXLive::TLConfig;
$opt_help = 0;
@@ -73,7 +73,8 @@ usage if $opt_help;
die "$0: extra argument(s) @ARGV; try --help if you need it.\n" if @ARGV;
# determine directories.
-my $sys_tmp = get_system_tmpdir() || die ("no system TMPDIR found");
+my $sys_tmp = TeXLive::TLUtils::initialize_global_tmpdir()
+ || die ("cannot get temporary directory");
# top directory we will generate the install pkgs in.
my $tmpdir = "$sys_tmp/install-tl-$$";