summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-04-20 00:18:04 +0000
committerNorbert Preining <preining@logic.at>2012-04-20 00:18:04 +0000
commitd2a6347bcd4b494ecae96cc52e563ce813748430 (patch)
tree072e03e828428a606c6501f8484dea801a6fddf7 /Master/texmf
parent0df0ee6e5986980afc9c9b5b6b265bc5a3c3a638 (diff)
tlmgr: change $0 -> $prg (short name of the program)
add confirmation message after adding/removing a repository git-svn-id: svn://tug.org/texlive/trunk@26063 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl49
1 files changed, 30 insertions, 19 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 47796474fb4..2c731c7ab4a 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -8,6 +8,7 @@
my $svnrev = '$Revision$';
my $datrev = '$Date$';
my $tlmgrrevision;
+my $prg;
if ($svnrev =~ m/: ([0-9]+) /) {
$tlmgrrevision = $1;
} else {
@@ -87,6 +88,10 @@ TeXLive::TLUtils->import(qw(member info give_ctan_mirror win32 dirname
mkdirhier copy log debug tlcmp));
use TeXLive::TLPaper;
+#
+# set up $prg for warning messages
+$prg = TeXLive::TLUtils::basename($0);
+
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
@@ -266,7 +271,7 @@ sub main {
}
if ((!defined($action) || !$action) && !$opts{"help"} && !$opts{"h"}) {
- die "$0: missing action; try --help if you need it.\n";
+ die "$prg: missing action; try --help if you need it.\n";
}
if ($opts{"help"} || $opts{"h"}) {
@@ -558,7 +563,7 @@ sub execute_action {
action_recreate_tlpdb();
finish(0);
} else {
- die "$0: unknown action: $action; try --help if you need it.\n";
+ die "$prg: unknown action: $action; try --help if you need it.\n";
}
# close the special log file
@@ -2299,7 +2304,7 @@ sub action_update {
if ( !$dry_run_cont && !$opts{"self"} && @critical) {
critical_updates_warning();
if ($opts{"force"}) {
- tlwarn("$0: Continuing due to --force.\n");
+ tlwarn("$prg: Continuing due to --force.\n");
} elsif ($opts{"list"}) {
# do not warn here
} else {
@@ -2307,7 +2312,7 @@ sub action_update {
# return here and don't do any updates
return;
} else {
- die "$0: Exiting, please read above warning.\n";
+ die "$prg: Exiting, please read above warning.\n";
}
}
}
@@ -2906,7 +2911,7 @@ sub action_update {
"__BACKUP_${pkg}.r" . $tlp->revision,
$tlp->relocated);
if ($s <= 0) {
- tlwarn("\n$0: Creation of backup container of $pkg failed.\n");
+ tlwarn("\n$prg: Creation of backup container of $pkg failed.\n");
tlwarn("Continuing to update other packages, please retry...\n");
# we should try to update other packages at least
next;
@@ -3045,7 +3050,7 @@ sub action_update {
logpackage("auto-install new: $pkg ($mediarevstr)");
$nrupdated++;
} else {
- tlwarn("$0: couldn't install new package $pkg\n");
+ tlwarn("$prg: couldn't install new package $pkg\n");
}
}
}
@@ -3525,13 +3530,13 @@ sub action_repository {
if ($what eq "add") {
my $p = shift @ARGV;
if (!defined($p)) {
- tlwarn("You need to give a new repository aas argument to add\n");
+ tlwarn("$prg: you need to give a new repository as argument to add\n");
return;
}
my $t = shift @ARGV;
$t = $p if (!defined($t));
if (defined($repos{$t})) {
- tlwarn("This repository or its tag is already defined, no action\n");
+ tlwarn("$prg: this repository or its tag is already defined, no action\n");
return;
}
# TODO more checks needed?
@@ -3550,6 +3555,11 @@ sub action_repository {
$repos{$t} = $p;
$localtlpdb->option("location", array_to_repository(%repos));
$localtlpdb->save;
+ if ($t eq $p) {
+ print "$prg: added repository $p\n";
+ } else {
+ print "$prg: added repository `$t' for `$p'\n";
+ }
return;
}
if ($what eq "remove") {
@@ -3570,6 +3580,7 @@ sub action_repository {
} else {
$localtlpdb->option("location", array_to_repository(%repos));
$localtlpdb->save;
+ print "$prg: removed repository `$p'\n";
}
return;
}
@@ -3969,7 +3980,7 @@ sub action_generate {
$dest .= ".dat.lua" if $append_extension;
my $localcfg = $opts{"localcfg"} ||
"$TEXMFLOCAL/tex/generic/config/language-local.dat.lua";
- debug("$0: writing language.dat.lua data to $dest\n");
+ debug("$prg: writing language.dat.lua data to $dest\n");
TeXLive::TLUtils::create_language_lua($localtlpdb, $dest, $localcfg);
if ($opts{"rebuild-sys"}) {
do_cmd_and_check("fmtutil-sys --byhyphen $dest");
@@ -3984,7 +3995,7 @@ sub action_generate {
$dest .= ".dat" if $append_extension;
my $localcfg = $opts{"localcfg"} ||
"$TEXMFLOCAL/tex/generic/config/language-local.dat";
- debug ("$0: writing language.dat data to $dest\n");
+ debug ("$prg: writing language.dat data to $dest\n");
TeXLive::TLUtils::create_language_dat($localtlpdb, $dest, $localcfg);
if ($opts{"rebuild-sys"}) {
do_cmd_and_check("fmtutil-sys --byhyphen $dest");
@@ -3999,7 +4010,7 @@ sub action_generate {
$dest .= ".def" if $append_extension;
my $localcfg = $opts{"localcfg"} ||
"$TEXMFLOCAL/tex/generic/config/language-local.def";
- debug("$0: writing language.def data to $dest\n");
+ debug("$prg: writing language.def data to $dest\n");
TeXLive::TLUtils::create_language_def($localtlpdb, $dest, $localcfg);
if ($opts{"rebuild-sys"}) {
do_cmd_and_check("fmtutil-sys --byhyphen $dest");
@@ -4012,7 +4023,7 @@ sub action_generate {
} elsif ($what =~ m/^fmtutil$/i) {
my $dest = $opts{"dest"} || "$TEXMFSYSVAR/web2c/fmtutil.cnf";
my $localcfg = $opts{"localcfg"} || "$TEXMFLOCAL/web2c/fmtutil-local.cnf";
- debug("$0: writing new fmtutil.cnf to $dest\n");
+ debug("$prg: writing new fmtutil.cnf to $dest\n");
TeXLive::TLUtils::create_fmtutil($localtlpdb, $dest, $localcfg);
if ($opts{"rebuild-sys"}) {
@@ -4025,7 +4036,7 @@ sub action_generate {
} elsif ($what =~ m/^updmap$/i) {
my $dest = $opts{"dest"} || "$TEXMFSYSCONFIG/web2c/updmap.cfg";
my $localcfg = $opts{"localcfg"} || "$TEXMFLOCAL/web2c/updmap-local.cfg";
- debug("$0: writing new updmap.cfg to $dest\n");
+ debug("$prg: writing new updmap.cfg to $dest\n");
TeXLive::TLUtils::create_updmap($localtlpdb, $dest, $localcfg);
if ($opts{"rebuild-sys"}) {
@@ -4036,7 +4047,7 @@ sub action_generate {
}
} else {
- die "$0: Unknown option for generate: $what; try --help if you need it.\n";
+ die "$prg: Unknown option for generate: $what; try --help if you need it.\n";
}
return;
@@ -5002,7 +5013,7 @@ sub init_tlmedia
# check that there is a main repository
if (!TeXLive::TLUtils::member('main', @tags)) {
- tldie("$0: Cannot find main repository, you have to tag one as main!\n");
+ tldie("$prg: Cannot find main repository, you have to tag one as main!\n");
}
# TODO TODO
@@ -5173,14 +5184,14 @@ END_NO_INTERNET
my $texlive_release = $remotetlpdb->config_release;
my $texlive_minrelease = $remotetlpdb->config_minrelease;
if (!defined($texlive_release)) {
- tldie("$0: The installation repository does not specify a "
+ tldie("$prg: The installation repository does not specify a "
. "release year for which it was prepared, goodbye.\n");
}
# still here, so we have $texlive_release defined
my $texlive_release_year = $texlive_release;
$texlive_release_year =~ s/^(....).*$/$1/;
if ($texlive_release_year !~ m/^[1-9][0-9][0-9][0-9]$/) {
- tldie("$0: The installation repository does not specify a "
+ tldie("$prg: The installation repository does not specify a "
. "valid release year, goodbye: $texlive_release\n");
}
# so $texlive_release_year is numeric, good
@@ -5196,7 +5207,7 @@ END_NO_INTERNET
if ($TeXLive::TLConfig::ReleaseYear < $texlive_minrelease_year
|| $TeXLive::TLConfig::ReleaseYear > $texlive_release_year) {
tldie <<END_BADRANGE
-$0: The TeX Live versions supported by the repository
+$prg: The TeX Live versions supported by the repository
($texlive_minrelease_year--$texlive_release_year)
do not include the version of the local installation
($TeXLive::TLConfig::ReleaseYear). Goodbye.
@@ -5206,7 +5217,7 @@ END_BADRANGE
# $texlive_minrelease not defined, so only one year is valid
if ($texlive_release_year != $TeXLive::TLConfig::ReleaseYear) {
tldie <<END_BADYEAR
-$0: The TeX Live versions of the local installation
+$prg: The TeX Live versions of the local installation
and the repository being accessed are not compatible:
local: $TeXLive::TLConfig::ReleaseYear
repository: $texlive_release_year