summaryrefslogtreecommitdiff
path: root/Master/tlpkg/dev
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-04-17 04:09:34 +0000
committerNorbert Preining <preining@logic.at>2012-04-17 04:09:34 +0000
commit86d7c60c406474fa856d8f87d69c7fa52ccacb1b (patch)
tree9748d614778f34f9852a733539ad893ea7f2acd7 /Master/tlpkg/dev
parentaca4d8c5312a2b39e994d35fa19d7dcbd12f6f28 (diff)
include multi-repository support into main subversion repo
git-svn-id: svn://tug.org/texlive/trunk@26004 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/dev')
-rw-r--r--Master/tlpkg/dev/dev.multi-source-support-v2.patch230
1 files changed, 172 insertions, 58 deletions
diff --git a/Master/tlpkg/dev/dev.multi-source-support-v2.patch b/Master/tlpkg/dev/dev.multi-source-support-v2.patch
index 18c03dcd4ec..c32c0ff64bf 100644
--- a/Master/tlpkg/dev/dev.multi-source-support-v2.patch
+++ b/Master/tlpkg/dev/dev.multi-source-support-v2.patch
@@ -1,8 +1,8 @@
---
texmf/scripts/texlive/tlmgr.pl | 916 ++++++++++++++++++++++++++++++++------
- texmf/scripts/texlive/tlmgrgui.pl | 292 ++++++++++--
+ texmf/scripts/texlive/tlmgrgui.pl | 394 ++++++++++++++--
tlpkg/TeXLive/TLPDB.pm | 706 ++++++++++++++++++++++++++---
- 3 files changed, 1665 insertions(+), 249 deletions(-)
+ 3 files changed, 1767 insertions(+), 249 deletions(-)
Index: tlpkg/TeXLive/TLPDB.pm
===================================================================
@@ -2241,8 +2241,8 @@ 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-28 14:30:06.000129905 +0900
-@@ -1,7 +1,7 @@
++++ texmf/scripts/texlive/tlmgrgui.pl 2012-03-29 02:38:57.124639975 +0900
+@@ -1,13 +1,17 @@
#!/usr/bin/env perl
# $Id: tlmgrgui.pl 23011 2011-06-16 12:30:37Z preining $
#
@@ -2251,7 +2251,17 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
-@@ -60,8 +60,15 @@
+ # GUI for tlmgr
+ # version 2, completely rewritten GUI
+ #
++#
++# TODO FOR MULTI SUPPORT
++# - colorize the General config tab, if something is changed, show it in RED
++# that can actually applied to single repo tlmgrgui, too
+ # TODO: Fix return codes of execute_action sub items and execute_action
+ # so that we can give a decent warning window
+ # TODO: implement path adjustment also for Windows
+@@ -60,8 +64,17 @@
our @update_function_list;
my $tlpdb_location;
@@ -2264,10 +2274,12 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
+my %repos;
+my @tags;
+
++my $location_button; # uggg, change from far away ...
++
#
# shortcuts for padding, expand/fill, and pack sides, anchors
my @p_ii = qw/-padx 2m -pady 2m/;
-@@ -97,6 +104,7 @@
+@@ -97,6 +110,7 @@
my $darktext;
my $match_entry;
my $loaded_text;
@@ -2275,7 +2287,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
#
# communication between filters and the rest
-@@ -169,6 +177,8 @@
+@@ -169,6 +183,8 @@
# cmd line > tlpdb
# save the two possible location for the menu
$tlpdb_location = $localtlpdb->option("location");
@@ -2284,7 +2296,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
if (defined($opts{"location"})) {
$cmdline_location = $opts{"location"};
}
-@@ -261,14 +271,13 @@
+@@ -261,14 +277,13 @@
-selectmode => "none");
my $button_frame = $mw->Frame;
@@ -2303,7 +2315,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
$loaded_text->pack(-anchor => 'e', -padx => 0, -pady => 0,
-ipadx => 0, -ipady => 0, -side => 'right');
-@@ -484,8 +493,14 @@
+@@ -484,8 +499,14 @@
#
# FILE MENU
#
@@ -2319,7 +2331,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
-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 @@
+@@ -663,7 +684,7 @@
-sticky => "nw");
}
$tf->Label(-text => __("Remote Revision:"))->grid(
@@ -2328,7 +2340,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
-sticky => "nw");
if (defined($Packages{$p}{'remotecatalogueversion'})) {
$tf->Label(-text => __("Remote Catalogue Version:"))->grid(
-@@ -838,7 +853,7 @@
+@@ -838,7 +859,7 @@
$t .= " ($Packages{$p}{'localcatalogueversion'})";
}
$g->itemCreate($p, 2, -itemtype => 'text', -style => $st, -text => $t);
@@ -2337,7 +2349,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
if ($Packages{$p}{'remotecatalogueversion'}) {
$t .= " ($Packages{$p}{'remotecatalogueversion'})";
}
-@@ -905,9 +920,13 @@
+@@ -905,9 +926,13 @@
return 0;
}
# check first for the default search type, the descriptions
@@ -2351,7 +2363,14 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
}
}
if (!$found) {
-@@ -1052,6 +1071,13 @@
+@@ -1046,12 +1071,20 @@
+ }
+ %changeddefaults = ();
+ for my $k (keys %defaults) {
++ $changeddefaults{$k}{'changed'} = 0;
+ $changeddefaults{$k}{'value'} = $defaults{$k};
+ if ($TeXLive::TLConfig::TLPDBOptions{$k}->[0] eq "b") {
+ $changeddefaults{$k}{'display'} = ($defaults{$k} ? __("Yes") : __("No"));
} else {
if ($k eq "file_assocs") {
$changeddefaults{$k}{'display'} = $fileassocdesc[$defaults{$k}];
@@ -2365,7 +2384,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
} else {
$changeddefaults{$k}{'display'} = $defaults{$k};
}
-@@ -1075,11 +1101,23 @@
+@@ -1075,11 +1108,23 @@
push @config_set_l,
$back_config_set->Label(-text => __("Default package repository"), -anchor => "w");
@@ -2375,12 +2394,12 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
- $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',
++ my @vals = map { "$_:$tlpdb_repos{$_}" } sort sort_main_first @tlpdb_tags;
++ $location_button = $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;
++ $location_button->configure(
++ -command => sub { transient_show_multiple_repos($location_button, @vals); });
++ push @config_set_m, $location_button;
+ push @config_set_r,
+ $back_config_set->Button(-text => __("Change"),
+ -command => sub { menu_multi_location($sw); });
@@ -2394,7 +2413,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
if ($mode_expert) {
-@@ -1383,48 +1421,145 @@
+@@ -1383,48 +1428,240 @@
}
}
@@ -2497,49 +2516,92 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
+ }
+}
+
++sub sort_main_first {
++ if ($a eq 'main') {
++ if ($b eq 'main') {
++ return 0;
++ } else {
++ return -1;
++ }
++ } else {
++ if ($b eq 'main') {
++ return 1;
++ } else {
++ return ($a cmp $b);
++ }
++ }
++}
+
+sub menu_multi_location {
+ my $mw = shift;
+ my $val;
-+ my $sw = $mw->Toplevel(-title => __("Edit default package repositories"));
++ our $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;
++ our $f1 = $sw->Frame;
++ my @entry_tag; our $tagw = 10;
++ my @entry_loc; our $locw = 30;
+ my @entry_del;
+ my @entry_chg;
+
-+ my %edit_repos = %tlpdb_repos;
-+ my @edit_tags = @tlpdb_tags;
-+ 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"),
-+ -command => sub {
-+ my $ret = ask_one_repository($sw, __("Change main package repository"),
-+ __("New main package repository"));
-+ $edit_repos{'main'} = $ret if (defined($ret));
-+ });
-+ for my $t (sort @edit_tags) {
-+ next if ($t eq "main");
-+ push @entry_tag, $f1->Entry(-textvariable => \$t, -width => $tagw);
-+ push @entry_loc, $f1->Entry(-textvariable => \$edit_repos{$t}, -width => $locw);
-+ push @entry_del, $f1->Button(-text => __("Delete"));
-+ push @entry_chg, $f1->Button(-text => __("Change"),
++ my $addrepo_button;
++
++
++ sub add_buttons {
++ my ($ref) = @_;
++ my $t = $ref->{'tag'};
++ $ref->{'tag_w'} = $f1->Entry(-textvariable => \$ref->{'tag'}, -state => ($t eq "main" ? 'readonly' : 'normal'), -width => $tagw);
++ $ref->{'val_w'} = $f1->Entry(-textvariable => \$ref->{'val'}, -width => $locw);
++ $ref->{'del_w'} = $f1->Button(-text => __("Delete"),
++ -state => ($t eq "main" ? 'disabled' : 'normal'),
++ -command => sub {
++ $ref->{'status'} = 0;
++ $ref->{'tag_w'}->configure(-state => 'disabled');
++ $ref->{'val_w'}->configure(-state => 'disabled');
++ $ref->{'del_w'}->configure(-state => 'disabled');
++ $ref->{'chg_w'}->configure(-state => 'disabled');
++ });
++ $ref->{'chg_w'} = $f1->Button(-text => __("Change"),
+ -command => sub {
-+ my $ret = ask_one_repository($sw, __("Change subsidiary package repository"),
-+ __("New subsidiary package repository"));
-+ $edit_repos{$t} = $ret if (defined($ret));
++ my $ret = ask_one_repository($sw, __("Change " . ($t eq "main" ? "main" : "subsidiary") . " package repository"),
++ __(($t eq "main" ? "Change main" : "New subsidiary") . " package repository"));
++ $ref->{'val'} = $ret if (defined($ret));
+ });
+ }
-+ # add some "Add ..." line? TODO
-+ for my $i (0..$#entry_tag) {
-+ $entry_tag[$i]->grid( $entry_loc[$i], $entry_del[$i], $entry_chg[$i],
++
++ my %changed_repos = repository_to_array($changeddefaults{'location'}{'value'});
++
++ my @edit_repos;
++ push @edit_repos, { 'tag' => 'main', 'val' => $changed_repos{'main'}, 'status' => 1};
++ for my $k (sort keys %changed_repos) {
++ next if ($k eq "main");
++ push @edit_repos, { 'tag'=> $k, 'val' => $changed_repos{$k}, 'status' => 1 };
++ }
++ for my $ref (@edit_repos) {
++ add_buttons($ref);
++ }
++ for my $ref (@edit_repos) {
++ my %foo = %$ref;
++ $foo{'tag_w'}->grid($foo{'val_w'}, $foo{'del_w'}, $foo{'chg_w'},
+ -padx => "1m", -pady => "1m", -sticky => "nwe");
+ }
++ $addrepo_button = $f1->Button(-text => __("Add repository") . "...",
++ -command => sub {
++ my $ret = ask_one_repository($sw, __("Add package repository"),
++ __("Add package repository"));
++ if (defined($ret)) {
++ $addrepo_button->gridForget;
++ my %foo = ( 'tag' => $ret, 'val' => $ret, 'status' => 1 );
++ add_buttons(\%foo);
++ $foo{'tag_w'}->grid($foo{'val_w'}, $foo{'del_w'}, $foo{'chg_w'},
++ -padx => "1m", -pady => "1m", -sticky => "nwe");
++ push @edit_repos, \%foo;
++ }
++ $addrepo_button->grid(-columnspan => 2, -column => 2);
++ });
++ $addrepo_button->grid(-columnspan => 2, -column => 2);
+
+ $f1->pack;
+
@@ -2549,17 +2611,69 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
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";
++ # we have to check if something has changed ... and for consistency!!!
++ my %new_repos;
++ for my $ref (@edit_repos) {
++ my %foo = %$ref;
++ if ($foo{'status'}) {
++ if (defined($new_repos{$foo{'tag'}})) {
++ $sw->Dialog(-title => __("Warning"),
++ -text => __("Multiple defined tags (first column) are not possible, please fix it."), -buttons => [ __("Ok") ])->Show;
++ return;
++ }
++ $new_repos{$foo{'tag'}} = $foo{'val'};
++ }
++ }
++ my $differs = 0;
++ for my $k (keys %changed_repos) {
++ if (!defined($new_repos{$k})) {
++ $differs = 1;
++ last;
++ }
++ if ($changed_repos{$k} ne $new_repos{$k}) {
++ $differs = 1;
++ last;
++ }
++ }
++ if (!$differs) {
++ # do the same the other way round
++ for my $k (keys %new_repos) {
++ if (!defined($changed_repos{$k})) {
++ $differs = 1;
++ last;
++ }
++ if ($changed_repos{$k} ne $new_repos{$k}) {
++ $differs = 1;
++ last;
++ }
++ }
++ }
++ if ($differs) {
++ # print "current repos:\n";
++ # for my $ref (@edit_repos) {
++ # print "tag = $ref->{'tag'}\n";
++ # print "val = $ref->{'val'}\n";
++ # print "act = $ref->{'status'}\n";
++ # }
++ $changeddefaults{'location'}{'value'} = array_to_repository(%new_repos);
++ $changeddefaults{'location'}{'display'} = __("multiple repositories");
++ my @vals = map { "$_:$new_repos{$_}" }
++ sort sort_main_first keys %new_repos;
++ $location_button->configure(
++ -command => sub { transient_show_multiple_repos($location_button, @vals); });
++ } else {
++ # print "Nothing happend!\n";
++ }
$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");
+ my $resetbutton = $f->Button(-text => __("Revert"),
-+ -command => sub { print "TODO REVERT SETTINGS\n"; })->pack(-side => 'right',-padx => "2m", -pady => "2m");
++ -command => sub { $sw->destroy; menu_multi_location($mw); })->pack(-side => 'right',-padx => "2m", -pady => "2m");
$f->pack(-expand => 'x');
$sw->bind('<Return>', [ $okbutton, 'Invoke' ]);
$sw->bind('<Escape>', [ $cancelbutton, 'Invoke' ]);
-@@ -1554,19 +1689,27 @@
+@@ -1554,19 +1791,27 @@
sub setup_location {
my $loc = shift;
$location = $loc;
@@ -2592,7 +2706,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
$mw->Unbusy;
if (!defined($remotetlpdb)) {
# something went badly wrong, maybe the newroot is wrong?
-@@ -1725,7 +1868,7 @@
+@@ -1725,7 +1970,7 @@
# sub populate_Packages
#
sub populate_Packages {
@@ -2601,7 +2715,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
my $p = $tlp->name;
$Packages{$p}{'displayname'} = $p;
if ($mode eq "local") {
-@@ -1736,6 +1879,10 @@
+@@ -1736,6 +1981,10 @@
$Packages{$p}{'tlp'} = $tlp;
} else {
$Packages{$p}{'remoterevision'} = $tlp->revision;
@@ -2612,7 +2726,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
$Packages{$p}{'selected'} = 0
unless defined $Packages{$p}{'selected'};
if (!defined($Packages{$p}{'tlp'})) {
-@@ -1865,6 +2012,7 @@
+@@ -1865,6 +2114,7 @@
next;
}
delete $Packages{$p}{'remoterevision'};
@@ -2620,7 +2734,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
delete $Packages{$p}{'remotecatalogueversion'};
}
if (defined($remotetlpdb)) {
-@@ -1875,8 +2023,15 @@
+@@ -1875,8 +2125,15 @@
push @do_later_media, $p;
next;
}
@@ -2638,7 +2752,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
}
}
my @avail_arch = $localtlpdb->available_architectures;
-@@ -1886,9 +2041,16 @@
+@@ -1886,9 +2143,16 @@
tlerror("very strange, above it matched and now not anymore?!?! $p\n");
next;
}
@@ -2657,7 +2771,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
} else {
# two cases:
# - $mp.$ma where $ma is in available_archs
-@@ -1926,7 +2088,7 @@
+@@ -1926,7 +2190,7 @@
} else {
# only show that one if it is locally installed
if (defined($Packages{$p})) {
@@ -2666,7 +2780,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
}
}
}
-@@ -2216,7 +2378,47 @@
+@@ -2216,7 +2480,47 @@
sub update_loaded_location_string {
my $arg = shift;
$arg || ($arg = $location);
@@ -2675,7 +2789,7 @@ Index: texmf/scripts/texlive/tlmgrgui.pl
+ my @tags = sort keys %repos;
+ my @vals;
+ if ($#tags > 0) {
-+ @vals = sort map { "$_:$repos{$_}" } @tags;
++ @vals = map { "$_:$repos{$_}" } sort sort_main_first @tags;
+ } else {
+ @vals = ( $arg );
+ }