diff options
author | Norbert Preining <preining@logic.at> | 2008-09-09 13:14:40 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-09-09 13:14:40 +0000 |
commit | 1f94d4b7cb33b5c119e7898dcc703cff7d949426 (patch) | |
tree | 8d17f2785faba899cfa5fcb21699d6c5b0c7f222 /Master | |
parent | 2a4b2ba670f77b942e2a556a6800bb7d13a3ff34 (diff) |
update multi-source-support patch, now we have (optional) tags in the
location lines
location:/foo/bar/baz local
git-svn-id: svn://tug.org/texlive/trunk@10514 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/etc/multi-source-support.diff | 401 |
1 files changed, 246 insertions, 155 deletions
diff --git a/Master/tlpkg/etc/multi-source-support.diff b/Master/tlpkg/etc/multi-source-support.diff index 33852f66b3b..feffbb91962 100644 --- a/Master/tlpkg/etc/multi-source-support.diff +++ b/Master/tlpkg/etc/multi-source-support.diff @@ -1,6 +1,141 @@ ---- /src/TeX/texlive-svn/Master/texmf/scripts/texlive/tlmgr.pl 2008-08-30 09:54:32.000000000 +0200 -+++ texmf/scripts/texlive/tlmgr.pl 2008-08-30 09:53:32.000000000 +0200 -@@ -45,15 +45,19 @@ +--- /src/TeX/texlive-svn/Master/tlpkg/TeXLive/TLPDB.pm 2008-09-06 19:11:52.000000000 +0200 ++++ tlpkg/TeXLive/TLPDB.pm 2008-09-09 15:11:23.000000000 +0200 +@@ -819,26 +819,25 @@ + =cut + + sub _set_option_value { +- my ($self,$key,$value) = @_; ++ my ($self,$key,@values) = @_; + my $pkg = $self->{'tlps'}{'00texlive-installation.config'}; + my @newdeps; + if (!defined($pkg)) { + $pkg = new TeXLive::TLPOBJ; + $pkg->name("00texlive-installation.config"); + $pkg->category("TLCore"); +- push @newdeps, "$key:$value"; ++ for my $v (@values) { ++ push @newdeps, "$key:$v"; ++ } + } else { + my $found = 0; + foreach my $d ($pkg->depends) { +- if ($d =~ m!^$key:!) { +- $found = 1; +- push @newdeps, "$key:$value"; +- } else { ++ if ($d !~ m!^$key:!) { + push @newdeps, $d; + } + } +- if (!$found) { +- push @newdeps, "$key:$value"; ++ for my $v (@values) { ++ push @newdeps, "$key:$v"; + } + } + $pkg->depends(@newdeps); +@@ -847,13 +846,14 @@ + + sub _option_value { + my ($self,$key) = @_; ++ my @l = (); + if (defined($self->{'tlps'}{'00texlive-installation.config'})) { + foreach my $d ($self->{'tlps'}{'00texlive-installation.config'}->depends) { + if ($d =~ m!^$key:(.*)$!) { +- return "$1"; ++ push @l, "$1"; + } + } +- return ""; ++ return(wantarray ? @l : (@l ? $l[0] : "") ); + } + return; + } +@@ -889,15 +889,74 @@ + if (@_) { $self->_set_option_value("opt_paper", shift); } + return $self->_option_value("opt_paper"); + } +-sub option_location { +- my $self = shift; +- if (@_) { $self->_set_option_value("location", shift); } +- my $loc = $self->_option_value("location"); +- if ($loc eq "__MASTER__") { +- return $self->root; ++# ++=pod ++ ++=item C<< $tlpdb->option_locations >> ++ ++Returns a list of tag and locations, so can be assigned to a hash. ++ ++=cut ++ ++sub option_locations { ++ my $self = shift; ++ if (@_) { ++ my %foo = @_; ++ my @l = (); ++ for my $k (keys %foo) { ++ if ($k eq $foo{$k}) { ++ # no specific tag ++ push @l, "$k"; ++ } else { ++ push @l, "$foo{$k} $k"; ++ } ++ } ++ $self->_set_option_value("location", @l); + } +- return $self->_option_value("location"); ++ my @locs = $self->_option_value("location"); ++ # the locations might contain a tag, the lines are of format ++ # location tag ++ my @ret = (); ++ for my $l (@locs) { ++ my $loc; ++ my $tag; ++ if ($l =~ m/^([^ ]+)[[:space:]]+(.*)[[:space:]]*$/) { ++ $loc = "$1"; ++ $tag = "$2"; ++ debug("reading locations, found loc=$loc, tag=$tag\n"); ++ } else { ++ $loc = $tag = $l; ++ } ++ # we return a hash as list ... ++ if ($loc eq "__MASTER__") { ++ push @ret, $self->root, $self->root; ++ } else { ++ push @ret, $tag, $loc; ++ } ++ } ++ return(@ret); ++} ++ ++sub add_locations { ++ my ($self, %locs) = @_; ++ my %foo = $self->option_locations; ++ for my $l (keys %locs) { ++ $foo{$l} = $locs{$l}; ++ } ++ $self->option_locations(%foo); ++ return(%foo); ++} ++ ++sub remove_locations { ++ my ($self, %locs) = @_; ++ my %foo = $self->option_locations; ++ for my $l (keys %locs) { ++ delete $foo{$l} ++ } ++ $self->option_locations(%foo); ++ return(%foo); + } ++ + sub option_sys_bin { + my $self = shift; + if (@_) { $self->_set_option_value("opt_sys_bin", shift); } +--- /src/TeX/texlive-svn/Master/texmf/scripts/texlive/tlmgr.pl 2008-09-08 17:19:03.000000000 +0200 ++++ texmf/scripts/texlive/tlmgr.pl 2008-09-09 13:08:45.000000000 +0200 +@@ -48,15 +48,19 @@ # used variables # the TLMedia from which we install/update @@ -19,11 +154,11 @@ my %options; # the location from where we install -my $location; -+my @locations; ++my %locations; # option handling my $opt_location; -@@ -411,15 +415,13 @@ +@@ -414,15 +418,13 @@ } init_local_db(); foreach my $pkg (@ARGV) { @@ -42,7 +177,7 @@ } else { $installed = 1; } -@@ -429,6 +431,7 @@ +@@ -432,6 +434,7 @@ print "ShortDesc: ", $tlp->shortdesc, "\n" if ($tlp->shortdesc); print "LongDesc: ", $tlp->longdesc, "\n" if ($tlp->longdesc); print "Installed: ", ($installed?"Yes\n":"No\n"); @@ -50,7 +185,7 @@ print "\n"; } else { printf STDERR "Cannot find $pkg\n"; -@@ -445,17 +448,22 @@ +@@ -448,17 +451,22 @@ "file" => \$opt_file) or pod2usage(2); my $r = shift @ARGV; my $ret = ""; @@ -78,7 +213,7 @@ if (@ret) { print "$pkg:\n"; foreach (@ret) { -@@ -464,9 +472,9 @@ +@@ -467,9 +475,9 @@ } } else { next if ($pkg =~ m/\./); @@ -90,7 +225,7 @@ $lt |= ""; if (($pkg =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) { $ret .= " $pkg - $t\n"; -@@ -611,7 +619,6 @@ +@@ -614,7 +622,6 @@ "dry-run" => \$opt_dry) or pod2usage(2); my %ret; init_tlmedia(); @@ -98,7 +233,42 @@ my @todo; if ($opt_all || $opt_list) { @todo = $localtlpdb->list_packages; -@@ -631,18 +638,22 @@ +@@ -625,19 +632,22 @@ + # we check for new packages + # loop over all installed collections + for my $c ($localtlpdb->collections) { +- my $tlc = $mediatlpdb->get_package($c); +- if (!defined($tlc)) { ++ my ($maxsrc, $maxrev) = install_candidate($c); ++ if (!defined($maxsrc)) { + debug("collection $c has disappeared from the network!\n"); +- } else { +- # take all the dependencies of the installed collection +- # *as*found* in the network tlpdb +- for my $d ($tlc->depends) { +- my $tlp = $localtlpdb->get_package($d); +- if (!defined($tlp)) { +- # there is a dep that is either new or has been forcibly removed +- # report it as new/forcibly removed +- info("package $d ($c) is new (or has been forcibly removed)\n"); +- } ++ next; ++ } ++ my $tlc = $tlmediatlpdb{$maxsrc}->get_package($c); ++ if (!defined($tlc)) { ++ debug("That should not happen!!!\n"); ++ next; ++ } ++ for my $d ($tlc->depends) { ++ my $tlp = $localtlpdb->get_package($d); ++ if (!defined($tlp)) { ++ # there is a dep that is either new or has been forcibly removed ++ # report it as new/forcibly removed ++ info("package $d ($c) is new (or has been forcibly removed)\n"); + } + } + } +@@ -655,18 +665,22 @@ next; } my $rev = $tlp->revision; @@ -107,7 +277,7 @@ - debug("$pkg cannot be found in $location\n"); + my ($maxsrc, $maxrev) = install_candidate($pkg); + if (!defined($maxsrc)) { -+ debug("$pkg cannot be found in any of @locations\n"); ++ debug("$pkg cannot be found in any of " . values(%locations). "\n"); next; } - my $mediarev = $mediatlp->revision; @@ -128,7 +298,7 @@ } else { # first remove the package, then reinstall it # this way we get rid of useless files -@@ -682,7 +693,7 @@ +@@ -706,7 +720,7 @@ # these packages cannot be upgrade on win32 # so we have to create a update program my $media = $tlmediasrc->media; @@ -137,7 +307,7 @@ my $root = $localtlpdb->root; my $temp = "$root/temp"; TeXLive::TLUtils::mkdirhier($temp); -@@ -716,8 +727,8 @@ +@@ -740,8 +754,8 @@ print "update: $pkg done\n"; } } @@ -148,7 +318,7 @@ next; } } -@@ -737,13 +748,23 @@ +@@ -761,13 +775,23 @@ ); tlwarn("UPDATER has been created, please execute tlpkg\\installer\\updater.bat\n"); } @@ -179,7 +349,7 @@ } return(\%ret); } -@@ -766,7 +787,12 @@ +@@ -790,7 +814,12 @@ print "install: $pkg\n"; } else { # install the packages and run postinstall actions (that is the 0) @@ -193,7 +363,7 @@ } } if ($opt_dry) { -@@ -781,13 +807,17 @@ +@@ -805,13 +834,17 @@ my $what = shift @ARGV; $what || ($what = ""); init_tlmedia(); @@ -215,7 +385,7 @@ } foreach (@whattolist) { if (defined($localtlpdb->get_package($_))) { -@@ -795,7 +825,7 @@ +@@ -819,7 +852,7 @@ } else { print " "; } @@ -224,13 +394,15 @@ print "$_: ", defined($foo) ? $foo : "(shortdesc missing)" , "\n"; } return; -@@ -809,15 +839,53 @@ +@@ -833,17 +866,68 @@ $what = "show" unless defined($what); init_local_db(); if ($what =~ m/^location$/i) { - # changes the default location - my $loc = shift @ARGV; - if ($loc) { +- # normalize the path +- $loc = abs_path($loc); - print "Setting default installation source to $loc!\n"; - $localtlpdb->option_location($loc); - $localtlpdb->save; @@ -254,10 +426,18 @@ + for my $a (@locargs) { + push @locs, split(/,/,$a); + } ++ my %locs; ++ for my $l (@locs) { ++ if ($l =~ m;^(.+)=(.+)$;) { ++ $locs{$2} = "$1"; ++ } else { ++ $locs{$l} = $l; ++ } ++ } + if ($mode eq "add") { + if (@locs) { + print "Adding @locs to the list of installation sources!\n"; -+ $localtlpdb->add_locations(@locs); ++ $localtlpdb->add_locations(%locs); + } else { + tlwarn("Need some argument for location add!\n"); + exit(1); @@ -265,7 +445,7 @@ + } elsif ($mode eq "remove") { + if (@locs) { + print "Removing @locs from the list of installation sources!\n"; -+ $localtlpdb->remove_locations(@locs); ++ $localtlpdb->remove_locations(%locs); + } else { + tlwarn("Need some argument for location remove!\n"); + exit(1); @@ -274,10 +454,17 @@ - print "Default installation source: ", $localtlpdb->option_location, "\n"; + if (@locs) { + print "Settings @locs as list of installation sources!\n"; -+ $localtlpdb->option_locations(@locs); ++ $localtlpdb->option_locations(%locs); + } else { -+ for my $l ($localtlpdb->option_locations) { -+ print "Installation source: ", $l, "\n"; ++ my %lo = $localtlpdb->option_locations; ++ for my $t (keys %lo) { ++ print "Installation source: "; ++ if ($t eq $lo{$t}) { ++ # no tag specified ++ print "$t\n"; ++ } else { ++ print "$lo{$t} (tag $t)\n"; ++ } + } + } } @@ -285,7 +472,7 @@ } elsif ($what =~ m/^docfiles$/i) { # changes the default docfiles my $loc = shift @ARGV; -@@ -877,10 +945,16 @@ +@@ -903,10 +987,16 @@ # list the available architectures # initialize the TLMedia from $location init_tlmedia(); @@ -304,7 +491,7 @@ if (member($a,@already_installed_arch)) { print "(i) $a\n"; } else { -@@ -892,9 +966,15 @@ +@@ -918,9 +1008,15 @@ exit(0); } elsif ($what =~ m/^add$/i) { init_tlmedia(); @@ -322,7 +509,7 @@ my @todoarchs; foreach my $a (@ARGV) { if (TeXLive::TLUtils::member($a, @already_installed_arch)) { -@@ -917,7 +997,13 @@ +@@ -943,7 +1039,13 @@ if ($opt_dry) { print "Installing $pkg.$a\n"; } else { @@ -337,7 +524,7 @@ } } } -@@ -925,9 +1011,14 @@ +@@ -951,9 +1053,14 @@ } if (TeXLive::TLUtils::member('win32', @todoarchs)) { # install the necessary win32 stuff @@ -355,7 +542,7 @@ } # update the option_archs list of installed archs my @larchs = $localtlpdb->option_available_architectures; -@@ -1000,14 +1091,11 @@ +@@ -1026,18 +1133,30 @@ } } # let cmd line options override the settings in localtlpdb @@ -363,17 +550,38 @@ - if (defined($loc)) { - $location = $loc; - } -+ @locations = $localtlpdb->option_locations; ++ %locations = $localtlpdb->option_locations; if (defined($opt_location)) { - $location = $opt_location; -+ @locations = split /,/, $opt_location; ++ %locations = (); ++ for my $c (split /,/, $opt_location) { ++ $locations{$c} = $c; ++ } } - if (!defined($location)) { -+ if (!@locations) { ++ if (! keys(%locations)) { die("No installation source found, nor in the texlive.tlpdb nor on the cmd line.\nPlease specify one!"); } +- # normalize the location +- $location = abs_path($location); ++ # normalize all paths ++ for my $c (keys %locations) { ++ if ($c eq $locations{$c}) { ++ my $newc = abs_path($c); ++ if ($c ne $newc) { ++ delete $locations{$c}; ++ $locations{$newc} = $newc; ++ } ++ } else { ++ my $foo = $locations{$c}; ++ $foo = abs_path($foo); ++ $locations{$c} = $foo; ++ } ++ } } -@@ -1181,18 +1269,65 @@ + + sub action_gui { +@@ -1209,18 +1328,66 @@ # initialize a tlmedia object and returns it, or dies # sub init_tlmedia { @@ -387,7 +595,8 @@ - die($loadmediasrcerror . $location) unless defined($tlmediasrc); + return if $tlmedia_loaded; + my $found = 0; -+ for my $l (@locations) { ++ for my $t (keys %locations) { ++ my $l = $locations{$t}; + my $location = $l; + if (($location =~ m/$TeXLiveServerURL/) || + ($location =~ m/^ctan$/i)) { @@ -395,17 +604,17 @@ + info("Using mirror $location\n"); + } + # $tlmediasrc is a global function -+ $tlmediasrc{$l} = TeXLive::TLMedia->new($location); -+ if (defined($tlmediasrc{$l})) { ++ $tlmediasrc{$t} = TeXLive::TLMedia->new($location); ++ if (defined($tlmediasrc{$t})) { + $found++; -+ $tlmediatlpdb{$l} = $tlmediasrc{$l}->tlpdb; ++ $tlmediatlpdb{$t} = $tlmediasrc{$t}->tlpdb; + } else { + info($loadmediasrcerror . $location); + } + } + if (!$found) { + # we didn't find any useable installation media, die here! -+ die("Cannot find any useable installation source in one of the following locations:\n@locations\nStopping here!"); ++ die("Cannot find any useable installation source in one of the following locations:\n", values(%locations), "\nStopping here!"); + } + # now we initialize the %media_packages + my @allpkgs; @@ -448,121 +657,3 @@ # # return all the directories from which all content will be removed ---- /src/TeX/texlive-svn/Master/tlpkg/TeXLive/TLPDB.pm 2008-08-22 14:52:11.000000000 +0200 -+++ tlpkg/TeXLive/TLPDB.pm 2008-08-30 10:03:38.000000000 +0200 -@@ -819,26 +819,25 @@ - =cut - - sub _set_option_value { -- my ($self,$key,$value) = @_; -+ my ($self,$key,@values) = @_; - my $pkg = $self->{'tlps'}{'00texlive-installation.config'}; - my @newdeps; - if (!defined($pkg)) { - $pkg = new TeXLive::TLPOBJ; - $pkg->name("00texlive-installation.config"); - $pkg->category("TLCore"); -- push @newdeps, "$key:$value"; -+ for my $v (@values) { -+ push @newdeps, "$key:$v"; -+ } - } else { - my $found = 0; - foreach my $d ($pkg->depends) { -- if ($d =~ m!^$key:!) { -- $found = 1; -- push @newdeps, "$key:$value"; -- } else { -+ if ($d !~ m!^$key:!) { - push @newdeps, $d; - } - } -- if (!$found) { -- push @newdeps, "$key:$value"; -+ for my $v (@values) { -+ push @newdeps, "$key:$v"; - } - } - $pkg->depends(@newdeps); -@@ -847,13 +846,14 @@ - - sub _option_value { - my ($self,$key) = @_; -+ my @l = (); - if (defined($self->{'tlps'}{'00texlive-installation.config'})) { - foreach my $d ($self->{'tlps'}{'00texlive-installation.config'}->depends) { - if ($d =~ m!^$key:(.*)$!) { -- return "$1"; -+ push @l, "$1"; - } - } -- return ""; -+ return(wantarray ? @l : (@l ? $l[0] : "") ); - } - return; - } -@@ -889,15 +889,62 @@ - if (@_) { $self->_set_option_value("opt_paper", shift); } - return $self->_option_value("opt_paper"); - } -+sub option_locations { -+ my $self = shift; -+ if (@_) { $self->_set_option_value("location", @_); } -+ my @locs = $self->_option_value("location"); -+ my @ret = (); -+ for my $l (@locs) { -+ if ($l eq "__MASTER__") { -+ push @ret, $self->root; -+ } else { -+ push @ret, $l; -+ } -+ } -+ return(@ret); -+} -+ -+sub add_locations { -+ my ($self, @locs) = @_; -+ my %foo; -+ for my $l ($self->option_locations) { -+ $foo{$l} = 1; -+ } -+ for my $l (@locs) { -+ $foo{$l} = 1; -+ } -+ $self->option_locations(keys %foo); -+ return(keys %foo); -+} -+ -+sub remove_locations { -+ my ($self, @locs) = @_; -+ my %foo; -+ for my $l ($self->option_locations) { -+ $foo{$l} = 1; -+ } -+ for my $l (@locs) { -+ delete $foo{$l} -+ } -+ $self->option_locations(keys %foo); -+ return(keys %foo); -+} -+ -+# -+# we keep that for backward compatibility -+# option_location is used in the installer, probably nothing else is -+# using it - sub option_location { - my $self = shift; - if (@_) { $self->_set_option_value("location", shift); } -- my $loc = $self->_option_value("location"); -+ # since we are in scalar context that returns the first location in the list! -+ my $loc = $self->option_locations; - if ($loc eq "__MASTER__") { - return $self->root; - } -- return $self->_option_value("location"); -+ return $loc; - } -+ - sub option_sys_bin { - my $self = shift; - if (@_) { $self->_set_option_value("opt_sys_bin", shift); } |