diff options
author | Norbert Preining <preining@logic.at> | 2008-01-11 07:46:38 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-01-11 07:46:38 +0000 |
commit | 43663f4060aae93588ba974aa42f8a4337d5f331 (patch) | |
tree | cab6465a45f34b07cdcbd4cac56e8844e0ae038c /Master/tlpkg | |
parent | a085c27f4e2244e388b7cac1fc3eacd6bc2b90f6 (diff) |
more decent logging, and less rogue terminal output
git-svn-id: svn://tug.org/texlive/trunk@6185 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 3 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 73 |
2 files changed, 56 insertions, 20 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 74b18051218..073d0a9574a 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -126,7 +126,8 @@ sub from_file { $self->root($root_from_path); } if ($path =~ /^(http|ftp):\/\//) { - open(TMP, "wget -nv --output-document=- $path|") + tllog($::LOG_DDDEBUG, "TLPDB.pm: trying to initialize from $path\n"); + open(TMP, "wget -q --output-document=- $path|") || die("Cannot open tlpdb file: $path"); } else { open(TMP,"<$path") || die("Cannot open tlpdb file: $path"); diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 75c7c394498..2d748479690 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -62,6 +62,7 @@ C<TeXLive::TLUtils> -- Utilities used in the TeX Live Infrastructure Modules TeXLive::TLUtils::member($item, @list); TeXLive::TLUtils::tllog($level, $string); TeXLive::TLUtils::kpsewhich; + TeXLive::TLUtils::conv_to_win_path($path); =head1 DESCRIPTION @@ -510,7 +511,7 @@ sub install_packages { my $container_src_split = $fromtlpdb->config_src_container; my $container_doc_split = $fromtlpdb->config_doc_container; foreach my $package (@$what) { - print "INSTALL $package\n"; + tllog($::LOG_NORMAL, "Installing $package\n"); my $tlpobj=$fromtlpdb->get_package($package); if (!defined($tlpobj)) { die "STRANGE: $package not to be found in ", $fromtlpdb->root; @@ -623,16 +624,15 @@ sub install_package { my @filelist = @$filelistref; - my $bindir = "$::installerdir/tlpkg/bin"; - my $lzmadec="$bindir/lzmadec.$::_platform_"; + my $bindir = "$::installerdir/tlpkg/bin"; + # unix defaults + my $wget = "wget"; + my $lzmadec = "$bindir/lzmadec.$::_platform_"; + my $tar = "tar"; if (win32()) { - # we need absolute paths for win32 - my $cwd = `cd`; - chomp($cwd); - if ($bindir !~ m!^.:!) { - $bindir =~ s!/!\\!g; - $bindir = "$cwd\\$bindir"; - } + $wget = conv_to_win_path("$bindir/wget.exe"); + $lzmadec = conv_to_win_path("$bindir/lzma.exe"); + $tar = conv_to_win_path("$bindir/bsdtar.exe"); $target =~ s!/!\\!g; } if (ref $what) { @@ -654,13 +654,17 @@ sub install_package { my $tarfile = $fn; $tarfile =~ s/\.lzma$//; mkdirhier("$target/temp"); - mysystem("wget -nv -O \"$target\\temp\\$fn\" \"$what\""); - mysystem("lzma d \"$target\\temp\\$fn\" \"$target\\temp\\$tarfile\""); - mysystem("pushd \"$target\" & \"$bindir\\bsdtar.exe\" -xf \"temp\\$tarfile\""); + tllog($::LOG_NORMAL, "Downloading $what to $target\\temp\\$fn\n"); + mysystem("$wget -q -O \"$target\\temp\\$fn\" \"$what\""); + tllog($::LOG_NORMAL, "Un-lzmaing $target\\temp\\$fn to $target\\temp\\$tarfile\n"); + mysystem("$lzmadec d \"$target\\temp\\$fn\" \"$target\\temp\\$tarfile\""); + tllog($::LOG_NORMAL, "Unpacking temp\\$tarfile\n"); + mysystem("pushd \"$target\" & $tar -xf \"temp\\$tarfile\""); unlink("$target\\temp\\$tarfile"); unlink("$target\\temp\\$fn"); } else { - system "wget -nv -O- \"$what\"|\"$lzmadec\"|tar -xf - -C \"$target\""; + tllog($::LOG_NORMAL, "downloading/unlzma-ing/unpacking $what\n"); + system "$wget -q -O- \"$what\"|\"$lzmadec\"|$tar -xf - -C \"$target\""; } } elsif ($what =~ m,\.tar.lzma$,) { if (win32()) { @@ -668,11 +672,14 @@ sub install_package { my $tarfile = $fn; $tarfile =~ s/\.lzma$//; mkdirhier("$target/temp"); - mysystem("\"$bindir\\lzma.exe\" d \"$what\" \"$target\\temp\\$tarfile\""); - mysystem("pushd \"$target\" & \"$bindir\\bsdtar.exe\" -xf \"temp\\$tarfile\""); + tllog($::LOG_NORMAL, "Un-lzmaing $what to $target\\temp\\$tarfile\n"); + mysystem("$lzma d \"$what\" \"$target\\temp\\$tarfile\""); + tllog($::LOG_NORMAL, "Unpacking temp\\$tarfile\n"); + mysystem("pushd \"$target\" & $tar -xf \"temp\\$tarfile\""); unlink("$target\\temp\\$tarfile"); } else { - system "cat \"$what\"|\"$lzmadec\"|tar -xf - -C \"$target\""; + tllog($::LOG_NORMAL, "downloading/unlzma-ing/unpacking $what\n"); + system "cat \"$what\"|\"$lzmadec\"|$tar -xf - -C \"$target\""; } } else { die "Don't know how to install $what!\n"; @@ -841,8 +848,13 @@ sub additional_architectures_available_from_net { my @platforms; my $database="$::texlive_url/$::netarchive/texlive.pkgver"; - print "\nLoading '$database' ...\n"; - open WGET, "wget -nv --output-document=- $database|"; + tllog($::LOG_NORMAL, "Loading '$database' ...\n"); + my $wget = "wget"; + if (win32()) { + $wget = conv_to_win_path("$::installerdir/tlpkg/bin/wget.exe"); + } + open(WGET, "$wget -q --output-document=- $database|") or + tllog($::LOG_NORMAL, "Cannot load list of available archs from the net!\n"); while (<WGET>) { chop; my $line=$_; @@ -1152,6 +1164,29 @@ sub kpsewhich { return($ret); } +=pod + +=item C<conv_to_win_path($path)> + +This function returns a "windowsified" path, i.e., replacing all forward +slashes to backslashes, and adding additional " around (in case of spaces +in $path). Furthermore it makes the path absolute. So if $path does not +start with an arbitrary char followed by : we add the output of `cd`. + +=cut + +sub conv_to_win_path { + my $p = shift; + $p =~ s!/!\\!g; + # we need absolute pathes, too + if ($p !~ m!^.:!) { + my $cwd = `cd`; + chomp($cwd); + $p = "$cwd\\$bindir"; + } + if ($p =~ m/ /) { $p = "\"$p\""; } + return($p); +} ############################################# # |