diff options
author | Norbert Preining <preining@logic.at> | 2012-03-24 06:41:30 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2012-03-24 06:41:30 +0000 |
commit | 6a0fc52f04c3639d212d0455981765f29b0aa256 (patch) | |
tree | e725a649953c652754c58f3522931156162a75d3 /Master | |
parent | 7101a6fa6acefa0a847c2dc10e31630e2386e790 (diff) |
update multi source support patch: more tlmgr gui features
git-svn-id: svn://tug.org/texlive/trunk@25733 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/dev/dev.multi-source-support-v2.patch | 463 |
1 files changed, 395 insertions, 68 deletions
diff --git a/Master/tlpkg/dev/dev.multi-source-support-v2.patch b/Master/tlpkg/dev/dev.multi-source-support-v2.patch index cc35476e094..25e97660d23 100644 --- a/Master/tlpkg/dev/dev.multi-source-support-v2.patch +++ b/Master/tlpkg/dev/dev.multi-source-support-v2.patch @@ -1,13 +1,13 @@ --- - texmf/scripts/texlive/tlmgr.pl | 909 ++++++++++++++++++++++++++++++++------ - texmf/scripts/texlive/tlmgrgui.pl | 57 +- - tlpkg/TeXLive/TLPDB.pm | 691 ++++++++++++++++++++++++++-- - 3 files changed, 1449 insertions(+), 208 deletions(-) + texmf/scripts/texlive/tlmgr.pl | 916 ++++++++++++++++++++++++++++++++------ + texmf/scripts/texlive/tlmgrgui.pl | 236 ++++++++- + tlpkg/TeXLive/TLPDB.pm | 705 ++++++++++++++++++++++++++--- + 3 files changed, 1617 insertions(+), 240 deletions(-) Index: tlpkg/TeXLive/TLPDB.pm =================================================================== --- tlpkg/TeXLive/TLPDB.pm.orig 2012-01-30 10:48:02.284183279 +0900 -+++ tlpkg/TeXLive/TLPDB.pm 2012-02-09 08:46:31.248950126 +0900 ++++ tlpkg/TeXLive/TLPDB.pm 2012-03-23 21:19:39.632811501 +0900 @@ -70,20 +70,31 @@ $tlpdb->settings; $tlpdb->setting($key, [$value]); @@ -44,7 +44,17 @@ Index: tlpkg/TeXLive/TLPDB.pm use TeXLive::TLPOBJ; use TeXLive::TLWinGoo; -@@ -161,6 +172,10 @@ +@@ -123,8 +134,7 @@ + $_listdir = $params{'listdir'} if defined($params{'listdir'}); + bless $self, $class; + if (defined($params{'tlpdbfile'})) { +- my $nr_packages_read +- = $self->from_file("$self->{'root'}/$InfraLocation/$DatabaseName"); ++ my $nr_packages_read = $self->from_file($params{'tlpdbfile'}, '-from-file'); + if ($nr_packages_read == 0) { + # that is bad, we didn't read anything, so return undef. + return undef; +@@ -161,6 +171,10 @@ sub add_tlpobj { my ($self,$tlp) = @_; @@ -55,7 +65,7 @@ Index: tlpkg/TeXLive/TLPDB.pm $self->{'tlps'}{$tlp->name} = $tlp; } -@@ -209,6 +224,10 @@ +@@ -209,6 +223,10 @@ sub remove_tlpobj { my ($self,$pkg) = @_; @@ -66,18 +76,34 @@ Index: tlpkg/TeXLive/TLPDB.pm if (defined($self->{'tlps'}{$pkg})) { delete $self->{'tlps'}{$pkg}; } else { -@@ -229,6 +248,10 @@ +@@ -228,15 +246,22 @@ + =cut sub from_file { - my ($self, $path) = @_; +- my ($self, $path) = @_; +- if (@_ != 2) { ++ my ($self, $path, $arg) = @_; + if ($self->is_virtual) { + tlwarn("cannot initialize from file a virtual tlpdb\n"); + return 0; + } - if (@_ != 2) { ++ if (@_ < 2) { die "$0: from_file needs filename for initialization"; } -@@ -362,6 +385,10 @@ + my $root_from_path = dirname(dirname($path)); + if (defined($self->{'root'})) { + if ($self->{'root'} ne $root_from_path) { +- tlwarn("root=$self->{'root'}, root_from_path=$root_from_path\n"); +- tlwarn("Initialization from different location as originally given.\nHope you are sure!\n"); ++ # only warn if we are not given $arg = "-from-file" ++ if (!defined($arg) || ($arg ne "-from-file")) { ++ tlwarn("root=$self->{'root'}, root_from_path=$root_from_path\n"); ++ tlwarn("Initialization from different location as originally given.\nHope you are sure!\n"); ++ } + } + } else { + $self->root($root_from_path); +@@ -362,6 +387,10 @@ sub writeout { my $self = shift; @@ -88,7 +114,7 @@ Index: tlpkg/TeXLive/TLPDB.pm my $fd = (@_ ? $_[0] : STDOUT); foreach (sort keys %{$self->{'tlps'}}) { ddebug("writeout: tlpname=$_ ", $self->{'tlps'}{$_}->name, "\n"); -@@ -381,6 +408,10 @@ +@@ -381,6 +410,10 @@ sub save { my $self = shift; @@ -99,7 +125,7 @@ Index: tlpkg/TeXLive/TLPDB.pm my $path = $self->location; mkdirhier(dirname($path)); my $tmppath = "$path.tmp"; -@@ -402,6 +433,9 @@ +@@ -402,6 +435,9 @@ sub media { my $self = shift ; @@ -109,7 +135,7 @@ Index: tlpkg/TeXLive/TLPDB.pm return $self->{'media'}; } -@@ -417,6 +451,18 @@ +@@ -417,6 +453,18 @@ sub available_architectures { my $self = shift; @@ -128,7 +154,7 @@ Index: tlpkg/TeXLive/TLPDB.pm my @archs = $self->setting("available_architectures"); if (! @archs) { # fall back to the old method checking tex\.* -@@ -444,6 +490,10 @@ +@@ -444,6 +492,10 @@ sub add_tlpcontainer { my ($self, $package, $ziplocation, $archrefs, $dest) = @_; @@ -139,7 +165,7 @@ Index: tlpkg/TeXLive/TLPDB.pm my @archs; if (defined($archrefs)) { @archs = @$archrefs; -@@ -508,6 +558,29 @@ +@@ -508,6 +560,29 @@ =cut sub get_package { @@ -169,7 +195,7 @@ Index: tlpkg/TeXLive/TLPDB.pm my ($self,$pkg) = @_; if (defined($self->{'tlps'}{$pkg})) { my $ret = $self->{'tlps'}{$pkg}; -@@ -519,6 +592,35 @@ +@@ -519,6 +594,35 @@ =pod @@ -205,7 +231,7 @@ Index: tlpkg/TeXLive/TLPDB.pm =item C<< $tlpdb->list_packages >> The C<list_packages> function returns the list of all included packages. -@@ -527,6 +629,34 @@ +@@ -527,6 +631,34 @@ sub list_packages { my $self = shift; @@ -240,7 +266,7 @@ Index: tlpkg/TeXLive/TLPDB.pm return (sort keys %{$self->{'tlps'}}); } -@@ -544,6 +674,11 @@ +@@ -544,6 +676,11 @@ The next (or first) argument is the target TLPDB, then a list of packages. @@ -252,7 +278,7 @@ Index: tlpkg/TeXLive/TLPDB.pm We return the closure of the package list with respect to the depends operator. (Sorry, that was for mathematicians.) -@@ -567,7 +702,8 @@ +@@ -567,7 +704,8 @@ my %install = (); my @archs = $totlpdb->available_architectures; for my $p (@_) { @@ -262,7 +288,7 @@ Index: tlpkg/TeXLive/TLPDB.pm } my $changed = 1; while ($changed) { -@@ -576,7 +712,7 @@ +@@ -576,7 +714,7 @@ ddebug("pre_select = @pre_select\n"); for my $p (@pre_select) { next if ($p =~ m/^00texlive/); @@ -271,7 +297,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if (!defined($pkg)) { debug("W: $p is mentioned somewhere but not available, disabling\n"); $install{$p} = 0; -@@ -602,16 +738,19 @@ +@@ -602,16 +740,19 @@ if ($p_dep =~ m/^(.*)\.ARCH$/) { my $foo = "$1"; foreach $a (@archs) { @@ -294,7 +320,7 @@ Index: tlpkg/TeXLive/TLPDB.pm } } } -@@ -623,7 +762,9 @@ +@@ -623,7 +764,9 @@ $changed = 1; } } @@ -305,7 +331,7 @@ Index: tlpkg/TeXLive/TLPDB.pm } =pod -@@ -635,6 +776,7 @@ +@@ -635,6 +778,7 @@ =cut @@ -313,7 +339,7 @@ Index: tlpkg/TeXLive/TLPDB.pm sub find_file { my ($self,$fn) = @_; my @ret; -@@ -868,6 +1010,10 @@ +@@ -868,6 +1012,10 @@ sub root { my $self = shift; @@ -324,7 +350,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if (@_) { $self->{'root'} = shift } return $self->{'root'}; } -@@ -887,6 +1033,10 @@ +@@ -887,6 +1035,10 @@ sub location { my $self = shift; @@ -335,7 +361,7 @@ Index: tlpkg/TeXLive/TLPDB.pm return "$self->{'root'}/$InfraLocation/$DatabaseName"; } -@@ -937,8 +1087,14 @@ +@@ -937,8 +1089,14 @@ sub config_src_container { my $self = shift; @@ -352,7 +378,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if ($d =~ m!^container_split_src_files/(.*)$!) { return "$1"; } -@@ -958,8 +1114,14 @@ +@@ -958,8 +1116,14 @@ sub config_doc_container { my $self = shift; @@ -369,7 +395,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if ($d =~ m!^container_split_doc_files/(.*)$!) { return "$1"; } -@@ -978,8 +1140,14 @@ +@@ -978,8 +1142,14 @@ sub config_container_format { my $self = shift; @@ -386,7 +412,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if ($d =~ m!^container_format/(.*)$!) { return "$1"; } -@@ -998,8 +1166,14 @@ +@@ -998,8 +1168,14 @@ sub config_release { my $self = shift; @@ -403,7 +429,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if ($d =~ m!^release/(.*)$!) { return "$1"; } -@@ -1018,8 +1192,14 @@ +@@ -1018,8 +1194,14 @@ sub config_minrelease { my $self = shift; @@ -420,7 +446,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if ($d =~ m!^minrelease/(.*)$!) { return "$1"; } -@@ -1039,8 +1219,14 @@ +@@ -1039,8 +1221,14 @@ sub config_revision { my $self = shift; @@ -437,7 +463,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if ($d =~ m!^revision/(.*)$!) { return "$1"; } -@@ -1066,12 +1252,12 @@ +@@ -1066,12 +1254,12 @@ sub sizes_of_packages { my ($self, $opt_src, $opt_doc, @packs) = @_; @packs || ( @packs = $self->list_packages() ); @@ -451,7 +477,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if (!defined($tlpobjs{$p})) { warn "STRANGE: $p not to be found in ", $self->root; next; -@@ -1110,31 +1296,46 @@ +@@ -1110,31 +1298,46 @@ =pod @@ -512,7 +538,7 @@ Index: tlpkg/TeXLive/TLPDB.pm } else { my $container_src_split = $fromtlpdb->config_src_container; my $container_doc_split = $fromtlpdb->config_doc_container; -@@ -1182,7 +1383,7 @@ +@@ -1182,7 +1385,7 @@ next; } } elsif (&media eq 'NET') { @@ -521,7 +547,7 @@ Index: tlpkg/TeXLive/TLPDB.pm } $self->_install_package ($container, $reloc, \@installfiles, $totlpdb) || return(0); -@@ -1256,23 +1457,21 @@ +@@ -1256,23 +1459,21 @@ $totlpdb->save; # compute the return value TeXLive::TLUtils::announce_execute_actions("enable", $tlpobj); @@ -559,7 +585,7 @@ Index: tlpkg/TeXLive/TLPDB.pm } return 1; } -@@ -1525,7 +1724,7 @@ +@@ -1525,7 +1726,7 @@ # the postaction code part cannot be evaluated now since the # files are already removed. # Again, desktop integration maps to desktop and menu links @@ -568,7 +594,7 @@ Index: tlpkg/TeXLive/TLPDB.pm &TeXLive::TLUtils::do_postaction("remove", $tlp, $localtlpdb->option("file_assocs"), $localtlpdb->option("desktop_integration"), -@@ -1557,7 +1756,12 @@ +@@ -1557,7 +1758,12 @@ sub _set_value_pkg { my ($self,$pkgname,$pre,$key,$value) = @_; my $k = "$pre$key"; @@ -582,7 +608,7 @@ Index: tlpkg/TeXLive/TLPDB.pm my @newdeps; if (!defined($pkg)) { $pkg = new TeXLive::TLPOBJ; -@@ -1595,8 +1799,14 @@ +@@ -1595,8 +1801,14 @@ sub _value_pkg { my ($self,$pkg,$pre,$key) = @_; my $k = "$pre$key"; @@ -599,7 +625,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if ($d =~ m!^$k:(.*)$!) { return "$1"; } -@@ -1709,7 +1919,12 @@ +@@ -1709,7 +1921,12 @@ my ($self, $pre, $hr) = @_; my @allowed = keys %$hr; my %ret; @@ -613,7 +639,7 @@ Index: tlpkg/TeXLive/TLPDB.pm if (defined($pkg)) { foreach my $d ($pkg->depends) { if ($d =~ m!^$pre([^:]*):(.*)!) { -@@ -1858,6 +2073,362 @@ +@@ -1858,6 +2075,362 @@ =back @@ -976,7 +1002,7 @@ Index: tlpkg/TeXLive/TLPDB.pm =pod =head1 OPTIONS -@@ -1919,4 +2490,4 @@ +@@ -1919,4 +2492,4 @@ ### tab-width: 2 ### indent-tabs-mode: nil ### End: @@ -985,7 +1011,7 @@ Index: tlpkg/TeXLive/TLPDB.pm Index: texmf/scripts/texlive/tlmgr.pl =================================================================== --- texmf/scripts/texlive/tlmgr.pl.orig 2012-01-31 23:25:04.175697912 +0900 -+++ texmf/scripts/texlive/tlmgr.pl 2012-03-21 17:29:21.810792133 +0900 ++++ texmf/scripts/texlive/tlmgr.pl 2012-03-23 21:21:07.148744300 +0900 @@ -1,7 +1,7 @@ #!/usr/bin/env perl # $Id: tlmgr.pl 24419 2011-10-27 14:06:37Z preining $ @@ -1894,10 +1920,11 @@ Index: texmf/scripts/texlive/tlmgr.pl # OPTION # -@@ -4601,6 +4967,87 @@ +@@ -4601,7 +4967,93 @@ # sub init_tlmedia { +- if (defined($remotetlpdb) && ($remotetlpdb->root eq $location)) { + # first check if $location contains multiple locations + # in this case we go to virtual mode + #my %repos = repository_to_array($localtlpdb->option("location")); @@ -1961,7 +1988,6 @@ Index: texmf/scripts/texlive/tlmgr.pl + } + } + -+ + # this "location-url" line should not be changed since GUI programs + # depend on it: + print "location-url\t$locstr\n" if $::machinereadable; @@ -1979,10 +2005,17 @@ Index: texmf/scripts/texlive/tlmgr.pl + +sub _init_tlmedia +{ - if (defined($remotetlpdb) && ($remotetlpdb->root eq $location)) { ++ ++ # if we are already initialized to the same location, nothing ++ # needs to be done. ++ # if we are initialized to a virtual tlpdb, then we have to ++ # do in any case an initialization ++ if (defined($remotetlpdb) && !$remotetlpdb->is_virtual && ++ ($remotetlpdb->root eq $location)) { # nothing to be done return; -@@ -4614,10 +5061,28 @@ + } +@@ -4614,10 +5066,28 @@ $location =~ s,^$TeXLiveServerURL,$mirrorbase,; } @@ -2011,7 +2044,7 @@ Index: texmf/scripts/texlive/tlmgr.pl # if we talk about a net location try to download the hash of the tlpdb # - if that is possible, check for the locally saved file and if the hash -@@ -4763,8 +5228,30 @@ +@@ -4763,8 +5233,30 @@ close($tlfh); } } @@ -2042,7 +2075,7 @@ Index: texmf/scripts/texlive/tlmgr.pl # finish handles the -pause option (wait for input from stdin), -@@ -5561,6 +6048,42 @@ +@@ -5561,6 +6053,42 @@ =back @@ -2085,7 +2118,7 @@ Index: texmf/scripts/texlive/tlmgr.pl =head2 option -@@ -6198,6 +6721,118 @@ +@@ -6198,6 +6726,118 @@ GUI and a simplified GUI with only the important and mostly used settings. @@ -2207,7 +2240,7 @@ Index: texmf/scripts/texlive/tlmgr.pl Index: texmf/scripts/texlive/tlmgrgui.pl =================================================================== --- texmf/scripts/texlive/tlmgrgui.pl.orig 2011-06-16 21:30:37.000000000 +0900 -+++ texmf/scripts/texlive/tlmgrgui.pl 2012-03-21 18:54:41.072492333 +0900 ++++ texmf/scripts/texlive/tlmgrgui.pl 2012-03-23 23:16:44.539481157 +0900 @@ -1,7 +1,7 @@ #!/usr/bin/env perl # $Id: tlmgrgui.pl 23011 2011-06-16 12:30:37Z preining $ @@ -2217,8 +2250,12 @@ Index: texmf/scripts/texlive/tlmgrgui.pl # This file is licensed under the GNU General Public License version 2 # or any later version. # -@@ -62,6 +62,11 @@ +@@ -60,8 +60,15 @@ + our @update_function_list; + my $tlpdb_location; ++my %tlpdb_repos; ++my @tlpdb_tags; my $cmdline_location; my @critical_updates = (); + @@ -2229,7 +2266,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl # # shortcuts for padding, expand/fill, and pack sides, anchors my @p_ii = qw/-padx 2m -pady 2m/; -@@ -97,6 +102,7 @@ +@@ -97,6 +104,7 @@ my $darktext; my $match_entry; my $loaded_text; @@ -2237,7 +2274,16 @@ Index: texmf/scripts/texlive/tlmgrgui.pl # # communication between filters and the rest -@@ -261,14 +267,13 @@ +@@ -169,6 +177,8 @@ + # cmd line > tlpdb + # save the two possible location for the menu + $tlpdb_location = $localtlpdb->option("location"); ++ %tlpdb_repos = repository_to_array($tlpdb_location); ++ @tlpdb_tags = keys %tlpdb_repos; + if (defined($opts{"location"})) { + $cmdline_location = $opts{"location"}; + } +@@ -261,14 +271,13 @@ -selectmode => "none"); my $button_frame = $mw->Frame; @@ -2256,12 +2302,202 @@ Index: texmf/scripts/texlive/tlmgrgui.pl $loaded_text->pack(-anchor => 'e', -padx => 0, -pady => 0, -ipadx => 0, -ipady => 0, -side => 'right'); -@@ -1554,19 +1559,34 @@ +@@ -484,8 +493,14 @@ + # + # FILE MENU + # ++ my %foo = repository_to_array($tlpdb_location); ++ my @bar = keys %foo; ++ my $tlpdb_location_string = $tlpdb_location; ++ if ($#bar > 0) { ++ $tlpdb_location_string = __("multiple repositories"); ++ } + $menu_file->add('command', +- -label => __("Load default repository:") . " $tlpdb_location", ++ -label => __("Load default repository:") . " $tlpdb_location_string", + -command => sub { setup_location($tlpdb_location); }); + if (defined($cmdline_location)) { + $menu_file->add('command', -label => __("Load cmd line repository:") . " $cmdline_location", +@@ -663,7 +678,7 @@ + -sticky => "nw"); + } + $tf->Label(-text => __("Remote Revision:"))->grid( +- $tf->Label(-text => $Packages{$p}{'remoterevision'}), ++ $tf->Label(-text => $Packages{$p}{'remoterevisionstring'}), + -sticky => "nw"); + if (defined($Packages{$p}{'remotecatalogueversion'})) { + $tf->Label(-text => __("Remote Catalogue Version:"))->grid( +@@ -838,7 +853,7 @@ + $t .= " ($Packages{$p}{'localcatalogueversion'})"; + } + $g->itemCreate($p, 2, -itemtype => 'text', -style => $st, -text => $t); +- $t = ($Packages{$p}{'remoterevision'} || ''); ++ $t = ($Packages{$p}{'remoterevisionstring'} || ''); + if ($Packages{$p}{'remotecatalogueversion'}) { + $t .= " ($Packages{$p}{'remotecatalogueversion'})"; + } +@@ -905,9 +920,13 @@ + return 0; + } + # check first for the default search type, the descriptions ++ # also match the remoterevisionstring to get search for repositories + if ($match_descriptions) { + if ($Packages{$p}{'match_desc'} =~ m/$r/i) { + $found = 1; ++ } elsif (defined($Packages{$p}{'remoterevisionstring'}) && ++ $Packages{$p}{'remoterevisionstring'} =~ m/$r/i) { ++ $found = 1; + } + } + if (!$found) { +@@ -1052,6 +1071,13 @@ + } else { + if ($k eq "file_assocs") { + $changeddefaults{$k}{'display'} = $fileassocdesc[$defaults{$k}]; ++ } elsif ($k eq "location") { ++ if ($#tlpdb_tags > 0) { ++ # we are using multiple repositories ++ $changeddefaults{$k}{'display'} = __("multiple repositories"); ++ } else { ++ $changeddefaults{$k}{'display'} = $defaults{$k}; ++ } + } else { + $changeddefaults{$k}{'display'} = $defaults{$k}; + } +@@ -1075,11 +1101,23 @@ + + push @config_set_l, + $back_config_set->Label(-text => __("Default package repository"), -anchor => "w"); +- push @config_set_m, +- $back_config_set->Label(-textvariable => \$changeddefaults{"location"}{'display'}); +- push @config_set_r, +- $back_config_set->Button(-text => __("Change"), +- -command => sub { menu_default_location($sw); }); ++ if ($#tlpdb_tags > 0) { ++ my @vals = map { "$_:$tlpdb_repos{$_}" } sort @tlpdb_tags; ++ my $b = $back_config_set->Button(-relief => 'flat', ++ -textvariable => \$changeddefaults{"location"}{'display'}); ++ $b->configure( ++ -command => sub { transient_show_multiple_repos($b, @vals); }); ++ push @config_set_m, $b; ++ push @config_set_r, ++ $back_config_set->Button(-text => __("Change"), ++ -command => sub { menu_multi_location($sw); }); ++ } else { ++ push @config_set_m, ++ $back_config_set->Label(-textvariable => \$changeddefaults{"location"}{'display'}); ++ push @config_set_r, ++ $back_config_set->Button(-text => __("Change"), ++ -command => sub { menu_default_location($sw); }); ++ } + + + if ($mode_expert) { +@@ -1383,16 +1421,14 @@ + } + } + +-# +-# this function is used to edit/change the default tlpdb repository +-# we also want to change the menu entry if we change that +-sub menu_default_location { +- my $mw = shift; ++sub ask_one_repository { ++ my ($mw, $title, $info) = @_; + my $val; +- my $sw = $mw->Toplevel(-title => __("Change default package repository")); ++ my $done; ++ my $sw = $mw->Toplevel(-title => $title); + $sw->transient($mw); +- $sw->grab(); +- $sw->Label(-text => __("New default package repository"))->pack(-padx => "2m", -pady => "2m"); ++ $sw->withdraw; ++ $sw->Label(-text => $info)->pack(-padx => "2m", -pady => "2m"); + + my $f1 = $sw->Frame; + my $entry = $f1->Entry(-text => $val, -width => 50); +@@ -1417,10 +1453,71 @@ + + my $f = $sw->Frame; + my $okbutton = $f->Button(-text => __("Ok"), ++ -command => sub { $val = $entry->get; $done = 1; } ++ )->pack(-side => 'left',-padx => "2m", -pady => "2m"); ++ my $cancelbutton = $f->Button(-text => __("Cancel"), ++ -command => sub { $val = undef; $done = 1; } ++ )->pack(-side => 'right',-padx => "2m", -pady => "2m"); ++ $f->pack(-expand => 'x'); ++ $sw->bind('<Return>', [ $okbutton, 'Invoke' ]); ++ $sw->bind('<Escape>', [ $cancelbutton, 'Invoke' ]); ++ my $old_focus = $sw->focusSave; ++ my $old_grab = $sw->grabSave; ++ $sw->Popup; ++ $sw->grab; ++ $sw->waitVariable(\$done); ++ $sw->grabRelease if Tk::Exists($sw); ++ $sw->destroy if Tk::Exists($sw); ++ return $val; ++} ++ ++sub menu_default_location { ++ my $mw = shift; ++ my $ret = ask_one_repository($mw, __("Change default package repository"), ++ __("New default package repository")); ++ if (defined($ret)) { ++ $changeddefaults{'location'}{'value'} = ++ $changeddefaults{'location'}{'display'} = $ret; ++ } ++} ++ ++ ++sub menu_multi_location { ++ my $mw = shift; ++ my $val; ++ my $sw = $mw->Toplevel(-title => __("Edit default package repositories")); ++ $sw->transient($mw); ++ $sw->grab(); ++ $sw->Label(-text => __("Specify set of repositories to be used"))->pack(-padx => "2m", -pady => "2m"); ++ ++ my $f1 = $sw->Frame; ++ my @entry_tag; my $tagw = 10; ++ my @entry_loc; my $locw = 30; ++ my @entry_del; ++ my @entry_chg; ++ push @entry_tag, $f1->Entry(-text => 'main', -state => 'readonly', -width => $tagw); ++ push @entry_loc, $f1->Entry(-text => $tlpdb_repos{'main'}, -width => $locw); ++ push @entry_del, $f1->Button(-text => __("Delete"), -state => 'disabled'); ++ push @entry_chg, $f1->Button(-text => __("Change")); ++ for my $t (sort @tlpdb_tags) { ++ next if ($t eq "main"); ++ push @entry_tag, $f1->Entry(-text => $t, -width => $tagw); ++ push @entry_loc, $f1->Entry(-text => $tlpdb_repos{$t}, -width => $locw); ++ push @entry_del, $f1->Button(-text => __("Delete")); ++ push @entry_chg, $f1->Button(-text => __("Change")); ++ } ++ for my $i (0..$#entry_tag) { ++ $entry_tag[$i]->grid( $entry_loc[$i], $entry_del[$i], $entry_chg[$i], ++ -padx => "1m", -pady => "1m", -sticky => "nwe"); ++ } ++ ++ $f1->pack; ++ ++ my $f = $sw->Frame; ++ my $okbutton = $f->Button(-text => __("Ok"), + -command => + sub { +- $changeddefaults{'location'}{'value'} = +- $changeddefaults{'location'}{'display'} = $entry->get; ++ print "TODO TODO TODO ___ EDITING OF MULTIPLE NOT SUPPORTED!!!\nWE ALSO HAVE TO MAKE SURE THAT THERE IS ONE MAIN AND NOT MORE ETC ETC\n"; + $sw->destroy; + })->pack(-side => 'left',-padx => "2m", -pady => "2m"); + my $cancelbutton = $f->Button(-text => __("Cancel"), +@@ -1554,19 +1651,27 @@ sub setup_location { my $loc = shift; $location = $loc; +- update_loaded_location_string(); + # first check if $location contains multiple locations + # in this case we go to virtual mode ++ %repos = (); + %repos = repository_to_array($location); + @tags = keys %repos; + if ($#tags == 0) { @@ -2269,7 +2505,6 @@ Index: texmf/scripts/texlive/tlmgrgui.pl + } else { + $single_repo_mode = 0; + } - update_loaded_location_string(); run_update_functions(); } @@ -2284,26 +2519,99 @@ Index: texmf/scripts/texlive/tlmgrgui.pl - info(__("Loading remote TeX Live Database\nThis may take some time, please wait!") . "\n"); - $remotetlpdb = TeXLive::TLPDB->new(root => $newroot); - info(__("Completed") . ".\n"); -+ if ($#tags == 0) { -+ init_tlmedia(); -+ #info(__("Loading remote TeX Live Database\nThis may take some time, please wait!") . "\n"); -+ #$remotetlpdb = TeXLive::TLPDB->new(root => $newroot); -+ #info(__("Completed") . ".\n"); -+ } else { -+ init_tlmedia(); -+ } ++ init_tlmedia(); $mw->Unbusy; if (!defined($remotetlpdb)) { # something went badly wrong, maybe the newroot is wrong? -@@ -2216,7 +2236,22 @@ +@@ -1725,7 +1830,7 @@ + # sub populate_Packages + # + sub populate_Packages { +- my ($mode, $tlp) = @_; ++ my ($mode, $tlp, $maxtag) = @_; + my $p = $tlp->name; + $Packages{$p}{'displayname'} = $p; + if ($mode eq "local") { +@@ -1736,6 +1841,10 @@ + $Packages{$p}{'tlp'} = $tlp; + } else { + $Packages{$p}{'remoterevision'} = $tlp->revision; ++ $Packages{$p}{'remoterevisionstring'} = $tlp->revision; ++ if ($remotetlpdb->is_virtual) { ++ $Packages{$p}{'remoterevisionstring'} .= "\@$maxtag"; ++ } + $Packages{$p}{'selected'} = 0 + unless defined $Packages{$p}{'selected'}; + if (!defined($Packages{$p}{'tlp'})) { +@@ -1865,6 +1974,7 @@ + next; + } + delete $Packages{$p}{'remoterevision'}; ++ delete $Packages{$p}{'remoterevisionstring'}; + delete $Packages{$p}{'remotecatalogueversion'}; + } + if (defined($remotetlpdb)) { +@@ -1875,8 +1985,15 @@ + push @do_later_media, $p; + next; + } +- my $tlp = $remotetlpdb->get_package($p); +- populate_Packages("remote", $tlp); ++ my $tlp; ++ my $maxtag; ++ if ($remotetlpdb->is_virtual) { ++ ($maxtag, undef, $tlp, undef) = ++ $remotetlpdb->virtual_candidate($p); ++ } else { ++ $tlp = $remotetlpdb->get_package($p); ++ } ++ populate_Packages("remote", $tlp, $maxtag); + } + } + my @avail_arch = $localtlpdb->available_architectures; +@@ -1886,9 +2003,16 @@ + tlerror("very strange, above it matched and now not anymore?!?! $p\n"); + next; + } +- my $tlp = $remotetlpdb->get_package($p); ++ my $tlp; ++ my $maxtag; ++ if ($remotetlpdb->is_virtual) { ++ ($maxtag, undef, $tlp, undef) = ++ $remotetlpdb->virtual_candidate($p); ++ } else { ++ $tlp = $remotetlpdb->get_package($p); ++ } + if (!defined($Packages{$mp})) { +- populate_Packages("remote", $tlp); ++ populate_Packages("remote", $tlp, $maxtag); + } else { + # two cases: + # - $mp.$ma where $ma is in available_archs +@@ -1926,7 +2050,7 @@ + } else { + # only show that one if it is locally installed + if (defined($Packages{$p})) { +- populate_Packages("remote", $tlp); ++ populate_Packages("remote", $tlp, $maxtag); + } + } + } +@@ -2216,7 +2340,47 @@ sub update_loaded_location_string { my $arg = shift; $arg || ($arg = $location); - $loaded_text->configure(-text => __("Loaded repository:") . " " . $arg); + my %repos = repository_to_array($arg); -+ my @tags = keys %repos; ++ my @tags = sort keys %repos; ++ my @vals; ++ if ($#tags > 0) { ++ @vals = sort map { "$_:$repos{$_}" } @tags; ++ } else { ++ @vals = ( $arg ); ++ } + my $locstr; -+ if ($#tags >= 0) { ++ if ($#tags > 0) { + $locstr = $repos{'main'}; + for my $t (keys %repos) { + if ($t ne 'main') { @@ -2315,7 +2623,26 @@ Index: texmf/scripts/texlive/tlmgrgui.pl + $loaded_text_button->configure(-text => $arg); + } + $loaded_text->configure(-text => __("Loaded repository:")); -+ $loaded_text_button->configure(-command => sub { show_repositories($arg); }); ++ $loaded_text_button->configure( -command => ++ sub { transient_show_multiple_repos($loaded_text_button, @vals); }); ++} ++ ++sub transient_show_multiple_repos { ++ my ($ref_widget, @vals) = @_; ++ my $xx = $ref_widget->rootx; ++ my $yy = $ref_widget->rooty + $ref_widget->reqheight; ++ my $sw = $mw->Toplevel(-bd => 2); ++ $sw->geometry("+$xx+$yy"); ++ $sw->overrideredirect(1); ++ $sw->transient($mw); ++ $sw->grab; ++ # we want to have a global grab, but that somehow does not work! ++ #$sw->grabGlobal; ++ $sw->bind('<1>', sub { $sw->grabRelease; $sw->destroy; }); ++ my $foo = $sw->Listbox(-height => 0, -width => 0, ++ -listvariable => \@vals, ++ -state => 'normal'); ++ $foo->pack; } sub run_update_functions { |