summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-09-08 00:39:55 +0000
committerNorbert Preining <preining@logic.at>2008-09-08 00:39:55 +0000
commit9621e434d9761f6ac4ce266ebef804a2d2df41df (patch)
tree4b7cf662a09ea8586e7d30ff49e4439640b7ae79
parent65c07f74b13cbde436acaadd491b569161ec7eeb (diff)
fix tlmgr and tlmgrgui to use a fixed ctan mirror (and some translations
and other small fixes) git-svn-id: svn://tug.org/texlive/trunk@10471 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl42
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgrgui/tlmgrgui-real.pl20
2 files changed, 40 insertions, 22 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index d0c9907c66a..012859a2f00 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -40,7 +40,7 @@ use TeXLive::TLMedia;
use TeXLive::TLUtils;
use TeXLive::TLWinGoo;
use TeXLive::TLPostActions;
-TeXLive::TLUtils->import( qw(kpsewhich member win32 merge_into copy log) );
+TeXLive::TLUtils->import( qw(kpsewhich member info give_ctan_mirror win32 merge_into copy log debug) );
use Cwd qw/abs_path/;
use Pod::Usage;
use Getopt::Long qw(:config no_autoabbrev require_order);
@@ -419,8 +419,7 @@ sub action_show {
my $installed = 0;
if (!$tlp) {
if (!$tlmediatlpdb) {
- $tlmediasrc = TeXLive::TLMedia->new($location);
- die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+ init_tlmedia();
$tlmediatlpdb = $tlmediasrc->tlpdb;
}
$tlp = $tlmediatlpdb->get_package($pkg);
@@ -452,8 +451,7 @@ sub action_search {
my $tlpdb;
init_local_db();
if ($opt_global) {
- $tlmediasrc = TeXLive::TLMedia->new($location);
- die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+ init_tlmedia();
$tlpdb = $tlmediasrc->tlpdb;
} else {
$tlpdb = $localtlpdb;
@@ -615,8 +613,7 @@ sub action_update {
"backupdir=s" => \$opt_backupdir,
"dry-run" => \$opt_dry) or pod2usage(2);
my %ret;
- $tlmediasrc = TeXLive::TLMedia->new($location);
- die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+ init_tlmedia();
my $mediatlpdb = $tlmediasrc->tlpdb;
my @todo;
if ($opt_all || $opt_list) {
@@ -660,7 +657,7 @@ sub action_update {
my $rev = $tlp->revision;
my $mediatlp = $mediatlpdb->get_package($pkg);
if (!defined($mediatlp)) {
- print "$pkg cannot be found in $location\n";
+ debug("$pkg cannot be found in $location\n");
next;
}
my $mediarev = $mediatlp->revision;
@@ -787,8 +784,7 @@ sub action_install {
GetOptions("no-depends" => \$opt_nodepends,
"dry-run" => \$opt_dry) or pod2usage(2);
my %ret;
- $tlmediasrc = TeXLive::TLMedia->new($location);
- die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+ init_tlmedia();
foreach my $pkg (@ARGV) {
if ($opt_dry) {
print "install: $pkg\n";
@@ -808,8 +804,7 @@ sub action_list {
init_local_db();
my $what = shift @ARGV;
$what || ($what = "");
- $tlmediasrc = TeXLive::TLMedia->new($location);
- die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+ init_tlmedia();
my @whattolist;
if ($what =~ m/^collection/i) {
@whattolist = $tlmediasrc->tlpdb->collections;
@@ -905,8 +900,7 @@ sub action_arch {
if ($what =~ m/^list$/i) {
# list the available architectures
# initialize the TLMedia from $location
- $tlmediasrc = TeXLive::TLMedia->new($location);
- die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+ init_tlmedia();
my $mediatlpdb = $tlmediasrc->tlpdb;
my @already_installed_arch = $localtlpdb->available_architectures;
print "Available architectures:\n";
@@ -921,8 +915,7 @@ sub action_arch {
print "You can add new architectures with tlmgr arch add arch1 arch2\n";
exit(0);
} elsif ($what =~ m/^add$/i) {
- $tlmediasrc = TeXLive::TLMedia->new($location);
- die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+ init_tlmedia();
my $mediatlpdb = $tlmediasrc->tlpdb;
my @already_installed_arch = $localtlpdb->available_architectures;
my @available_arch = $mediatlpdb->available_architectures;
@@ -1207,6 +1200,23 @@ sub action_uninstall {
system("rmdir", "--ignore-fail-on-non-empty", "$texdir");
}
+#
+# init_tlmedia
+# initialize a tlmedia object and returns it, or dies
+#
+sub init_tlmedia {
+ if (($location =~ m/$TeXLiveServerURL/) ||
+ ($location =~ m/^ctan$/i)) {
+ $location = give_ctan_mirror();
+ info("Using mirror $location\n");
+ }
+ # $tlmediasrc is a global function
+ $tlmediasrc = TeXLive::TLMedia->new($location);
+ die($loadmediasrcerror . $location) unless defined($tlmediasrc);
+}
+
+
+
#
# return all the directories from which all content will be removed
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui-real.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui-real.pl
index cb5d9e81888..61a959e4278 100755
--- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui-real.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui-real.pl
@@ -116,7 +116,7 @@ $TRANS{'en'} = {
loadremotetlpdbwait => "Loading remote TeX Live Database\nThis may take some time, please wait!",
runupdater => "Some package cannot be updated using the GUI!\nPlease run TEXROOT/tlpkg/installer/updater.bat once,\notherwise the updates will not be complete!\nNOTE: You have to QUIT this program first!",
actions => "Actions",
- reinitlsr => "Re-initalise file database",
+ reinitlsr => "Re-initialize file database",
recreateformats => "Re-create all formats",
updatemaps => "Update font map database",
warningnonetupdate => "No updates found.\n\nYour installation is set up to look on the disk for updates.\n\nIf you want to install from the Internet for this one time only, click on the \"Change\" button above and select \"Default Net Location\" (or any other network location you know to be working).\n\nIf you want to change it permanently, go to the \"Configuration\" Tab and change the default installation source.",
@@ -263,7 +263,6 @@ if (defined($loc)) {
if (defined($opt_location)) {
$location = $opt_location;
}
-# our $location = $localtlpdb->option_location;
our $tlmediasrc;
our $tlmediatlpdb;
@@ -271,6 +270,7 @@ our @allpackages;
our $balloon = $mw->Balloon();
+push @update_function_list, \&check_location_on_ctan;
push @update_function_list, \&init_install_media;
push @update_function_list, \&create_update_list;
@@ -665,10 +665,11 @@ sub menu_edit_location {
})->pack(-side => "left", -padx => "2m", -pady => "2m");
$f1->pack;
my $f = $sw->Frame;
- my $okbutton = $f->Button(-text => 'Ok',
- -command => sub { $location = $entry->get;
- run_update_functions() ;
- $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m");
+ my $okbutton = $f->Button(-text => ___"ok",
+ -command => sub { $location = $entry->get;
+ run_update_functions();
+ $sw->destroy;
+ })->pack(-side => 'left', -padx => "2m", -pady => "2m");
my $cancelbutton = $f->Button(-text => 'Cancel',
-command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m");
$f->pack(-expand => 'x');
@@ -682,6 +683,13 @@ sub run_update_functions {
}
}
+sub check_location_on_ctan {
+ # we want to check that if mirror.ctan.org
+ # is used that we select a mirror once
+ if ($location =~ m/$TeXLive::TLConfig::TeXLiveServerURL/) {
+ $location = TeXLive::TLUtils::give_ctan_mirror();
+ }
+}
1;