summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-05-19 08:37:41 +0000
committerNorbert Preining <preining@logic.at>2008-05-19 08:37:41 +0000
commit5177658bbbdaa8778cff3a2ac4fabb765bbcd8fe (patch)
treeb00bfdb0be26f8f7ce3d626ac084b987c608c511
parent58c870fa77e1ede0e7b21a7791d0fa5b8fd1542b (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
-rwxr-xr-xMaster/install-tl150
-rwxr-xr-xMaster/texmf/scripts/texlive/generate-fmtutil.pl14
-rwxr-xr-xMaster/texmf/scripts/texlive/generate-language.pl14
-rwxr-xr-xMaster/texmf/scripts/texlive/generate-updmap.pl14
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl18
-rw-r--r--Master/tlpkg/TeXLive/TLMedia.pm20
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm32
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm17
-rw-r--r--Master/tlpkg/TeXLive/TLPSRC.pm4
-rw-r--r--Master/tlpkg/TeXLive/TLTREE.pm12
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm121
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm26
-rwxr-xr-xMaster/tlpkg/bin/check-depend-consistency3
-rwxr-xr-xMaster/tlpkg/bin/check-execute-consistency3
-rwxr-xr-xMaster/tlpkg/bin/check-file-coverage14
-rwxr-xr-xMaster/tlpkg/bin/place1
-rwxr-xr-xMaster/tlpkg/bin/tl-make-install-pkg18
-rwxr-xr-xMaster/tlpkg/bin/tl-update-containers21
-rwxr-xr-xMaster/tlpkg/bin/tlpdb2container11
-rwxr-xr-xMaster/tlpkg/bin/tlpdb2list13
-rwxr-xr-xMaster/tlpkg/bin/tlpfiles11
-rwxr-xr-xMaster/tlpkg/bin/tlprm11
-rwxr-xr-xMaster/tlpkg/bin/tlpsrc2container17
-rwxr-xr-xMaster/tlpkg/bin/tlpsrc2tlpdb20
-rwxr-xr-xMaster/tlpkg/bin/tlpsrc2tlpobj13
-rw-r--r--Master/tlpkg/installer/install-menu-perltk.pl4
26 files changed, 259 insertions, 343 deletions
diff --git a/Master/install-tl b/Master/install-tl
index 02fdbee30ba..58eb934724d 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -41,11 +41,13 @@ BEGIN {
unshift (@INC, "$::installerdir/tlpkg");
}
+use Getopt::Long qw(:config no_autoabbrev);
+
use TeXLive::TLUtils qw(initialize_installer media platform platform_desc
- which getenv win32 unix program_exists
- get_system_tmpdir member
+ which getenv win32 unix program_exists info debug tlwarn ddebug
+ get_system_tmpdir member process_logging_options
mkdirhier make_var_skeleton make_local_skeleton install_package copy
- install_packages dirname tllog setup_programs);
+ install_packages dirname setup_programs);
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
use TeXLive::TLConfig;
@@ -84,22 +86,15 @@ if (win32) {
));
}
-#use Getopt::Long;
-#$Getopt::Long::autoabbrev=0;
-use Getopt::Long qw(:config no_autoabbrev);
use strict;
# debugging/logging cmd lines options:
-# -q shut up terminal output
-# -qq shut up also log file output
-# -d set $::LOGLEVELFILE to $::LOG_DEBUG
-# -dd set $::LOGLEVELFILE to $::LOG_DDEBUG
-# -ddd set $::LOGLEVELFILE to $::LOG_DDDEBUG
+# -q shut up terminal output but warning messages
+# -v do a bit of debugging to stdout and logfile
+# repeated use increases the value of verbosity
#
-$::LOGLEVELFILE = $::LOG_NORMAL;
-$::LOGLEVELTERMINAL = $::LOG_NORMAL;
@::LOGLINES = ();
#
# $install{$packagename} == 1 if it should be installed
@@ -138,17 +133,16 @@ our %vars=( # 'n_' means 'number of'.
'selected_scheme' => $default_scheme,
);
+#
+# first process verbosity/quiet options
+process_logging_options();
+
# option handling
my $opt_media = "";
my $opt_url = "";
my $opt_profile = "";
my $opt_no_cls=0;
my $opt_nogui = 0;
-my $opt_debug = 0;
-my $opt_ddebug = 0;
-my $opt_dddebug = 0;
-my $opt_quiet = 0;
-my $opt_qquiet = 0;
my $opt_nonadmin = 0;
my $opt_arch = 0;
our $opt_portable = 0;
@@ -170,11 +164,6 @@ GetOptions("media=s" => \$opt_media,
"lang=s" => \$::opt_lang,
"print-arch" => \$opt_arch,
"portable" => \$opt_portable,
- "d" => \$opt_debug,
- "dd" => \$opt_ddebug,
- "ddd" => \$opt_dddebug,
- "q" => \$opt_quiet,
- "qq" => \$opt_qquiet,
"url=s" => \$opt_url,
"version" => \$opt_version,
"help|?" => \$opt_help) or pod2usage(1);
@@ -197,22 +186,6 @@ if (defined($::opt_lang)) {
$::lang = $::opt_lang;
}
-if ($opt_quiet) {
- $::LOGLEVELTERMINAL = $::LOG_ZERO;
-}
-if ($opt_qquiet) {
- $::LOGLEVELTERMINAL = $::LOG_ZERO;
- $::LOGLEVELFILE = $::LOG_ZERO;
-}
-if ($opt_debug) {
- $::LOGLEVELFILE = $::LOG_DEBUG;
-}
-if ($opt_ddebug) {
- $::LOGLEVELFILE = $::LOG_DDEBUG;
-}
-if ($opt_dddebug) {
- $::LOGLEVELFILE = $::LOG_DDDEBUG;
-}
if ("$opt_media" =~ m/^CD/i) {
$::_media_ = "CD";
} elsif ("$opt_media" =~ m/^NET/i) {
@@ -223,10 +196,10 @@ if ("$opt_media" =~ m/^CD/i) {
if ("$opt_profile" ne "") {
if (-r "$opt_profile") {
- tllog($::LOG_NORMAL, "Using automated installation using $opt_profile!");
+ info("Using automated installation using $opt_profile!");
} else {
$opt_profile = "";
- tllog($::LOG_NORMAL, "Profile $opt_profile not readable, continuing in interactive mode!");
+ info("Profile $opt_profile not readable, continuing in interactive mode!");
}
}
@@ -255,7 +228,7 @@ if ($opt_arch) {
print platform;
exit 0;
} elsif ($opt_portable) {
- $::LOGLEVELTERMINAL = $::LOG_ZERO;
+ $::opt_verbosity = -1;
# initialize_installer:
$::_media_ = "DVD";
$::_platform_ = platform();
@@ -299,18 +272,18 @@ if ($opt_arch) {
exit 0;
}
-tllog($::LOG_NORMAL, "Platform: ", platform, " => \'", platform_desc(platform), "\'\n");
+info("Platform: ", platform, " => \'", platform_desc(platform), "\'\n");
if (media() eq "DVD") {
- tllog($::LOG_NORMAL, "Distribution: live (uncompressed)\n");
+ info("Distribution: live (uncompressed)\n");
} elsif (media() eq "CD") {
- tllog($::LOG_NORMAL, "Distribution: inst (compressed)\n");
+ info("Distribution: inst (compressed)\n");
} elsif (media() eq "NET") {
- tllog($::LOG_NORMAL, "Distribution: net (downloading)\n");
+ info("Distribution: net (downloading)\n");
} else {
- tllog($::LOG_NORMAL, "Distribution: ", media(), "\n");
+ info("Distribution: ", media(), "\n");
}
-tllog($::LOG_NORMAL, "Directory for Temporary Files: '", $system_tmpdir, "\'\n");
-tllog($::LOG_NORMAL, "Installer Directory: '$::installerdir'\n");
+info("Directory for Temporary Files: '", $system_tmpdir, "\'\n");
+info("Installer Directory: '$::installerdir'\n");
initialize_installer();
setup_programs("$::installerdir/tlpkg/installer", "$::_platform_");
@@ -349,10 +322,10 @@ if ($opt_profile eq "") {
eval { require Tk; };
if ($@) {
# that didn't work out, so warn the user and continue with text mode
- tllog($::LOG_NORMAL, "Cannot load Tk, maybe something is missing!\n");
- tllog($::LOG_NORMAL, "Error message from loading Tk:\n");
- tllog($::LOG_NORMAL, "$@\n");
- tllog($::LOG_NORMAL, "Continuing in Text Mode...\n");
+ tlwarn("Cannot load Tk, maybe something is missing!\n");
+ tlwarn("Error message from loading Tk:\n");
+ tlwarn("$@\n");
+ tlwarn("Continuing in Text Mode...\n");
$opt_gui = 0;
}
}
@@ -373,11 +346,11 @@ if ($opt_profile eq "") {
exit(2);
}
if ($ret == $MENU_ALREADYDONE) {
- tllog($::LOG_DEBUG, "run_menu has already done the work ... cleaning up!\n");
+ debug("run_menu has already done the work ... cleaning up!\n");
$finished = 1;
}
if (!$finished && ($ret != $MENU_INSTALL)) {
- tllog($::LOG_NORMAL, "Unknown return value of run_menu: $ret\n");
+ warn("Unknown return value of run_menu: $ret\n");
exit(3);
}
} else {
@@ -391,16 +364,13 @@ if (!$finished) {
# now open the log file and write out the log lines
# try to open a log file
-if ($::LOGLEVELFILE > $::LOG_ZERO) {
- if (open(LOGF,">$vars{'TEXDIR'}/install-tl.log")) {
- $::LOGFILE = \*LOGF;
- foreach my $line(@::LOGLINES) {
- print $::LOGFILE "$line";
- }
- } else {
- warn("Cannot create log file $vars{'TEXDIR'}/install-tl.log: $!\nNot writing out log lines!\n");
- $::LOGLEVELFILE = $::LOG_ZERO;
+if (open(LOGF,">$vars{'TEXDIR'}/install-tl.log")) {
+ $::LOGFILE = \*LOGF;
+ foreach my $line(@::LOGLINES) {
+ print $::LOGFILE "$line";
}
+} else {
+ warn("Cannot create log file $vars{'TEXDIR'}/install-tl.log: $!\nNot writing out log lines!\n");
}
# dump various things to the log file
@@ -416,7 +386,7 @@ dump_vars("$system_tmpdir/texlive.vars");
# write the profile out
create_profile("$vars{'TEXDIR'}/$InfraLocation/texlive.profile");
-tllog($::LOG_DEBUG, "Profile written to $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n");
+debug("Profile written to $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n");
# Close log file if present
close($::LOGFILE) if defined($::LOGFILE);
@@ -467,7 +437,7 @@ sub dump_vars {
print $fh "$key $vars{$key}\n";
}
close VARS if (!ref($filename));
- tllog($::LOG_DEBUG, "\n%vars dumped to '$filename'.\n");
+ debug("\n%vars dumped to '$filename'.\n");
}
@@ -576,11 +546,11 @@ sub calc_depends {
# collect the already selected packages
my @pre_selected = keys %install;
- tllog($::LOG_DDEBUG, "initial number of installations: $#pre_selected\n");
+ ddebug("initial number of installations: $#pre_selected\n");
# loop over all the pre_selected and add them
foreach my $p (@pre_selected) {
- tllog($::LOG_DDEBUG, "pre_selected $p\n");
+ ddebug("pre_selected $p\n");
foreach my $p_dep ($tlpdb->get_package($p)->depends) {
if ($p_dep =~ m/^(.*)\.ARCH$/) {
my $foo = "$1";
@@ -601,7 +571,7 @@ sub calc_depends {
# check for newly selected packages
my @post_selected = keys %install;
- tllog($::LOG_DDEBUG, "number of post installations: $#post_selected\n");
+ ddebug("number of post installations: $#post_selected\n");
# set repeat condition
if ($#pre_selected != $#post_selected) {
@@ -634,7 +604,7 @@ sub load_tlpdb {
} else {
$master="$::installerdir";
}
- tllog($::LOG_NORMAL, "Loading $master/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName ...\n");
+ info("Loading $master/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName ...\n");
$tlpdb=TeXLive::TLPDB->new(root => "$master");
if (!defined($tlpdb)) {
die("Cannot load TeX Live Database from $master");
@@ -852,20 +822,20 @@ operations might be disturbed.\n\n";
my $perl_bindir="$TEXDIR/tlpkg/tlperl/bin";
my $perl_libdir="$TEXDIR/tlpkg/tlperl/lib";
- tllog($::LOG_DEBUG, "Prepending $plat_bindir to PATH\n");
+ debug("Prepending $plat_bindir to PATH\n");
$ENV{'PATH'}="$plat_bindir" . "$pathsep" . "$ENV{'PATH'}";
if (win32) {
- tllog($::LOG_DEBUG, "Prepending $perl_bindir to PATH\n");
+ debug("Prepending $perl_bindir to PATH\n");
$ENV{'PATH'}="$perl_bindir" . "$pathsep" . "$ENV{'PATH'}";
}
- tllog($::LOG_DEBUG, "\nNew PATH is now:\n");
+ debug("\nNew PATH is now:\n");
foreach my $dir (split $pathsep, $ENV{'PATH'}) {
- tllog($::LOG_DEBUG, " $dir\n");
+ debug(" $dir\n");
}
- tllog($::LOG_DEBUG, "\n");
+ debug("\n");
if (win32) {
#$ENV{'PATHEXT'}=".texlua;" . "$ENV{'PATHEXT'}";
@@ -883,7 +853,7 @@ operations might be disturbed.\n\n";
foreach my $package (sort keys %install) {
if ($install{$package} && defined($PostInstall{$package})) {
- tllog($::LOG_NORMAL, "running post install action for $package\n");
+ info("running post install action for $package\n");
&{$PostInstall{$package}}($TEXDIR, $TEXMFSYSVAR, $TEXMFLOCAL);
}
}
@@ -892,7 +862,7 @@ operations might be disturbed.\n\n";
# Step 4: run the programs
if (!$opt_portable) {
- tllog($::LOG_NORMAL, "running mktexlsr $TEXDIR/texmf-dist $TEXDIR/texmf\n");
+ info("running mktexlsr $TEXDIR/texmf-dist $TEXDIR/texmf\n");
system('mktexlsr', "$TEXDIR/texmf-dist", "$TEXDIR/texmf");
}
@@ -900,38 +870,38 @@ operations might be disturbed.\n\n";
# texconfig generate * but Win32 does not have texconfig. But we have
# $localtlpdb and this is simple code, so do it directly, i.e., duplicate
# the code from the various generate-*.pl scripts
- tllog($::LOG_NORMAL, "writing fmtutil.cnf data to $TEXMFSYSVAR/web2c/fmtutil.cnf\n");
+ info("writing fmtutil.cnf data to $TEXMFSYSVAR/web2c/fmtutil.cnf\n");
TeXLive::TLUtils::create_fmtutil($localtlpdb,
"$TEXMFSYSVAR/web2c/fmtutil.cnf",
"$TEXMFLOCAL/web2c/fmtutil-local.cnf");
- tllog($::LOG_NORMAL, "writing updmap.cfg to $TEXMFSYSVAR/web2c/updmap.cfg\n");
+ info("writing updmap.cfg to $TEXMFSYSVAR/web2c/updmap.cfg\n");
TeXLive::TLUtils::create_updmap ($localtlpdb,
"$TEXMFSYSVAR/web2c/updmap.cfg",
"$TEXMFLOCAL/web2c/updmap-local.cfg");
- tllog($::LOG_NORMAL, "writing language.dat data to $TEXMFSYSVAR/tex/generic/config/language.dat\n");
+ info("writing language.dat data to $TEXMFSYSVAR/tex/generic/config/language.dat\n");
TeXLive::TLUtils::create_language($localtlpdb,
"$TEXMFSYSVAR/tex/generic/config/language.dat",
"$TEXMFLOCAL/tex/generic/config/language-local.dat");
- tllog($::LOG_NORMAL, "running updmap-sys\n");
+ info("running updmap-sys\n");
system('updmap-sys', '--nohash');
- tllog($::LOG_NORMAL, "re-running mktexlsr $TEXMFSYSVAR\n");
+ info("re-running mktexlsr $TEXMFSYSVAR\n");
system('mktexlsr', "$TEXMFSYSVAR");
# now work through the options if specified at all
# letter instead of a4
if ($vars{'option_letter'}) {
- tllog($::LOG_NORMAL, "Setting default paper size to letter\n");
+ info("Setting default paper size to letter\n");
system("texlua", "$TEXDIR/texmf/scripts/texlive/texconf.tlu", "--sys", "--noformat", "paper", "letter");
}
# all formats option
if ($vars{'option_fmt'}) {
- tllog($::LOG_NORMAL, "pre-generation all format file (fmtutil-sys --all)\n");
+ info("pre-generation all format file (fmtutil-sys --all)\n");
system('fmtutil-sys','--all');
}
@@ -941,30 +911,30 @@ operations might be disturbed.\n\n";
my @files;
mkdirhier $vars{'sys_bin'};
if (-w $vars{'sys_bin'}) {
- tllog($::LOG_NORMAL, "linking binaries to $vars{'sys_bin'}\n");
+ info("linking binaries to $vars{'sys_bin'}\n");
@files = `ls $plat_bindir`;
chomp(@files);
`cd "$vars{'sys_bin'}" && rm -f @files`;
`ln -s "$plat_bindir/"* "$vars{'sys_bin'}"`;
} else {
- tllog($::LOG_NORMAL, "destination of bin symlink $vars{'sys_bin'} not writable, no linking of bin files done!\n");
+ info("destination of bin symlink $vars{'sys_bin'} not writable, no linking of bin files done!\n");
}
if ($vars{'option_doc'}) {
# info files
mkdirhier $vars{'sys_info'};
if (-w $vars{'sys_info'}) {
- tllog($::LOG_NORMAL, "linking info pages to $vars{'sys_info'}\n");
+ info("linking info pages to $vars{'sys_info'}\n");
@files = `ls "$TEXDIR/texmf/doc/info"`;
chomp(@files);
`cd "$vars{'sys_info'}" && rm -f @files`;
`ln -s "$TEXDIR/texmf/doc/info/"*info* "$vars{'sys_info'}"`;
} else {
- tllog($::LOG_NORMAL, "destination of info symlink $vars{'sys_info'} not writable, no linking of info files done!\n");
+ info("destination of info symlink $vars{'sys_info'} not writable, no linking of info files done!\n");
}
# man files
mkdirhier $vars{'sys_man'};
if (-w $vars{'sys_man'}) {
- tllog($::LOG_NORMAL, "linking man pages to $vars{'sys_man'}\n");
+ info("linking man pages to $vars{'sys_man'}\n");
my $foo = `(cd "$TEXDIR/texmf/doc/man" && echo *)`;
my @mans = split ' ', $foo;
chomp(@mans);
@@ -979,7 +949,7 @@ operations might be disturbed.\n\n";
`ln -s "$mandir/"* "$vars{'sys_man'}/$m"`;
}
} else {
- tllog($::LOG_NORMAL, "destination of man symlink $vars{'sys_man'} not writable, no linking of man files done!\n");
+ info("destination of man symlink $vars{'sys_man'} not writable, no linking of man files done!\n");
}
}
}
diff --git a/Master/texmf/scripts/texlive/generate-fmtutil.pl b/Master/texmf/scripts/texlive/generate-fmtutil.pl
index 19824aaa11f..afd26f9d439 100755
--- a/Master/texmf/scripts/texlive/generate-fmtutil.pl
+++ b/Master/texmf/scripts/texlive/generate-fmtutil.pl
@@ -23,27 +23,23 @@ use strict;
use TeXLive::TLConfig;
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
-use TeXLive::TLUtils qw/kpsewhich tllog/;
+use TeXLive::TLUtils qw/kpsewhich/;
use Getopt::Long;
use Pod::Usage;
use File::Path;
-my $opt_debug = 0;
my $help = 0;
my $dest = "";
my $localconf = "";
our $master;
-GetOptions("debug!", "dest=s" => \$dest,
+TeXLive::TLUtils::process_logging_options();
+
+GetOptions("dest=s" => \$dest,
"local=s" => \$localconf, "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
@@ -55,7 +51,7 @@ sub main
}
$dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/fmtutil.cnf");
$localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/fmtutil-local.cnf");
- tllog($::LOG_NORMAL, "writing fmtutil.cnf data to $dest\n");
+ info("writing fmtutil.cnf data to $dest\n");
TeXLive::TLUtils::create_fmtutil($tlpdb, $dest, $localconf);
}
diff --git a/Master/texmf/scripts/texlive/generate-language.pl b/Master/texmf/scripts/texlive/generate-language.pl
index 0077dfa1a78..f79adf0e085 100755
--- a/Master/texmf/scripts/texlive/generate-language.pl
+++ b/Master/texmf/scripts/texlive/generate-language.pl
@@ -23,27 +23,23 @@ use strict;
use TeXLive::TLConfig;
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
-use TeXLive::TLUtils qw/kpsewhich tllog/;
+use TeXLive::TLUtils qw/kpsewhich/;
use Getopt::Long;
use Pod::Usage;
use File::Path;
our $master;
-my $opt_debug = 0;
my $help = 0;
my $dest = "";
my $localconf = "";
-GetOptions("debug!", "dest=s" => \$dest,
+TeXLive::TLUtils::process_logging_options();
+
+GetOptions("dest=s" => \$dest,
"local=s" => \$localconf, "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
@@ -58,7 +54,7 @@ sub main
. "/tex/generic/config/language-local.dat"
if ! $localconf;
- tllog ($::LOG_NORMAL, "$0: writing language data to $dest\n");
+ info("$0: writing language data to $dest\n");
TeXLive::TLUtils::create_language ($tlpdb, $dest, $localconf);
}
diff --git a/Master/texmf/scripts/texlive/generate-updmap.pl b/Master/texmf/scripts/texlive/generate-updmap.pl
index 10b22bfffa4..aaa19748714 100755
--- a/Master/texmf/scripts/texlive/generate-updmap.pl
+++ b/Master/texmf/scripts/texlive/generate-updmap.pl
@@ -23,27 +23,23 @@ use strict;
use TeXLive::TLConfig;
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
-use TeXLive::TLUtils qw/kpsewhich tllog/;
+use TeXLive::TLUtils qw/kpsewhich/;
use Getopt::Long;
use Pod::Usage;
use File::Path;
our $master;
-my $opt_debug = 0;
my $help = 0;
my $dest = "";
my $localconf = "";
-GetOptions("debug!", "dest=s" => \$dest, "local=s" => \$localconf,
+TeXLive::TLUtils::process_logging_options();
+
+GetOptions("dest=s" => \$dest, "local=s" => \$localconf,
"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
@@ -52,7 +48,7 @@ sub main
my $tlpdb = TeXLive::TLPDB->new ("root" => "$master");
$dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/updmap.cfg");
$localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/updmap-local.cfg");
- tllog($::LOG_NORMAL, "$0: writing new updmap.cfg to $dest\n");
+ info("$0: writing new updmap.cfg to $dest\n");
TeXLive::TLUtils::create_updmap ($tlpdb, $dest, $localconf);
}
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 64023a72e5f..93f3212e5ed 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -47,16 +47,17 @@ my $location;
# option handling
my $opt_location;
my $opt_help = 0;
-my $opt_debug = 0;
my $opt_netarchive;
my $opt_diskarchive;
my $opt_gui = 0;
+TeXLive::TLUtils::process_logging_options();
+
GetOptions("location=s" => \$opt_location,
"netarchive=s" => \$opt_netarchive,
"diskarchive=s" => \$opt_diskarchive,
"gui" => \$opt_gui,
- "debug!", "h|help|?" => \$opt_help) or pod2usage(2);
+ "h|help|?" => \$opt_help) or pod2usage(2);
my $action = shift;
@@ -78,11 +79,6 @@ if ($^O=~/^MSWin(32|64)$/i) {
pod2usage(-exitstatus => 0, -verbose => 2) if $opt_help;
}
-if ($opt_debug) {
- $::LOGLEVELFILE = $::LOG_DDDEBUG;
- $::LOGLEVELTERMINAL = $::LOG_DDDEBUG;
-}
-
my $loadmediasrcerror = "Cannot load TeX Live Database from ";
my %ret;
@@ -243,7 +239,7 @@ sub remove_package {
$localtlpdb->save;
# do the post removal actions
if (defined($PostRemove{$pkg})) {
- tllog($::LOG_NORMAL, "running post remove action for $pkg\n");
+ info("running post remove action for $pkg\n");
&{$PostRemove{$pkg}}($localtlpdb->root);
}
}
@@ -829,17 +825,17 @@ sub action_generate {
if ($what =~ m/^language$/i) {
$dest || ($dest = kpsewhich ("TEXMFSYSVAR") . "/tex/generic/config/language.dat");
$localconf || ($localconf = kpsewhich ("TEXMFLOCAL") . "/tex/generic/config/language-local.dat");
- tllog ($::LOG_NORMAL, "$0: writing language data to $dest\n");
+ info("$0: writing language data to $dest\n");
TeXLive::TLUtils::create_language ($localtlpdb, $dest, $localconf);
} elsif ($what =~ m/^fmtutil$/i) {
$dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/fmtutil.cnf");
$localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/fmtutil-local.cnf");
- tllog($::LOG_NORMAL, "writing fmtutil.cnf data to $dest\n");
+ info("writing fmtutil.cnf data to $dest\n");
TeXLive::TLUtils::create_fmtutil($localtlpdb, $dest, $localconf);
} elsif ($what =~ m/^updmap$/i) {
$dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/updmap.cfg");
$localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/updmap-local.cfg");
- tllog($::LOG_NORMAL, "$0: writing new updmap.cfg to $dest\n");
+ info("$0: writing new updmap.cfg to $dest\n");
TeXLive::TLUtils::create_updmap ($localtlpdb, $dest, $localconf);
} else {
die "Unknown option for generate: $what";
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;