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 | |
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')
-rw-r--r-- | Master/tlpkg/TeXLive/TLMedia.pm | 20 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 32 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 17 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPSRC.pm | 4 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLTREE.pm | 12 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 121 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLWinGoo.pm | 26 | ||||
-rwxr-xr-x | Master/tlpkg/bin/check-depend-consistency | 3 | ||||
-rwxr-xr-x | Master/tlpkg/bin/check-execute-consistency | 3 | ||||
-rwxr-xr-x | Master/tlpkg/bin/check-file-coverage | 14 | ||||
-rwxr-xr-x | Master/tlpkg/bin/place | 1 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-make-install-pkg | 18 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-containers | 21 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpdb2container | 11 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpdb2list | 13 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpfiles | 11 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlprm | 11 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpsrc2container | 17 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpsrc2tlpdb | 20 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpsrc2tlpobj | 13 | ||||
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 4 |
21 files changed, 177 insertions, 215 deletions
diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm index f1eb9062e45..4b83b2db674 100644 --- a/Master/tlpkg/TeXLive/TLMedia.pm +++ b/Master/tlpkg/TeXLive/TLMedia.pm @@ -10,7 +10,7 @@ package TeXLive::TLMedia; use TeXLive::TLConfig; use TeXLive::TLPostActions; -use TeXLive::TLUtils qw(tllog copy win32 dirname mkdirhier conv_to_win_path basename download_file merge_into); +use TeXLive::TLUtils qw(copy win32 dirname mkdirhier conv_to_win_path basename download_file merge_into); use TeXLive::TLPDB; use Cwd qw/abs_path/; @@ -38,7 +38,7 @@ sub new return; } } - tllog($::LOG_DEBUG, "Loading $location/$InfraLocation/$DatabaseName ...\n"); + debug("Loading $location/$InfraLocation/$DatabaseName ...\n"); my $tlpdb = TeXLive::TLPDB->new(root => "$location"); my (@all_c, @std_c, @lang_c, @lang_doc_c); my (@schemes); @@ -90,14 +90,14 @@ sub install_package { if (!defined($tlpobj)) { if (defined($fallbackmedia)) { if ($ret = $fallbackmedia->install_package($pkg,$totlpdb)) { - tllog($::LOG_DEBUG, "installed $pkg from fallback"); + debug("installed $pkg from fallback"); return $ret; } else { - tllog($::LOG_NORMAL, "couldn't find $pkg"); + tlwarn("couldn't find $pkg"); return 0; } } else { - tllog($::LOG_NORMAL, "couldn't find $pkg"); + tlwarn("couldn't find $pkg"); return 0; } } else { @@ -112,7 +112,7 @@ sub install_package { # even if opt_doc is false $real_opt_doc = 1; } - tllog($::LOG_NORMAL, "install: $pkg\n"); + info("install: $pkg\n"); foreach my $h (@::install_packages_hook) { &$h("install: $package"); } @@ -149,7 +149,7 @@ sub install_package { $container = "$location/$DiskArchive/$pkg.tar.lzma"; } else { # for now only warn and return, should (?) be die!? - warn "Cannot find a package $pkg (.zip or .lzma) in $location/$DiskArchive\n"; + tlwarn "Cannot find a package $pkg (.zip or .lzma) in $location/$DiskArchive\n"; next; } } elsif (&media eq 'NET') { @@ -229,7 +229,7 @@ sub install_package { if (!$nopostinstall) { # do the postinstallation actions if (defined($PostInstall{$pkg})) { - tllog($::LOG_NORMAL, "running post install action for $pkg\n"); + info("running post install action for $pkg\n"); &{$PostInstall{$pkg}}($totlpdb->root); } } @@ -295,12 +295,12 @@ sub _install_package { # copy it to temp copy($what, "$target/temp"); } - tllog($::LOG_DEBUG, "Un-lzmaing $lzmafile to $tarfile\n"); + debug("Un-lzmaing $lzmafile to $tarfile\n"); system("$lzmadec < $lzmafile_quote > $tarfile_quote"); if (! -f $tarfile) { die "Unpacking $lzmafile did not succeed, please retry!"; } - tllog($::LOG_DEBUG, "Unpacking $tarfile\n"); + debug("Unpacking $tarfile\n"); system($tar,"-x","-C",$target,"-f",$tarfile); unlink($tarfile, $lzmafile); } else { 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"); } } } diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index f9fa7942b3c..83fbf80962d 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -7,7 +7,7 @@ package TeXLive::TLPOBJ; use TeXLive::TLConfig qw($DefaultCategory $CategoriesRegexp $MetaCategoriesRegexp $InfraLocation); -use TeXLive::TLUtils qw/win32 tllog/; +use TeXLive::TLUtils; #use File::Path; use TeXLive::TLTREE; #use FileHandle; # format_name in writeout, no idea how to rewrite @@ -77,10 +77,7 @@ sub from_fh { chomp($line); # we call tllog only when something will be logged, to speed things up. # this is the inner loop bounding the time to read tlpdb. - if ($::LOGLEVELTERMINAL >= $::LOG_DDDEBUG || - $::LOGLEVELFILE >= $::LOG_DDDEBUG) { - tllog($::LOG_DDDEBUG, "reading line: >>>$line<<<\n"); - } + ddebug("reading line: >>>$line<<<\n"); $line =~ /^\s*#/ && next; # skip comment lines if ($line =~ /^\s*$/o) { if (!$started) { next; } @@ -537,11 +534,11 @@ sub make_container { my $tar = $::progs{'tar'}; my $lzma = $::progs{'lzma'}; if (!defined($tar)) { - tllog($::LOG_NORMAL, "Programs have not been set up, trying with \"tar\"!\n"); + tlwarn("Programs have not been set up, trying with \"tar\"!\n"); $tar = "tar"; } if (!defined($lzma)) { - tllog($::LOG_NORMAL, "Programs have not been set up, trying with \"lzma\"!\n"); + tlwarn("Programs have not been set up, trying with \"lzma\"!\n"); $lzma = "lzma"; } my @cmdline = ($tar, "-c", "-f", "$destdir/$tarname", "--files-from=-"); @@ -565,13 +562,13 @@ sub make_container { if (-r "$destdir/$tarname") { system($lzma, "--force", "-z", "$destdir/$tarname"); } else { - warn("Couldn't find $destdir/$tarname"); + tlwarn("Couldn't find $destdir/$tarname"); } # cleaning up unlink("$tlpobjdir/$self->{'name'}.tlpobj"); rmdir("$tlpobjdir") if $removetlpobjdir; chdir($cwd); - tllog($::LOG_DDDEBUG, "Done $containername\n"); + ddebug("Done $containername\n"); } @@ -816,7 +813,7 @@ sub make_return_hash_from_executes { } elsif ($e =~ m/^BuildLanguageDat\s+([^\s]+)\s*$/) { push @dats, $1; } else { - warn("Unknown execute $e in ", $self->name); + tlwarn("Unknown execute $e in ", $self->name); } } $ret{'map'} = [ @maps ] if (@maps); diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm index b0272bb68ea..6bbb37a1ad4 100644 --- a/Master/tlpkg/TeXLive/TLPSRC.pm +++ b/Master/tlpkg/TeXLive/TLPSRC.pm @@ -12,7 +12,7 @@ package TeXLive::TLPSRC; use FileHandle; use TeXLive::TLConfig qw($CategoriesRegexp); -use TeXLive::TLUtils qw(tllog); +use TeXLive::TLUtils; use TeXLive::TLPOBJ; use TeXLive::TLTREE; @@ -119,7 +119,7 @@ sub from_file push @depends, "$1" if ("$1" ne ""); next; } else { - tllog($::LOG_NORMAL,"$srcfile: unknown tlpsrc directive, please fix: $line\n"); + tlwarn("$srcfile: unknown tlpsrc directive, please fix: $line\n"); } } } diff --git a/Master/tlpkg/TeXLive/TLTREE.pm b/Master/tlpkg/TeXLive/TLTREE.pm index 9e009616b54..e32b3a91e13 100644 --- a/Master/tlpkg/TeXLive/TLTREE.pm +++ b/Master/tlpkg/TeXLive/TLTREE.pm @@ -76,7 +76,7 @@ sub _initialize_lines { add_path_to_tree($self->{'_dirtree'}, split("[/\\\\]", $dn)); push @{$self->{'_filesofdir'}{$dn}}, $fn; } else { - warn("Ignoring svn status output line:\n $l\n"); + tlwarn("Ignoring svn status output line:\n $l\n"); #die("Cannot read svn status output line:\n $l\n"); } } @@ -220,7 +220,7 @@ sub _get_matching_files { } else { die "Unknown pattern $p"; } - tllog($::LOG_DDDEBUG, "p=$p; matchfiles=@matchfiles\n"); + ddebug("p=$p; matchfiles=@matchfiles\n"); return @matchfiles; } @@ -246,9 +246,9 @@ sub _get_files_matching_glob_pattern { return unless (defined($self->{'_filesofdir'}{$dirpart})); my @candfiles = @{$self->{'_filesofdir'}{$dirpart}}; foreach my $f (@candfiles) { - tllog($::LOG_DDDEBUG, "matching $f in $dirpart via glob $globline\n"); + ddebug("matching $f in $dirpart via glob $globline\n"); if ($f =~ /^$basepart$/) { - tllog($::LOG_DDDEBUG, "hit: globline=$globline, $dirpart/$f\n"); + ddebug("hit: globline=$globline, $dirpart/$f\n"); if ("$dirpart" eq ".") { push @returnfiles, "$f"; } else { @@ -259,9 +259,9 @@ sub _get_files_matching_glob_pattern { if ($dirpart =~ m@^bin/win32@) { # for arch=win32 under bin we also want to match .dll, .bat, .exe files foreach my $f (@candfiles) { - tllog($::LOG_DDDEBUG, "matching $f in $dirpart via glob $globline.{bat/exe/texlua}\n"); + ddebug("matching $f in $dirpart via glob $globline.{bat/exe/texlua}\n"); if ($f =~ /^$basepart\.(bat|exe|dll|texlua)$/) { - tllog($::LOG_DDDEBUG, "hit: globline=$globline, $dirpart/$f\n"); + ddebug("hit: globline=$globline, $dirpart/$f\n"); if ("$dirpart" eq ".") { push @returnfiles, "$f"; } else { diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 4a495ff6784..082591c89bf 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -59,7 +59,6 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::sort_uniq(@list); TeXLive::TLUtils::push_uniq(\@list, @items); TeXLive::TLUtils::member($item, @list); - TeXLive::TLUtils::tllog($level, $string); TeXLive::TLUtils::merge_into(\%to, \%from); TeXLive::TLUtils::texdir_check($texdir); TeXLive::TLUtils::kpsewhich; @@ -107,12 +106,14 @@ BEGIN { &setup_programs &download_file &merge_into + &process_logging_options ); - @EXPORT = qw(tllog setup_programs download_file); + @EXPORT = qw(setup_programs download_file info debug ddebug tlwarn process_logging_options win32); } use TeXLive::TLConfig; +use Getopt::Long; =pod @@ -522,7 +523,7 @@ sub install_packages { my $container_src_split = $fromtlpdb->config_src_container; my $container_doc_split = $fromtlpdb->config_doc_container; foreach my $package (@$what) { - tllog($::LOG_NORMAL, "Installing: $package\n"); + info("Installing: $package\n"); foreach my $h (@::install_packages_hook) { &$h("Installing: $package"); } @@ -552,7 +553,7 @@ sub install_packages { $container = "$::installerdir/$DiskArchive/$package.tar.lzma"; } else { # for now only warn and return, should (?) be die!? - warn "Cannot find a package $package (.zip or .lzma) in $::installerdir/$DiskArchive\n"; + tlwarn("Cannot find a package $package (.zip or .lzma) in $::installerdir/$DiskArchive\n"); next; } } elsif (&media eq 'NET') { @@ -678,12 +679,12 @@ sub install_package { # copy it to temp copy($what, "$target/temp"); } - tllog($::LOG_DEBUG, "Un-lzmaing $lzmafile to $tarfile\n"); + debug("Un-lzmaing $lzmafile to $tarfile\n"); system("$lzmadec < $lzmafile_quote > $tarfile_quote"); if (! -f $tarfile) { die "Unpacking $lzmafile did not succeed, please retry!"; } - tllog($::LOG_DEBUG, "Unpacking $tarfile\n"); + debug("Unpacking $tarfile\n"); system($tar,"-x","-C",$target,"-f",$tarfile); unlink($tarfile, $lzmafile); } else { @@ -755,7 +756,7 @@ sub download_file { } elsif (defined($::progs{'wget'})) { $wget = $::progs{'wget'}; } else { - warn ("Programs have not been set up, trying simply wget"); + tlwarn ("Programs have not been set up, trying simply wget"); $wget = "wget"; } my $url; @@ -792,7 +793,7 @@ sub _download_file { my $wgetargs = $ENV{"TL_DOWNLOAD_ARGS"} || "-q -O"; - tllog($::LOG_DEBUG, "Trying to download $url\n"); + debug("Trying to download $url\n"); my $ret; if ($dest eq "|") { open(RETFH, "$wget $wgetargs - $url|") or @@ -808,7 +809,7 @@ sub _download_file { } # return false/undef in case the download did not succeed. return ($ret) unless $ret; - tllog($::LOG_DEBUG, "Download $url did succeed\n"); + debug("Download $url did succeed\n"); if ($dest eq "|") { return \*RETFH; } else { @@ -846,7 +847,7 @@ sub install_package_old { } } elsif (&media eq 'CD') { my $package="$::installerdir/$DiskArchive/$what[0]"; - open IN, "$package", or warn "Can't open '$package': $!\n" + open IN, "$package" or die "Can't open '$package': $!\n"; binmode IN; @@ -1183,71 +1184,63 @@ sub texdir_check { return 0; } -=pod - -=item C<tllog($type, $rest, ...)> - -Debugging output is controlled by 2 global variables: $::LOGLEVELTERMINAL -for the output to the terminal, and $::LOGLEVELFILE for the output to -the log file (whose filehandle should be saved in $::LOGFILE). - -If the first argument of C<tllog> is less or equal to the respective -threshold the message is issued to STDERR and log file, respectively. - -If $::LOGFILE is not defined logging to a log file is completely disabled. - -Predefined levels of debugging are: $::LOG_NORMAL, $::LOG_DEBUG, $::LOG_DDEBUG, -and $::LOG_DDDEBUG with increasing level of detailedness. -Note that all TeXLive modules to logging with $::LOG_DDDEBUG! -By default the threshold for logging to the log file is $::LOG_DEBUG, and -the one for the terminal $::LOG_NORMAL. - -If you want to disable logging set the respective thershold to $::LOG_ZERO. +sub logit { + my ($out, $level, @rest) = @_; + _logit($out, $level, @rest) unless $::opt_quiet; + _logit('file', $level, @rest); +} -=cut +sub _logit { + my ($out, $level, @rest) = @_; + if ($::opt_verbosity >= $level) { + # if $out is a ref/glob to STDOUT or STDERR, print it there + if (ref($out) eq "GLOB") { + print $out @rest; + } else { + # we should log it into the logfile, but that might be not initialized + # so either print it to the filehandle $::LOGFILE, or push it onto + # the to be printed log lines @::LOGLINES + if (defined($::LOGFILE)) { + print $::LOGFILE @rest; + } else { + push @::LOGLINES, "@rest"; + } + } + } +} -$::LOG_ZERO = -1; -$::LOG_NORMAL = 0; -$::LOG_DEBUG = 1; -$::LOG_DDEBUG = 2; -$::LOG_DDDEBUG = 3; -if (!defined($::LOGLEVELFILE)) { - $::LOGLEVELFILE = $::LOG_DEBUG; +sub info { + logit(\*STDOUT, 0, @_); } -if (!defined($::LOGLEVELTERMINAL)) { - $::LOGLEVELTERMINAL = $::LOG_NORMAL; + +sub debug { + logit(\*STDOUT, 1, @_); } -sub tllog { - my ($imp, @rest) = @_; - if (defined($::LOGFILE)) { - _tllog($::LOGLEVELFILE,$::LOGFILE,$imp,@rest); - } else { - _tllog($::LOGLEVELFILE,\@::LOGLINES,$imp,@rest); - } - my $out; - if ($imp == $::LOG_NORMAL) { - $out = \*STDOUT; - } else { - $out = \*STDERR; - } - _tllog($::LOGLEVELTERMINAL,$out,$imp,@rest); +sub ddebug { + logit(\*STDOUT, 2, @_); } -sub _tllog { - my ($threshold,$output,$imp, @rest) = @_; - if ($imp <= $threshold) { - if (ref($output) eq "GLOB") { - # we are writing to a file handle - print $output "@rest"; - } else { - push @{$output}, "@rest"; - } - } +sub tlwarn { + # warning should always done to stderr and the log file, + # independently from the verbosity level + my $savequiet = $::opt_quiet; + $::opt_quiet = 0; + logit(\*STDERR, -100, @_); + $::opt_quiet = $savequiet; } +sub process_logging_options { + $::opt_verbosity = 0; + $::opt_quiet = 0; + # check all the command line options for occurrences of -q and -v + # do not report errors + my $oldconfig = Getopt::Long::Configure(qw(pass_through)); + GetOptions("v+" => \$::opt_verbosity, "q" => \$::opt_quiet); + Getopt::Long::Configure($oldconfig); +} =pod diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index c4e07001c3b..513c5c0724e 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -261,7 +261,7 @@ sub reg_country { $value = substr $value, -4; my $lm = $Registry -> Open("HKEY_CLASSES_ROOT/MIME/Database/Rfc1766/", {Access => KEY_READ()})->{"/$value"}; - tllog($::LOG_DEBUG, "found lang codes value = $value, lm = $lm...\n"); + debug("found lang codes value = $value, lm = $lm...\n"); if ($lm) { return(substr $lm, 0, 2); } @@ -537,7 +537,7 @@ sub add_texbindir_to_path { $wg_error = 1; $wg_error_message = "Warning: possibly conflicting [pdf]TeX program found at $d_exp\n"; - tllog($::LOG_DEBUG, $wg_error_message); + debug($wg_error_message); } } } @@ -623,7 +623,7 @@ sub remove_texbindirs_from_path { sub reg_delete_recurse { my $parent = shift; my $childname = shift; - tllog ($::LOG_DDDEBUG, "Deleting $childname regkey\n"); + ddebug("Deleting $childname regkey\n"); if ($childname !~ '^/') { # subkey my $child = $parent->Open ($childname, {Access => KEY_ALL_ACCESS()}); return unless $child; @@ -660,7 +660,7 @@ sub register_script_type { $extension = uc($extension); my $command = shift; $command =~s/\//\\/g; - tllog ($::LOG_DDEBUG, "Linking $extension to $command\n"); + debug("Linking $extension to $command\n"); my $user_env = get_user_env(); my $system_env = get_system_env(); my ($classes_key, $k); @@ -708,12 +708,12 @@ sub unregister_script_type { my $extension = shift; $extension = '.'.$extension unless $extension =~ /^\./; # ensure leading dot $extension = uc($extension); - tllog ($::LOG_DDEBUG, "unregistering $extension\n"); + debug("unregistering $extension\n"); #my $user_env = get_user_env(); #my $system_env = get_system_env(); # file type - tllog ($::LOG_DDEBUG, "Deleting texlua filetype\n"); + debug("Deleting texlua filetype\n"); $extension = lc($extension); my $classes_key = $Registry -> Open("CUser/Software/Classes/", {Access => KEY_ALL_ACCESS()}); @@ -721,7 +721,7 @@ sub unregister_script_type { reg_delete_recurse ($classes_key, $extension."/"); reg_delete_recurse ($classes_key, "script".$extension."/"); } else { - tllog ($::LOG_DDEBUG, "Cannot open HKCU classes for write\n"); + debug("Cannot open HKCU classes for write\n"); } if ($is_admin) { $classes_key = $Registry -> Open("LMachine/Software/Classes/", @@ -730,7 +730,7 @@ sub unregister_script_type { reg_delete_recurse ($classes_key, $extension."/"); reg_delete_recurse ($classes_key, "script".$extension."/"); } else { - tllog ($::LOG_DDEBUG, "Cannot open HKLM classes for write\n"); + debug("Cannot open HKLM classes for write\n"); } reg_delete_recurse ($classes_key, "script$extension"); } @@ -758,11 +758,11 @@ sub broadcast_env() { my $result = ""; my $SendMessage; $wg_error = 0; - tllog($::LOG_DDEBUG, "Broadcasting \"Enviroment settings changed\" message...\n"); + debug("Broadcasting \"Enviroment settings changed\" message...\n"); $SendMessage = new Win32::API('user32', 'SendMessage', 'LLPP', 'L'); $result = $SendMessage->Call(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment') if $SendMessage; - tllog ($::LOG_DDEBUG, "Broadcast complete; result: $result.\n"); + debug("Broadcast complete; result: $result.\n"); } =pod @@ -778,11 +778,11 @@ sub update_assocs() { use constant SHCNF_IDLIST => 0; my $update_fu = new Win32::API('shell32', 'SHChangeNotify', 'LIPP', 'V'); if ($update_fu) { - tllog ($::LOG_DDEBUG, "Notifying changes in filetypes...\n"); + debug("Notifying changes in filetypes...\n"); $update_fu->Call (SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0); - tllog ($::LOG_DDEBUG, "Done notifying\n"); + debug("Done notifying\n"); } else { - tllog ($::LOG_DDEBUG, "No update_fu\n"); + debug("No update_fu\n"); } } diff --git a/Master/tlpkg/bin/check-depend-consistency b/Master/tlpkg/bin/check-depend-consistency index 3ff427164a9..95ee0850e2a 100755 --- a/Master/tlpkg/bin/check-depend-consistency +++ b/Master/tlpkg/bin/check-depend-consistency @@ -17,6 +17,7 @@ our $mydir; use strict; use TeXLive::TLConfig; +use TeXLive::TLUtils; use TeXLive::TLPOBJ; use TeXLive::TLPDB; use Getopt::Long; @@ -25,6 +26,8 @@ use File::Path; my $help = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions("help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; diff --git a/Master/tlpkg/bin/check-execute-consistency b/Master/tlpkg/bin/check-execute-consistency index 514a157f359..8cb4dbaab03 100755 --- a/Master/tlpkg/bin/check-execute-consistency +++ b/Master/tlpkg/bin/check-execute-consistency @@ -17,6 +17,7 @@ our $mydir; use strict; use TeXLive::TLConfig; +use TeXLive::TLUtils; use TeXLive::TLPOBJ; use TeXLive::TLPDB; use Getopt::Long; @@ -25,6 +26,8 @@ use File::Path; my $help = 0; +process_logging_options(); + GetOptions("help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; diff --git a/Master/tlpkg/bin/check-file-coverage b/Master/tlpkg/bin/check-file-coverage index 75026b9e064..3ecc64f7ced 100755 --- a/Master/tlpkg/bin/check-file-coverage +++ b/Master/tlpkg/bin/check-file-coverage @@ -19,7 +19,7 @@ use TeXLive::TLPSRC; use TeXLive::TLPOBJ; use TeXLive::TLPDB; use TeXLive::TLTREE; -use TeXLive::TLUtils qw(dirname tllog); +use TeXLive::TLUtils qw(dirname info debug); use Getopt::Long; use Pod::Usage; use File::Path; @@ -38,21 +38,17 @@ my @IgnorePatterns = qw! tlpkg/texlive.tlpdb !; +TeXLive::TLUtils::process_logging_options(); + chomp (my $opt_master = `cd $::mydir/../.. && pwd`); -my $opt_debug = 0; my $help = 0; GetOptions( "master=s" => \$opt_master, # location of the TL tree - "debug!", "help|?" => \$help) or pod2usage(1); + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - exit (&main ()); @@ -95,7 +91,7 @@ sub main } } - tllog($::LOG_DEBUG, "reading Master tree $opt_master, patience...\n"); + debug("reading Master tree $opt_master, patience...\n"); my $tltree = TeXLive::TLTREE->new( "svnroot" => $opt_master ); $tltree->init_from_svn; diff --git a/Master/tlpkg/bin/place b/Master/tlpkg/bin/place index 28e8575ca17..4f04681f595 100755 --- a/Master/tlpkg/bin/place +++ b/Master/tlpkg/bin/place @@ -63,7 +63,6 @@ if ($Root eq 'texmf-doc') { # initialize TLPDB my $tlpdb = new TeXLive::TLPDB ('root' => $M); # create TLTREE from stuff in cooked/$pkg -#$::LOGLEVELTERMINAL = $::LOG_DDDEBUG; my $tltree = TeXLive::TLTREE->new ('svnroot' => "$cooked/$package"); $tltree->init_from_files; diff --git a/Master/tlpkg/bin/tl-make-install-pkg b/Master/tlpkg/bin/tl-make-install-pkg index 28a0baa8cbe..4cd8705f265 100755 --- a/Master/tlpkg/bin/tl-make-install-pkg +++ b/Master/tlpkg/bin/tl-make-install-pkg @@ -27,7 +27,7 @@ BEGIN { unshift (@INC, "$::installerdir/tlpkg"); } -use TeXLive::TLUtils qw(mkdirhier copy get_system_tmpdir tllog); +use TeXLive::TLUtils qw(mkdirhier copy get_system_tmpdir); use TeXLive::TLPDB; use TeXLive::TLPOBJ; use Getopt::Long; @@ -94,12 +94,12 @@ mkdir "$tmpdir" or die "Can't mkdir \"$tmpdir\".\n"; mkdir "$inst_tmp" or die "Can't mkdir \"$inst_tmp\".\n"; if ($opt_verbose) { - tllog ($::LOG_NORMAL, "thisdir: \"$thisdir\"\n"); - tllog ($::LOG_NORMAL, "installerdir: \"$installerdir\"\n"); - tllog ($::LOG_NORMAL, "sys_tmp: \"$sys_tmp\"\n"); - tllog ($::LOG_NORMAL, "tmpdir: \"$tmpdir\"\n"); - tllog ($::LOG_NORMAL, "inst_tmp: \"$inst_tmp\"\n"); - tllog ($::LOG_NORMAL, "outputdir: \"$outputdir\"\n"); + info("thisdir: \"$thisdir\"\n"); + info("installerdir: \"$installerdir\"\n"); + info("sys_tmp: \"$sys_tmp\"\n"); + info("tmpdir: \"$tmpdir\"\n"); + info("inst_tmp: \"$inst_tmp\"\n"); + info("outputdir: \"$outputdir\"\n"); } die "outputdir \"$outputdir\" dosn't exist.\n" unless (-d "$outputdir"); @@ -151,7 +151,7 @@ sub copy_files { sub make_zip { my ($type) = @_; - tllog ($::LOG_NORMAL, "making $type\n"); + info("making $type\n"); chdir ($tmpdir) || die "chdir($tmpdir) failed: $!"; if ($type eq 'zip') { @@ -166,7 +166,7 @@ sub make_zip sub install_zip { - tllog ($::LOG_NORMAL, "installing to $outputdir\n"); + info("installing to $outputdir\n"); copy "$tmpdir/install-tl-unx.tar.gz", $outputdir; system ('ls', '-l', "$outputdir/install-tl-unx.tar.gz"); diff --git a/Master/tlpkg/bin/tl-update-containers b/Master/tlpkg/bin/tl-update-containers index 466bc525c27..dfe772a0dc7 100755 --- a/Master/tlpkg/bin/tl-update-containers +++ b/Master/tlpkg/bin/tl-update-containers @@ -24,25 +24,20 @@ use Pod::Usage; use File::Path; our $mydir; -my $opt_debug = 0; my $opt_location = "."; my $opt_relative = 0; my $opt_recreate = 0; my $help = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions( "location=s" => \$opt_location, - "debug!" => \$opt_debug, "recreate" => \$opt_recreate, "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - exit (&main ()); sub main @@ -65,7 +60,7 @@ sub main . "; ignoring and continuing with $type"; } - tllog($::LOG_DEBUG, "format=$type srcsplit=$srcsplit docsplit=$docsplit\n"); + debug("format=$type srcsplit=$srcsplit docsplit=$docsplit\n"); my @todopacks = (); my @removepacks = (); @@ -99,7 +94,7 @@ sub main && defined($archiverevs{$pkg})) { $oldrev = $archiverevs{$pkg}; } else { - tllog($::LOG_NORMAL, "$pkg is new, found no containers\n"); + info("$pkg is new, found no containers\n"); $count{"new"}++; } @@ -115,7 +110,7 @@ sub main } if ($oldrev == $newrev) { - tllog($::LOG_DEBUG, "$pkg up to date\n"); + debug("$pkg up to date\n"); $count{"unchanged"}++; } elsif ($oldrev < $newrev) { push @todopacks, $pkg; @@ -137,7 +132,7 @@ sub main next if ($pkg eq "00texlive.installer"); my $obj = $tlpdb->get_package ($pkg); die "$0: no TL package named $pkg in $Master" if ! $obj; - tllog($::LOG_DEBUG, "updating $pkg containers ...\n"); + debug("updating $pkg containers ...\n"); # we have to make a copy otherwise the src/doc files in the original # tlpobj are removed, and thus also in the tlpdb to be saved!!! my $objcopy = $obj->copy; @@ -163,7 +158,7 @@ sub main # next we remove those containers which have been gone! foreach my $op (@removepacks) { - tllog($::LOG_NORMAL, "$op has disappeared, removing its containers\n"); + info("$op has disappeared, removing its containers\n"); `rm $opt_containerdir/$op.*`; $count{"removed"}++; } @@ -187,7 +182,7 @@ sub main next if ($p eq "00texlive.config"); next if ($p eq "00texlive.installer"); if (! -r "$opt_containerdir/$p.tar.lzma") { - tllog($::LOG_NORMAL, "container for $p is missing, strange!\n"); + info("container for $p is missing, strange!\n"); } } } diff --git a/Master/tlpkg/bin/tlpdb2container b/Master/tlpkg/bin/tlpdb2container index 55662a3a36b..0de2713777b 100755 --- a/Master/tlpkg/bin/tlpdb2container +++ b/Master/tlpkg/bin/tlpdb2container @@ -25,24 +25,19 @@ use File::Path; my $opt_all = 0; our $mydir; -my $opt_debug = 0; my $opt_outputdir = "./archive"; my $opt_relative = 0; my $help = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions("o|outputdir=s" => \$opt_outputdir, "a|all!" => \$opt_all, - "d|debug!" => \$opt_debug, "r|relative!" => \$opt_relative, "h|help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - my $srcsplit = 0; my $docsplit = 0; my $type = "lzma"; @@ -68,7 +63,7 @@ sub main if (($format eq "lzma") || ($format eq "zip")) { $type = $format; } else { - tllog($::LOG_NORMAL, "unknown container format specified in 00texlive.config: $format\nIgnoring and continuing with $type!\n"); + info("unknown container format specified in 00texlive.config: $format\nIgnoring and continuing with $type!\n"); } # get list of packages. my $last = ""; diff --git a/Master/tlpkg/bin/tlpdb2list b/Master/tlpkg/bin/tlpdb2list index be28b8d2124..0859fe2e652 100755 --- a/Master/tlpkg/bin/tlpdb2list +++ b/Master/tlpkg/bin/tlpdb2list @@ -18,23 +18,20 @@ use TeXLive::TLPOBJ; use TeXLive::TLPDB; use Getopt::Long; use Pod::Usage; +use TeXLive::TLUtils; use File::Path; my $opt_outputdir = "new-list"; -my $opt_debug = 0; my $help = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions("outputdir=s" => \$opt_outputdir, - "debug!", "help|?" => \$help) or pod2usage(1); + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; pod2usage(1) if ($#ARGV<0); -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - if (! -d $opt_outputdir) { mkpath ($opt_outputdir) or die "cannot mkdir $opt_outputdir: $!"; } @@ -64,7 +61,7 @@ C<./new-list>. =back -The standard options C<-help> and C<-debug> are also accepted. +The standard options C<-help>, C<-q>, and C<-v> are also accepted. See the tlpfiles documentation for details. =head1 DESCRIPTION diff --git a/Master/tlpkg/bin/tlpfiles b/Master/tlpkg/bin/tlpfiles index ca8af22b6c9..209d79bc42d 100755 --- a/Master/tlpkg/bin/tlpfiles +++ b/Master/tlpkg/bin/tlpfiles @@ -21,24 +21,21 @@ use TeXLive::TLConfig; use TeXLive::TLPDB; use Pod::Usage; use Getopt::Long; +use TeXLive::TLUtils; our $FILE; our %DB_BY_FILE; # used privately below. our @opt_pkgof = (); -my $opt_debug = 0; my $help = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions("pkgof=s" => \@opt_pkgof, - "debug!", "help|?" => \$help) or pod2usage(1); + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - exit (&main ()); diff --git a/Master/tlpkg/bin/tlprm b/Master/tlpkg/bin/tlprm index 72655fe04de..38c11d57780 100755 --- a/Master/tlpkg/bin/tlprm +++ b/Master/tlpkg/bin/tlprm @@ -21,24 +21,21 @@ use strict; use TeXLive::TLConfig; use TeXLive::TLPDB; use TeXLive::TLPSRC; +use TeXLive::TLUtils; use Pod::Usage; use Getopt::Long; use Cwd 'abs_path'; -my $opt_debug = 0; my $opt_svn = 1; my $help = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions("svn!", - "debug!", "help|?" => \$help) or pod2usage(1); + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - exit (&main ()); diff --git a/Master/tlpkg/bin/tlpsrc2container b/Master/tlpkg/bin/tlpsrc2container index a65aa9975ef..80a9b22328a 100755 --- a/Master/tlpkg/bin/tlpsrc2container +++ b/Master/tlpkg/bin/tlpsrc2container @@ -17,6 +17,7 @@ use strict; use TeXLive::TLPSRC; use TeXLive::TLPOBJ; use TeXLive::TLTREE; +use TeXLive::TLUtils; use Cwd; use Getopt::Long; use Pod::Usage; @@ -28,24 +29,20 @@ chomp (my $opt_master = `cd $::mydir/../.. && pwd`); my $opt_catalogue = ""; my $opt_type = "zip"; my $opt_outputdir = "./zip"; -my $opt_debug = 0; my $help = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions( "all!" => \$opt_all, "master=s" => \$opt_master, # location of the tree "catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue "outputdir=s" => \$opt_outputdir, "type=s" => \$opt_type, - "debug!", "help|?" => \$help) or pod2usage(1); + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - exit(&main ()); sub main @@ -65,10 +62,10 @@ sub main my $tlc = undef; if (! -d $opt_catalogue) { - tllog ($::LOG_NORMAL, "$0: -c /Cat/a/logue not given, continuing without it.\n"); + info("$0: -c /Cat/a/logue not given, continuing without it.\n"); } else { require TeXLive::TeXCatalogue; # not at compile time, for now anyway. - tllog ($::LOG_NORMAL, "$0: reading TeX Catalogue tree $opt_catalogue ...\n"); + info("$0: reading TeX Catalogue tree $opt_catalogue ...\n"); $tlc = TeXLive::TeXCatalogue->new( "location" => $opt_catalogue ); } @@ -79,7 +76,7 @@ sub main @ARGV = glob ("*.tlpsrc"); } - tllog ($::LOG_NORMAL, "$0: reading Master tree $opt_master ...\n"); + info("$0: reading Master tree $opt_master ...\n"); my $tltree = TeXLive::TLTREE->new( "svnroot" => $opt_master ); $tltree->init_from_svn; diff --git a/Master/tlpkg/bin/tlpsrc2tlpdb b/Master/tlpkg/bin/tlpsrc2tlpdb index 6c8517f8fdd..37ae0be378c 100755 --- a/Master/tlpkg/bin/tlpsrc2tlpdb +++ b/Master/tlpkg/bin/tlpsrc2tlpdb @@ -27,24 +27,20 @@ use File::Path; my $opt_all = 0; my $opt_catalogue = ""; chomp (my $opt_master = `cd $::mydir/../.. && pwd`); -my $opt_debug = 0; my $help = 0; my $opt_nobinsplit = 0; +TeXLive::TLUtils::process_logging_options(); + GetOptions( "all!" => \$opt_all, "master=s" => \$opt_master, # location of the TL tree "catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue "no-bin-split!" => \$opt_nobinsplit, - "debug!", "help|?" => \$help) or pod2usage(1); + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - exit (&main ()); @@ -56,10 +52,10 @@ sub main my $tlc = undef; if (! -d $opt_catalogue) { - tllog($::LOG_NORMAL, "$0: -c /Cat/a/logue not given, continuing without it.\n"); + info("$0: -c /Cat/a/logue not given, continuing without it.\n"); } else { require TeXLive::TeXCatalogue; # not at compile time, for now anyway. - tllog($::LOG_NORMAL, "$0: reading TeX Catalogue $opt_catalogue ...\n"); + info("$0: reading TeX Catalogue $opt_catalogue ...\n"); $tlc = TeXLive::TeXCatalogue->new( "location" => $opt_catalogue ); } @@ -70,11 +66,11 @@ sub main @ARGV = glob ("*.tlpsrc"); } - tllog($::LOG_NORMAL, "$0: reading Master $opt_master ...\n"); + info("$0: reading Master $opt_master ...\n"); my $tltree = TeXLive::TLTREE->new( "svnroot" => $opt_master ); $tltree->init_from_svn; - tllog($::LOG_NORMAL, "$0: updating from tlpsrc ...\n"); + info("$0: updating from tlpsrc ...\n"); my $tldb = TeXLive::TLPDB->new; my $last = ""; my $src_count = 0; @@ -117,7 +113,7 @@ sub main # do set the option_archs from the dirs in Master/bin $tldb->option_archs($tltree->architectures); $tldb->save; - tllog($::LOG_NORMAL, "$0: wrote $src_count packages to ". $tldb->root . ".\n"); + info("$0: wrote $src_count packages to ". $tldb->root . ".\n"); } else { $tldb->writeout; } diff --git a/Master/tlpkg/bin/tlpsrc2tlpobj b/Master/tlpkg/bin/tlpsrc2tlpobj index df0a823f4da..3425055997f 100755 --- a/Master/tlpkg/bin/tlpsrc2tlpobj +++ b/Master/tlpkg/bin/tlpsrc2tlpobj @@ -17,6 +17,7 @@ use strict; use TeXLive::TLPSRC; use TeXLive::TLPOBJ; use TeXLive::TLTREE; +use TeXLive::TLUtils; use Getopt::Long; use Pod::Usage; use File::Path; @@ -24,23 +25,19 @@ use File::Path; my $opt_master = "/src/TeX/texlive-svn/Master"; my $opt_outputdir = "./tlpobj"; -my $opt_debug = 0; my $help = 0; my $opt_catalogue = ""; +TeXLive::TLUtils::process_logging_options(); + GetOptions( "master=s" => \$opt_master, # location of the tree "catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue "outputdir=s" => \$opt_outputdir, - "debug!", "help|?" => \$help) or pod2usage(1); + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if ($opt_debug) { - $::LOGLEVELFILE = $::LOG_DDDEBUG; - $::LOGLEVELTERMINAL = $::LOG_DDDEBUG; -} - if (! -d "$opt_master") { die "Master $opt_master does not exists!"; } @@ -51,7 +48,7 @@ if (! -d "$opt_outputdir") { my $tlc; if (! -d "$opt_catalogue") { - tllog($::LOG_NORMAL, "$0: -d /Cat/a/logue not given, continuing without it.\n"); + info("$0: -d /Cat/a/logue not given, continuing without it.\n"); } else { require TeXLive::TeXCatalogue; # not at compile time, for now anyway. $tlc = TeXLive::TeXCatalogue->new( 'location' => "$opt_catalogue" ); diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 2785960538b..f3afba912c1 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -42,7 +42,7 @@ if (defined($::opt_lang)) { if ($foo) { $::lang = $foo; } else { - tllog($::LOG_DEBUG, "Didn't get any usuful code from reg_country: $foo...\n"); + debug("Didn't get any usuful code from reg_country: $foo...\n"); } } else { # we load POSIX and locale stuff @@ -214,7 +214,7 @@ sub run_menu { my $l = length($text{$l}); $c = $l if ($l > $c); } - tllog($::LOG_DDEBUG, "setting column widhts to a=$a, c=$c\n"); + debug("setting column widths to a=$a, c=$c\n"); calc_depends; $mw = MainWindow->new; |