From 3726af04a35d7fbf92f6da3ecef2b54d238f27f6 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 10 Jul 2008 10:27:48 +0000 Subject: TLUtils: process_logging_options now also sets $::LOGFILENAME TLUtils: download_file: fix stupid error when downloading to | and returning 1 tlmgr/tlmgrgui: use process_logging_options, and transfer between the two back and forth. Well at least from tlmgr to tlmgrgui, unfortunately we cannot transfer it backwards without overwriting stuff already written there git-svn-id: svn://tug.org/texlive/trunk@9427 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPDB.pm | 7 ++++--- Master/tlpkg/TeXLive/TLUtils.pm | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'Master/tlpkg') diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 55000384f64..1ee3b382990 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -189,8 +189,8 @@ sub from_file { my $root_from_path = dirname(dirname($path)); if (defined($self->{'root'})) { if ($self->{'root'} ne $root_from_path) { - printf STDERR "root=$self->{'root'}, root_from_path=$root_from_path\n"; - printf STDERR "Initialisation from different location as originally given.\nHope you are sure!\n"; + tlwarn("root=$self->{'root'}, root_from_path=$root_from_path\n"); + tlwarn("Initialisation from different location as originally given.\nHope you are sure!\n"); } } else { $self->root($root_from_path); @@ -227,11 +227,12 @@ sub from_file { open $retfh, "<$tlpdbfile" or die"Cannot open $tlpdbfile!"; debug("Ok, found the uncompressed lzma file!\n"); } - } + } } else { debug("no lzmadec defined, not trying tlpdb.lzma ...\n"); } if (!defined($retfh)) { + debug("TLPDB: downloading $path.lzma didn't succeed, try $path\n"); # lzma did not succeed, so try the normal file $retfh = TeXLive::TLUtils::download_file($path, "|"); if (!$retfh) { diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 8a776159ca2..81c502d288c 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1064,10 +1064,21 @@ sub download_file { } my $url; if ($relpath =~ m;^file://*(.*)$;) { + my $filetoopen = "/$1"; # $dest is a file name, we have to get the respective dirname - my $par = dirname($dest); - copy("/$1", $par); - return 1; + if ($dest eq "|") { + open(RETFH, "<$filetoopen") or + die("Cannot open $filetoopen for reading"); + # opening to a pipe always succeeds, so we return immediately + return \*RETFH; + } else { + my $par = dirname ($dest); + if (-r $filetoopen) { + copy ($filetoopen, $par); + return 1; + } + return 0; + } } if ($relpath =~ /^(http|ftp):\/\//) { $url = $relpath; @@ -1516,6 +1527,7 @@ sub process_logging_options { if ($opt_logfile) { open(TLUTILS_LOGFILE, ">$opt_logfile") || die "open(>$opt_logfile) failed: $!\n"; $::LOGFILE = \*TLUTILS_LOGFILE; + $::LOGFILENAME = $opt_logfile; } } -- cgit v1.2.3