summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texlive/tlmgr.pl
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-05-23 05:01:58 +0000
committerNorbert Preining <preining@logic.at>2012-05-23 05:01:58 +0000
commited64153cb6d4b37b71ccc90c0d831943323ddeed (patch)
treecf20c1187972ffb1131a8762b5fdeefea2bb3df3 /Master/texmf/scripts/texlive/tlmgr.pl
parente4d44d22b1f2a5da029d33fe38762067700bf097 (diff)
tlmgr and tlmgrgui updates:
- (gui) make a few more strings translateable - (gui) allow selection English as GUI language - (gui) show GUI language selection also on Windows (in expert mode) - (text) proper return codes with error msgs from init_tlmedia - (gui) show warning window when loading of remote tlpdb does not work git-svn-id: svn://tug.org/texlive/trunk@26587 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/scripts/texlive/tlmgr.pl')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl82
1 files changed, 50 insertions, 32 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index cd78e6c1425..181ff6702c4 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -1113,7 +1113,7 @@ sub action_dumptlpdb {
$localtlpdb->writeout;
} elsif ($opts{"remote"} && !$opts{"local"}) {
- init_tlmedia();
+ init_tlmedia_or_die();
$remotetlpdb->writeout;
} else {
@@ -1156,7 +1156,7 @@ sub action_info {
my $installed = 0;
if (!$tlp) {
if (!$remotetlpdb) {
- init_tlmedia();
+ init_tlmedia_or_die();
}
if (defined($tag)) {
if (!$remotetlpdb->is_virtual) {
@@ -1225,7 +1225,7 @@ sub action_info {
if (!@colls) {
# not referenced in the local tlpdb, so try the remote here, too
if (!$remotetlpdb) {
- init_tlmedia();
+ init_tlmedia_or_die();
}
@colls = $remotetlpdb->needed_by($pkg);
}
@@ -1415,7 +1415,7 @@ sub action_search {
}
init_local_db();
if ($opts{"global"}) {
- init_tlmedia();
+ init_tlmedia_or_die();
$tlpdb = $remotetlpdb;
} else {
$tlpdb = $localtlpdb;
@@ -2259,7 +2259,7 @@ sub action_update {
return;
}
- init_tlmedia();
+ init_tlmedia_or_die();
info("update: dry run, no changes will be made\n") if $opts{"dry-run"};
my @excluded_pkgs = ();
@@ -3221,7 +3221,7 @@ sub action_install {
return if !check_on_writable();
# initialize the TLPDB from $location
$opts{"no-depends"} = 1 if $opts{"no-depends-at-all"};
- init_tlmedia();
+ init_tlmedia_or_die();
# check for updates to tlmgr itself, and die unless --force is given
if (check_for_critical_updates( $localtlpdb, $remotetlpdb)) {
@@ -3386,7 +3386,7 @@ sub show_list_of_packages {
if ($opts{"only-installed"}) {
$tlm = $localtlpdb;
} else {
- init_tlmedia();
+ init_tlmedia_or_die();
$tlm = $remotetlpdb;
}
my @whattolist;
@@ -3594,7 +3594,7 @@ sub action_candidates {
return;
}
init_local_db();
- init_tlmedia();
+ init_tlmedia_or_die();
my @cand = $remotetlpdb->candidates($what);
if (@cand) {
my $first = shift @cand;
@@ -3805,7 +3805,7 @@ sub action_platform {
if ($what =~ m/^list$/i) {
# list the available platforms
# initialize the TLPDB from $location
- init_tlmedia();
+ init_tlmedia_or_die();
my @already_installed_arch = $localtlpdb->available_architectures;
print "Available platforms:\n";
foreach my $a ($remotetlpdb->available_architectures) {
@@ -3820,7 +3820,7 @@ sub action_platform {
finish(0);
} elsif ($what =~ m/^add$/i) {
return if !check_on_writable();
- init_tlmedia();
+ init_tlmedia_or_die();
my @already_installed_arch = $localtlpdb->available_architectures;
my @available_arch = $remotetlpdb->available_architectures;
my @todoarchs;
@@ -4977,6 +4977,13 @@ sub init_local_db {
# initialize the global $remotetlpdb object, or die.
# uses the global $location.
#
+sub init_tlmedia_or_die {
+ my ($ret, $err) = init_tlmedia();
+ if (!$ret) {
+ tldie("$prg: $err");
+ }
+}
+
sub init_tlmedia
{
# first check if $location contains multiple locations
@@ -4995,14 +5002,13 @@ sub init_tlmedia
# check if we are only one tag/repo
if ($#tags == 0) {
# go to normal mode
- _init_tlmedia();
- return;
+ return _init_tlmedia();
}
# we are still here, so we have more tags
# check that there is a main repository
if (!TeXLive::TLUtils::member('main', @tags)) {
- tldie("$prg: Cannot find main repository, you have to tag one as main!\n");
+ return(0, "Cannot find main repository, you have to tag one as main!");
}
# TODO TODO
@@ -5012,11 +5018,17 @@ sub init_tlmedia
$remotetlpdb->make_virtual;
my $locstr = $repos{'main'};
- my $tlmdb = setup_one_remotetlpdb($locstr);
+ my ($tlmdb, $errormsg) = setup_one_remotetlpdb($locstr);
+ if (!defined($tlmdb)) {
+ return (0, $errormsg);
+ }
$remotetlpdb->virtual_add_tlpdb($tlmdb, "main");
for my $t (@tags) {
if ($t ne 'main') {
- my $tlmdb = setup_one_remotetlpdb($repos{$t});
+ my ($tlmdb, $errormsg) = setup_one_remotetlpdb($repos{$t});
+ if (!defined($tlmdb)) {
+ return(0, $errormsg);
+ }
$remotetlpdb->virtual_add_tlpdb($tlmdb, $t);
$locstr .= " $repos{$t}";
}
@@ -5052,6 +5064,7 @@ sub init_tlmedia
info("\t$t = " . $repos{$t} . "\n");
}
}
+ return 1;
}
@@ -5067,7 +5080,7 @@ sub _init_tlmedia
if (defined($remotetlpdb) && !$remotetlpdb->is_virtual &&
($remotetlpdb->root eq $location)) {
# nothing to be done
- return;
+ return 1;
}
# choose a mirror if we are asked.
@@ -5078,11 +5091,18 @@ sub _init_tlmedia
$location =~ s,^$TeXLiveServerURL,$mirrorbase,;
}
- $remotetlpdb = setup_one_remotetlpdb($location);
+ my $errormsg;
+ ($remotetlpdb, $errormsg) = setup_one_remotetlpdb($location);
+ if (!defined($remotetlpdb)) {
+ return(0, $errormsg);
+ }
+
+
# this "location-url" line should not be changed since GUI programs
# depend on it:
print "location-url\t$location\n" if $::machinereadable;
info("tlmgr: package repository $location\n");
+ return 1;
}
sub setup_one_remotetlpdb
@@ -5157,7 +5177,9 @@ END_NO_INTERNET
if (!$local_copy_tlpdb_used) {
$remotetlpdb = TeXLive::TLPDB->new(root => $location);
}
- die($loadmediasrcerror . $location) unless defined($remotetlpdb);
+ if (!defined($remotetlpdb)) {
+ return(undef, $loadmediasrcerror . $location);
+ }
# we allow a range of years to be specified by the remote tlpdb
# for which it might work.
# the lower limit is TLPDB->config_minrelease
@@ -5173,15 +5195,15 @@ END_NO_INTERNET
my $texlive_release = $remotetlpdb->config_release;
my $texlive_minrelease = $remotetlpdb->config_minrelease;
if (!defined($texlive_release)) {
- tldie("$prg: The installation repository does not specify a "
- . "release year for which it was prepared, goodbye.\n");
+ return(undef, "The installation repository does not specify a "
+ . "release year for which it was prepared, goodbye.");
}
# 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("$prg: The installation repository does not specify a "
- . "valid release year, goodbye: $texlive_release\n");
+ return(undef, "The installation repository does not specify a "
+ . "valid release year, goodbye: $texlive_release");
}
# so $texlive_release_year is numeric, good
if (defined($texlive_minrelease)) {
@@ -5189,29 +5211,25 @@ END_NO_INTERNET
my $texlive_minrelease_year = $texlive_minrelease;
$texlive_minrelease_year =~ s/^(....).*$/$1/;
if ($texlive_minrelease_year !~ m/^[1-9][0-9][0-9][0-9]$/) {
- tldie("The installation repository does not specify a "
- . "valid minimal release year, goodbye: $texlive_minrelease\n");
+ return(undef, "The installation repository does not specify a "
+ . "valid minimal release year, goodbye: $texlive_minrelease");
}
# ok, all numeric and fine, check for range
if ($TeXLive::TLConfig::ReleaseYear < $texlive_minrelease_year
|| $TeXLive::TLConfig::ReleaseYear > $texlive_release_year) {
- tldie <<END_BADRANGE
-$prg: The TeX Live versions supported by the repository
+ return (undef, "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.
-END_BADRANGE
+ ($TeXLive::TLConfig::ReleaseYear).");
}
} else {
# $texlive_minrelease not defined, so only one year is valid
if ($texlive_release_year != $TeXLive::TLConfig::ReleaseYear) {
- tldie <<END_BADYEAR
-$prg: The TeX Live versions of the local installation
+ return(undef, "The TeX Live versions of the local installation
and the repository being accessed are not compatible:
local: $TeXLive::TLConfig::ReleaseYear
repository: $texlive_release_year
-(Perhaps you need to use a different CTAN mirror?) Goodbye.
-END_BADYEAR
+(Perhaps you need to use a different CTAN mirror?).");
}
}