diff options
author | Norbert Preining <preining@logic.at> | 2008-01-10 10:53:59 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-01-10 10:53:59 +0000 |
commit | 5ab926badb5ad24f8b4b994ad5f18f0d2b3a6953 (patch) | |
tree | 09714be5b47fa1659d69008e5fb3e574f5e106d7 /Master/install-tl.pl | |
parent | fdf785af06cac0cef5125a27f55f2b12bacb6d9a (diff) |
add logging facilities, see extra email
git-svn-id: svn://tug.org/texlive/trunk@6176 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl.pl')
-rwxr-xr-x | Master/install-tl.pl | 93 |
1 files changed, 68 insertions, 25 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl index 590c19fc0ca..1a18e5b0a8e 100755 --- a/Master/install-tl.pl +++ b/Master/install-tl.pl @@ -6,6 +6,7 @@ # Copyright 2007 2008 Reinhard Kotucha, Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. +# our $texlive_release="2008"; @@ -33,10 +34,10 @@ BEGIN { } use TeXLive::TLUtils qw(initialize_installer media platform platform_desc - debug which getenv win32 unix program_exists architectures_available + which getenv win32 unix program_exists architectures_available additional_architectures_available_from_net get_system_tmpdir member mkdirhier make_var_skeleton make_local_skeleton install_package copy - install_packages dirname); + install_packages dirname tllog); use TeXLive::TLPOBJ; use TeXLive::TLPDB; use TeXLive::TLConfig qw($DefaultContainerExtension $InfraLocation); @@ -44,7 +45,15 @@ use Getopt::Long; use strict; -# used variables +# 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 +# +$::LOGLEVELFILE = $::LOG_NORMAL; +$::LOGLEVELTERMINAL = $::LOG_NORMAL; # # $install{$packagename} == 1 if it should be installed my %install; @@ -97,6 +106,11 @@ my $opt_url = ""; my $opt_profile = ""; my $opt_no_cls=0; my $opt_gui = 0; +my $opt_debug = 0; +my $opt_ddebug = 0; +my $opt_dddebug = 0; +my $opt_quiet = 0; +my $opt_qquiet = 0; $::netarchive = "archive"; $::diskarchive = "archive"; @@ -106,8 +120,38 @@ GetOptions("media=s" => \$opt_media, "gui", \$opt_gui, "netarchive=s" => \$::netarchive, "diskarchive=s" => \$::diskarchive, + "d" => \$opt_debug, + "dd" => \$opt_ddebug, + "ddd" => \$opt_dddebug, + "q" => \$opt_quiet, + "qq" => \$opt_qquiet, "url=s" => \$opt_url ) or die("No pod doc till now!"); +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; +} +# try to open a log file +if ($::LOGLEVELFILE > $::LOG_ZERO) { + if (open(LOGF,">install-tl.log")) { + $::LOGFILE = \*LOGF; + } else { + warn("Cannot create log file install-tl.log: $!\nContinuing without log file!\n"); + $::LOGLEVELFILE = $::LOG_ZERO; + } +} if ("$opt_media" =~ m/^CD/i) { $::_media_ = "CD"; } elsif ("$opt_media" =~ m/^NET/i) { @@ -118,10 +162,10 @@ if ("$opt_media" =~ m/^CD/i) { if ("$opt_profile" ne "") { if (-r "$opt_profile") { - print "Using automated installation using $opt_profile!\n"; + tllog($::LOG_NORMAL, "Using automated installation using $opt_profile!"); } else { $opt_profile = ""; - warn "Profile $opt_profile not readable, continuing in interactive mode!\n"; + tllog($::LOG_NORMAL, "Profile $opt_profile not readable, continuing in interactive mode!"); } } @@ -137,19 +181,18 @@ my $localtlpdb; my $system_tmpdir=get_system_tmpdir(); -print "Platform: ", platform, " => \'", platform_desc(platform), "\'\n"; -print "Distribution: "; +tllog($::LOG_NORMAL, "Platform: ", platform, " => \'", platform_desc(platform), "\'\n"); if (media() eq "DVD") { - print "live (uncompressed)\n"; + tllog($::LOG_NORMAL, "Distribution: live (uncompressed)\n"); } elsif (media() eq "CD") { - print "inst (compressed)\n"; + tllog($::LOG_NORMAL, "Distribution: inst (compressed)\n"); } elsif (media() eq "NET") { - print "net (downloading)\n"; + tllog($::LOG_NORMAL, "Distribution: net (downloading)\n"); } else { - print media(), "\n"; + tllog($::LOG_NORMAL, "Distribution: ", media(), "\n"); } -print "Directory for Temporary Files: '", $system_tmpdir, "\'\n"; -print "Installer Directory: '$::installerdir'\n"; +tllog($::LOG_NORMAL, "Directory for Temporary Files: '", $system_tmpdir, "\'\n"); +tllog($::LOG_NORMAL, "Installer Directory: '$::installerdir'\n"); initialize_installer(); load_tlpdb(); @@ -178,10 +221,10 @@ if ($opt_profile eq "") { eval { require Tk; }; if ($@) { # that didn't work out, so warn the user and continue with text mode - warn "Cannot load Tk, maybe something is missing!\n"; - warn "Error message from loading Tk:\n"; - warn "$@"; - warn "Continuing in Text Mode...\n"; + 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"); $opt_gui = 0; } } @@ -202,7 +245,7 @@ if ($opt_profile eq "") { exit(2); } if ($ret != $MENU_INSTALL) { - warn "Unknown return value of run_menu: $ret\n"; + tllog($::LOG_NORMAL, "Unknown return value of run_menu: $ret\n"); exit(3); } } else { @@ -220,10 +263,10 @@ do_postinst_stuff(); dump_vars("$system_tmpdir/texlive.vars"); # if we installed from a profile we don't need to write it out if (-r "$vars{'TEXDIR'}/$InfraLocation/texlive.profile") { - warn "Not overwriting already present profile in $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n"; + tllog($::LOG_NORMAL, "Not overwriting already present profile in $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n"); } else { create_profile("$vars{'TEXDIR'}/$InfraLocation/texlive.profile"); - print "Profile written to $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n"; + tllog($::LOG_DEBUG, "Profile written to $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n"); } exit(0); @@ -359,11 +402,11 @@ sub calc_depends { # collect the already selected packages my @pre_selected = keys %install; - debug "initial number of installations: $#pre_selected\n"; + tllog($::LOG_DDEBUG, "initial number of installations: $#pre_selected\n"); # loop over all the pre_selected and add them foreach my $p (@pre_selected) { - debug "pre_selected $p\n"; + tllog($::LOG_DDEBUG, "pre_selected $p\n"); foreach my $p_dep ($tlpdb->get_package($p)->depends) { if ($p_dep =~ m/^(.*)\.ARCH$/) { my $foo = "$1"; @@ -384,7 +427,7 @@ sub calc_depends { # check for newly selected packages my @post_selected = keys %install; - debug "number of post installations: $#post_selected\n"; + tllog($::LOG_DDEBUG, "number of post installations: $#post_selected\n"); # set repeat condition if ($#pre_selected != $#post_selected) { @@ -417,7 +460,7 @@ sub load_tlpdb { } else { $master="$::installerdir"; } - print "Loading $master/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName ...\n"; + tllog($::LOG_NORMAL, "Loading $master/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName ...\n"); $tlpdb=TeXLive::TLPDB->new(root => "$master"); } @@ -765,7 +808,7 @@ sub do_win_registry_magic { # but with different registry pathes $classespath = "LMachine/Software/Classes/"; } else { - warn "non-admin users: no Path and PATHEXT setting possible.\n"; + tllog($::LOG_NORMAL, "non-admin users: no Path and PATHEXT setting possible.\n"); # for non-admin users the classes path is different # (Siep, email 2008-01-09) $classespath = "Users/Software/Classes/"; |