summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-12-23 01:13:28 +0000
committerKarl Berry <karl@freefriends.org>2008-12-23 01:13:28 +0000
commit7697a7c562a9e86822df3d004ff4374a4215896b (patch)
treeb135eb59a1e6d339e0f9f6753f61743ea2fa8409
parentb49e41c5e8dbcb5ef1dd605f7fb7bd6b7ada9648 (diff)
doc tweaks, source rearrangement
git-svn-id: svn://tug.org/texlive/trunk@11695 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr2.pl69
1 files changed, 34 insertions, 35 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl
index ae06725cae6..b31e74fca69 100755
--- a/Master/texmf/scripts/texlive/tlmgr2.pl
+++ b/Master/texmf/scripts/texlive/tlmgr2.pl
@@ -95,20 +95,11 @@ our %papersetting_subs;
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
-# global variable that specifies if a call to finish() should actually
-# finish the program or immediately return
-$::gui_mode = 0;
-
-# used variables
-# the TLMedia from which we install/update
-our $tlmediasrc;
+our $tlmediasrc; # media from which we install/update
our $tlmediatlpdb;
-# the local tlpdb
-our $localtlpdb;
-# a hash for saving the options saved into the local tlpdb
-my %options;
-# the location from where we install
-our $location;
+our $location; # location from which the new packages come
+our $localtlpdb; # local installation which we are munging
+my %options; # TL options from local tlpdb
# flags for machine readable form
our $FLAG_REMOVE = "d";
@@ -118,6 +109,7 @@ our $FLAG_REVERSED_UPDATE = "r";
our $FLAG_AUTOINSTALL = "a";
# option variables
+$::gui_mode = 0;
$::machinereadable = 0;
my %globaloptions = (
@@ -314,6 +306,8 @@ sub execute_action {
# use GetOption
@ARGV = @argv;
+ # actions which shouldn't have any lasting effects, such as search or
+ # list, end by calling finish(0), which skips postinstall actions.
if ($action =~ m/^_include_tlpobj$/) {
# this is an internal function that should not be used outside
init_local_db();
@@ -357,7 +351,7 @@ sub execute_action {
finish(0);
} elsif ($action =~ m/^get-mirror$/i) {
my $loc = give_ctan_mirror();
- print("$loc\n");
+ print "$loc\n";
finish(0);
} elsif ($action =~ m/^generate$/i) {
merge_into(\%ret, action_generate());
@@ -367,11 +361,9 @@ sub execute_action {
merge_into(\%ret, action_arch());
} elsif ($action =~ m/^option$/i) {
merge_into(\%ret, action_option());
- # should we do postinstall stuff?
finish(0);
} elsif ($action =~ m/^list$/i) {
merge_into(\%ret, action_list());
- # should we do postinstall stuff?
finish(0);
} elsif ($action =~ m/^check$/i) {
merge_into(\%ret, action_check());
@@ -399,25 +391,26 @@ sub execute_action {
} else {
die "$0: unknown action: $action; try --help if you need it.\n";
}
+
# close the special log file
if ($packagelogfile && !$::gui_mode) {
info("tlmgr: package log updated at $packagelogfile\n") if $packagelogged;
close(PACKAGELOG);
}
+
# run external programs.
my $error_count = &handle_ret_hash(%ret);
+
# done, just in case there are 256 errors.
finish($error_count ? 1 : 0);
}
-
#
# run external programs based on the RET hash we've accumulated.
# We return the number of unsuccessful runs, zero if all went well.
#
-sub handle_ret_hash
-{
+sub handle_ret_hash {
my (%ret) = @_;
my $errors = 0;
@@ -720,7 +713,8 @@ sub action_remove {
}
}
-# action_paper
+
+# PAPER
# ARGV can look like:
# paper a4
# paper letter
@@ -743,9 +737,9 @@ sub action_paper {
my $action = shift @ARGV;
if ($action =~ m/^paper$/i) {
my $newpaper = shift @ARGV;
- if (!defined($newpaper) ||
- (($newpaper ne "a4") && ($newpaper ne "letter"))) {
- tlwarn("tlmgr paper needs an argument: a4 | letter\n");
+ if (!defined($newpaper) || $newpaper !~ /^(a4|letter)$/) {
+ $newpaper = "the empty string." if !defined($newpaper);
+ tlwarn("tlmgr: paper expects a4 or letter, not $newpaper\n");
return;
}
# output is done to the path components as given in
@@ -753,6 +747,7 @@ sub action_paper {
# in %default_paper_config_path_component;
# together with the tree as given in the first argument of paper_*
merge_into(\%ret, paper_all($texmfsysconfig, $newpaper));
+ #karl: merge_into(\%ret, TeXLive::TLPaper:paper_all($texmfsysconfig, $newpaper));
} else {
# now we have as first argument a program
my $prog = $action;
@@ -762,7 +757,8 @@ sub action_paper {
# see above for the selection of the output
# if we want to change the output the value in %paper_config_path_component
# has to be changed
- merge_into( \%ret, &{$papersetting_subs{$prog}}($texmfsysconfig, @ARGV));
+ merge_into(\%ret, &{$papersetting_subs{$prog}}($texmfsysconfig, @ARGV));
+ #karl: merge_into(\%ret,TeXLive::TLPaper::paper_sub($prog,$texmfsysconfig,@ARGV));
}
if ($localtlpdb->option_create_formats) {
$ret{"format"} = 1;
@@ -771,6 +767,8 @@ sub action_paper {
}
+# SHOW
+#
sub action_show {
if ($opts{"gui"}) {
action_gui("config");
@@ -854,6 +852,9 @@ sub action_show {
return;
}
+
+# SEARCH
+#
sub action_search {
my %ret;
tlwarn("machine-readable output not supported for search\n")
@@ -2595,17 +2596,6 @@ sub init_tlmedia {
}
}
-# the logpackage function
-# if the packagelog variable is set then write to PACKAGELOG filehandle
-#
-sub logpackage {
- if ($packagelogfile) {
- $packagelogged++;
- my $tim = localtime();
- print PACKAGELOG "[$tim] @_\n";
- }
-}
-
# finish # evaluates only the -pause option, and then exits
# if the global $::gui_mode is set to 1 then the not exit, but return is called
#
@@ -2628,6 +2618,15 @@ sub finish {
}
}
+# if the packagelog variable is set then write to PACKAGELOG filehandle
+#
+sub logpackage {
+ if ($packagelogfile) {
+ $packagelogged++;
+ my $tim = localtime();
+ print PACKAGELOG "[$tim] @_\n";
+ }
+}
# clear the backup dir for $pkg and keep only $autobackup packages
# mind that with $autobackup == 0 all packages are cleared