diff options
Diffstat (limited to 'Master/tlpkg/dev/dev.multi-source-support.patches/001-extend-tlpdb-option-location-field-add-action')
-rw-r--r-- | Master/tlpkg/dev/dev.multi-source-support.patches/001-extend-tlpdb-option-location-field-add-action | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/Master/tlpkg/dev/dev.multi-source-support.patches/001-extend-tlpdb-option-location-field-add-action b/Master/tlpkg/dev/dev.multi-source-support.patches/001-extend-tlpdb-option-location-field-add-action deleted file mode 100644 index aa280988c7d..00000000000 --- a/Master/tlpkg/dev/dev.multi-source-support.patches/001-extend-tlpdb-option-location-field-add-action +++ /dev/null @@ -1,128 +0,0 @@ -Allow more than one repository in the tlpdb/option-location field -The format is: - repo1[#tag] repo2[#tag] ... -the tags are optional. -This patch only adds support for a new action "repository" that lists, -adds, removes, sets repositories according to this format. -It does not change tlmgr to allow actually working with it. ---- - texmf/scripts/texlive/tlmgr.pl | 99 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 99 insertions(+) - -Index: Master/texmf/scripts/texlive/tlmgr.pl -=================================================================== ---- Master.orig/texmf/scripts/texlive/tlmgr.pl 2010-05-02 01:31:56.000000000 +0900 -+++ Master/texmf/scripts/texlive/tlmgr.pl 2010-05-02 01:32:12.000000000 +0900 -@@ -455,6 +455,9 @@ - } elsif ($action =~ m/^option$/i) { - action_option(); - finish(0); -+ } elsif ($action =~ m/^repository$/i) { -+ action_repository(); -+ finish(0); - } elsif ($action =~ m/^list$/i) { - action_list(); - finish(0); -@@ -2839,6 +2842,102 @@ - return; - } - -+# REPOSITORY -+# -+# this action manages the list of repositories -+# tlmgr repository list -> lists repositories -+# tlmgr repository add path [tag] -> add repository with optional tag -+# tlmgr repository remove [path|tag] -> removes repository or tag -+# tlmgr repository set path[#tag] [path[#tag] ...] -> sets the list -+# -+ -+sub array_to_repository { -+ my %r = @_; -+ my @ret; -+ for my $k (keys %r) { -+ my $v = $r{$k}; -+ if ($k eq $v) { -+ push @ret, $k; -+ } else { -+ push @ret, "$v#$k"; -+ } -+ } -+ return "@ret"; -+} -+sub repository_to_array { -+ my $r = shift; -+ my %r; -+ for my $rr (split ' ', $r) { -+ if ($rr =~ m/^([^#]+)#(.*)$/) { -+ $r{$2} = $1; -+ } else { -+ $r{$rr} = $rr; -+ } -+ } -+ return %r; -+} -+sub action_repository { -+ init_local_db(); -+ my $what = shift @ARGV; -+ my %repos = repository_to_array($localtlpdb->option("location")); -+ if ($what =~ m/^list$/i) { -+ print "List of repositories (with tags if set):\n"; -+ for my $k (keys %repos) { -+ my $v = $repos{$k}; -+ print "\t$v"; -+ if ($k ne $v) { -+ print " ($k)"; -+ } -+ print "\n"; -+ } -+ return; -+ } -+ if ($what eq "add") { -+ my $p = shift @ARGV; -+ if (!defined($p)) { -+ tlwarn("You need to give a new repository aas 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"); -+ return; -+ } -+ # TODO more checks needed? -+ $repos{$t} = $p; -+ $localtlpdb->option("location", array_to_repository(%repos)); -+ $localtlpdb->save; -+ return; -+ } -+ if ($what eq "remove") { -+ my $p = shift @ARGV; -+ if (!defined($p)) { -+ tlwarn("Which repository should be removed?\n"); -+ return; -+ } -+ my $found = 0; -+ for my $k (keys %repos) { -+ if ($k eq $p || $repos{$k} eq $p) { -+ $found = 1; -+ delete $repos{$k}; -+ } -+ } -+ if (!$found) { -+ tlwarn("Cannot find the repository $p\n"); -+ } else { -+ $localtlpdb->option("location", array_to_repository(%repos)); -+ $localtlpdb->save; -+ } -+ return; -+ } -+ if ($what eq "set") { -+ %repos = repository_to_array("@ARGV"); -+ $localtlpdb->option("location", array_to_repository(%repos)); -+ $localtlpdb->save; -+ } -+} -+ - - # OPTION - # |