diff options
author | Norbert Preining <preining@logic.at> | 2008-05-19 08:37:41 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-05-19 08:37:41 +0000 |
commit | 5177658bbbdaa8778cff3a2ac4fabb765bbcd8fe (patch) | |
tree | b00bfdb0be26f8f7ce3d626ac084b987c608c511 /Master/tlpkg/TeXLive/TLPDB.pm | |
parent | 58c870fa77e1ede0e7b21a7791d0fa5b8fd1542b (diff) |
big logging update, new logging facilities: info, debug, ddebug, tlwarn
and a way to automatically process the respective options -q and -v
via TeXLive::TLUtils::process_logging_options();
git-svn-id: svn://tug.org/texlive/trunk@8234 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index ab34e246858..690f8d24463 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -54,7 +54,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages use TeXLive::TLConfig qw($CategoriesRegexp $DefaultCategory $InfraLocation $DatabaseName $MetaCategoriesRegexp); -use TeXLive::TLUtils qw(dirname mkdirhier tllog member win32); +use TeXLive::TLUtils qw(dirname mkdirhier member win32 info debug ddebug); use TeXLive::TLPOBJ; my $_listdir; @@ -152,7 +152,7 @@ sub remove_package { if (defined($self->{'tlps'}{$pkg})) { delete $self->{'tlps'}{$pkg}; } else { - warn "Cannot find package $pkg for removal in tlpdb!"; + tlwarn("Cannot find package $pkg for removal in tlpdb!"); } } @@ -183,7 +183,7 @@ sub from_file { } my $retfh; if ($path =~ /^(http|ftp):\/\//) { - tllog($::LOG_DDDEBUG, "TLPDB.pm: trying to initialize from $path\n"); + debug("TLPDB.pm: trying to initialize from $path\n"); # if we have lzmadec available we try the lzma file if (defined($::progs{'lzmadec'})) { # we first try the lzma compressed file @@ -199,23 +199,23 @@ sub from_file { } $lzmafile_quote = "\"$lzmafile\""; $tlpdbfile_quite = "\"$tlpdbfile\""; - tllog($::LOG_DEBUG, "trying to download $path.lzma to $lzmafile\n"); + debug("trying to download $path.lzma to $lzmafile\n"); my $ret = TeXLive::TLUtils::download_file("$path.lzma", "$lzmafile"); # better to check both, the return value AND the existence of the file if ($ret && (-r "$lzmafile")) { # ok, let the fun begin - tllog($::LOG_DEBUG, "Un-lzmaing $lzmafile to $tlpdbfile\n"); + debug("Un-lzmaing $lzmafile to $tlpdbfile\n"); system("$::progs{'lzmadec'} < $lzmafile_quote > $tlpdbfile_quote"); if (! -r $tlpdbfile) { - tllog($::LOG_DEBUG, "Un-lzmaing $lzmafile did not succeed, try normally\n"); + debug("Un-lzmaing $lzmafile did not succeed, try normally\n"); } else { unlink($lzmafile); open $retfh, "<$tlpdbfile" or die"Cannot open $tlpdbfile!"; - tllog($::LOG_DEBUG, "Ok, found the uncompressed lzma file!\n"); + debug("Ok, found the uncompressed lzma file!\n"); } } } else { - tllog($::LOG_DEBUG, "no lzmadec defined, not trying tlpdb.lzma ...\n"); + debug("no lzmadec defined, not trying tlpdb.lzma ...\n"); } if (!defined($retfh)) { # lzma did not succeed, so try the normal file @@ -231,7 +231,7 @@ sub from_file { my $found = 0; do { my $tlp = TeXLive::TLPOBJ->new; - tllog($::LOG_DDDEBUG, "creating tlp from $path...\n"); + ddebug("creating tlp from $path...\n"); $found = $tlp->from_fh($retfh,1); if ($found) { $self->add_tlpobj($tlp); @@ -254,8 +254,8 @@ sub writeout { my $self = shift; my $fd = (@_ ? $_[0] : STDOUT); foreach (sort keys %{$self->{'tlps'}}) { - tllog($::LOG_DDDEBUG, "tlpname = $_\n"); - tllog($::LOG_DDDEBUG, "foo: ", $self->{'tlps'}{$_}->name, "\n"); + ddebug("tlpname = $_\n"); + ddebug("foo: ", $self->{'tlps'}{$_}->name, "\n"); $self->{'tlps'}{$_}->writeout($fd); print $fd "\n"; } @@ -360,8 +360,8 @@ sub _add_tlpcontainer { } else { die "Cannot find a package $container (.zip or .lzma) in $ziplocation\n"; } - warn "Huuu, this needs testing and error checking!\n"; - warn "Should we use -a -- adapt line endings etc?\n"; + tlwarn("Huuu, this needs testing and error checking!\n"); + tlwarn("Should we use -a -- adapt line endings etc?\n"); `$unpackprog $args`; # we only create/add tlpobj for arch eq "all" if ($arch eq "all") { @@ -546,7 +546,7 @@ sub _generate_listfile { } else { # speudo dependencies on $Package.ARCH can be ignored if ($d !~ m/\.ARCH$/) { - warn "Strange: $tlp->name depends on $d, but this package does not exists!\n"; + tlwarn("Strange: $tlp->name depends on $d, but this package does not exists!\n"); } } } @@ -565,7 +565,7 @@ sub _generate_listfile { foreach my $p (@lop) { my $subtlp = $self->get_package($p); if (!defined($subtlp)) { - warn "Strange: $listname references $p, but it is not in tlpdb"; + tlwarn("Strange: $listname references $p, but it is not in tlpdb"); } $s += $subtlp->total_size; } @@ -594,7 +594,7 @@ sub _generate_listfile { TeXLive::TLUtils::push_uniq(\@collpkg,$d); } } else { - warn "Strange: $coll->name depends on $d, but this does not exists!\n"; + tlwarn("Strange: $coll->name depends on $d, but this does not exists!\n"); } } } |