From befd7dc9bff2cd4c9b45d17264cd9bf0f69fb58d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 1 Oct 2008 15:10:55 +0000 Subject: update the rework patch with documentation for the various options git-svn-id: svn://tug.org/texlive/trunk@10813 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/etc/rework-tlmgr-install-logic.patch | 1159 ++++++++++++++++----- 1 file changed, 911 insertions(+), 248 deletions(-) (limited to 'Master/tlpkg/etc') diff --git a/Master/tlpkg/etc/rework-tlmgr-install-logic.patch b/Master/tlpkg/etc/rework-tlmgr-install-logic.patch index eec8c1b2abe..7407c5a6b8a 100644 --- a/Master/tlpkg/etc/rework-tlmgr-install-logic.patch +++ b/Master/tlpkg/etc/rework-tlmgr-install-logic.patch @@ -1,249 +1,35 @@ -Index: tlpkg/TeXLive/TLPDB.pm -=================================================================== ---- tlpkg/TeXLive/TLPDB.pm (revision 10798) -+++ tlpkg/TeXLive/TLPDB.pm (working copy) -@@ -33,6 +33,8 @@ - $tlpdb->remove_package($pkg); - $tlpdb->get_package("packagename"); - $tlpdb->list_packages; -+ $tlpdb->expand_dependencies(["-only-arch",] $totlpdb, @list); -+ $tlpdb->expand_dependencies(["-no-collections",] $totlpdb, @list); - $tlpdb->find_file("filename"); - $tlpdb->collections; - $tlpdb->schemes; -@@ -446,6 +448,93 @@ - - =pod - -+=item C<< $tlpdb->expand_dependencies >> -+ -+This function takes as first argument the target TLPDB and then a list of -+packages and returns the closure of this -+list with respect to the depends operator. (Sorry, that was for -+mathematicians) -+ -+If the very first argument is "-only-arch" then it expands only dependencies -+of the form .ARCH. -+ -+=cut -+ -+sub expand_dependencies { -+ my $self = shift; -+ my $only_arch = 0; -+ my $no_collections = 0; -+ my $first = shift; -+ my $totlpdb; -+ if ($first eq "-only-arch") { -+ $only_arch = 1; -+ $totlpdb = shift; -+ } elsif ($first eq "-no-collections") { -+ $no_collections = 1; -+ $totlpdb = shift; -+ } else { -+ $totlpdb = $first; -+ } -+ my %install = (); -+ my @archs = $totlpdb->available_architectures; -+ for my $p (@_) { -+ $install{$p} = 1; -+ } -+ my $changed = 1; -+ while ($changed) { -+ $changed = 0; -+ my @pre_select = keys %install; -+ ddebug("pre_select = @pre_select\n"); -+ for my $p (@pre_select) { -+ next if ($p =~ m/^00texlive/); -+ my $pkg = $self->get_package($p); -+ if (!defined($pkg)) { -+ tlwarn("W: $p is mentioned somewhere but not available, disabling it!\n"); -+ $install{$p} = 0; -+ next; -+ } -+ for my $p_dep ($pkg->depends) { -+ ddebug("checking $p_dep in $p\n"); -+ my $tlpdd = $self->get_package($p_dep); -+ if (defined($tlpdd)) { -+ if ($tlpdd->category =~ m/$MetaCategoriesRegexp/) { -+ # we are taking a look at a dependency which is a collection -+ # or scheme, and if the option "-no-collections" is given -+ # we skip that one -+ ddebug("expand_deps: skipping $p_dep in $p due to -no-collections\n"); -+ next if $no_collections; -+ } -+ } -+ if ($p_dep =~ m/^(.*)\.ARCH$/) { -+ my $foo = "$1"; -+ foreach $a (@archs) { -+ $install{"$foo.$a"} = 1 if defined($self->get_package("$foo.$a")); -+ } -+ } elsif ($p_dep =~ m/^(.*)\.win32$/) { -+ # a win32 package should *only* be installed if we are installing -+ # the win32 arch -+ if (grep(/^win32$/,@archs)) { -+ $install{$p_dep} = 1; -+ } -+ } else { -+ $install{$p_dep} = 1 unless $only_arch; -+ } -+ } -+ } -+ -+ # check for newly selected packages -+ my @post_select = keys %install; -+ ddebug("post_select = @post_select\n"); -+ ddebug("nr pre select $#pre_select, nr post select $#post_select\n"); -+ if ($#pre_select != $#post_select) { -+ $changed = 1; -+ } -+ } -+ return(keys %install); -+} -+ -+=pod -+ - =item C<< $tlpdb->find_file("filename") >> - - The C returns a list of packages:filename -Index: tlpkg/TeXLive/TLMedia.pm -=================================================================== ---- tlpkg/TeXLive/TLMedia.pm (revision 10798) -+++ tlpkg/TeXLive/TLMedia.pm (working copy) -@@ -89,14 +89,14 @@ - # returns a scalar (0) on error - # returns a reference to a hash with actions on success - sub install_package { -- my ($self, $pkg, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia) = @_; -+ my ($self, $pkg, $totlpdb, $nopostinstall, $fallbackmedia) = @_; - my $fromtlpdb = $self->tlpdb; - my $ret; - die("TLMedia not initialized, cannot find tlpdb!") unless (defined($fromtlpdb)); - my $tlpobj = $fromtlpdb->get_package($pkg); - if (!defined($tlpobj)) { - if (defined($fallbackmedia)) { -- if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nodepends, $nopostinstall)) { -+ if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nopostinstall)) { - debug("installed $pkg from fallback"); - return $ret; - } else { -@@ -204,37 +204,6 @@ - # compute the return value - my %ret; - merge_into(\%ret, $tlpobj->make_return_hash_from_executes("enable")); -- # now install all the depends if they are not already present -- # NOTE: installation of .ARCH dependencies is done in *ANY*CASE*, regardless -- # of the $nodepends setting -- foreach my $d ($tlpobj->depends) { -- if ($d =~ m/^(.*)\.ARCH$/) { -- # we only want to try to install a .ARCH package if it actually contains -- # files -- my $foo = $1; -- foreach my $a ($totlpdb->available_architectures) { -- if (defined($fromtlpdb->get_package("$foo.$a")) && -- !defined($totlpdb->get_package("$foo.$a"))) { -- merge_into(\%ret, -- $self->install_package("$foo.$a", $totlpdb, $nodepends, $fallbackmedia, 0)); -- } -- } -- } elsif ($d =~ m/^(.*).win32$/) { -- # install only of win32 is under the available archs -- if (TeXLive::TLUtils::member("win32",$totlpdb->available_architectures)) { -- merge_into(\%ret, -- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); -- } -- } else { -- if (!$nodepends) { -- if (!defined($totlpdb->get_package($d))) { -- # we have to install it! -- merge_into(\%ret, -- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); -- } -- } -- } -- } - if (!$nopostinstall) { - # do the postinstallation actions - if (defined($PostInstall{$pkg})) { Index: texmf/scripts/texlive/tlmgr.pl =================================================================== --- texmf/scripts/texlive/tlmgr.pl (revision 10809) +++ texmf/scripts/texlive/tlmgr.pl (working copy) -@@ -32,6 +32,74 @@ +@@ -13,16 +13,7 @@ + # tlmgr fileassoc pdf psv + # tlmgr fileassoc ps psv + # only setting is possible +-# - tlmgr update collection-foobar should check for updates of all +-# dependencies, too, so that tlmgr update collection-foobar will get updates +-# to sub-packages anyway. +-# - update and install should work differently: +-# . create a list of all packages to be installed together with +-# the depends closure operation +-# . call TLMedia->install_package so that deps are NOT installed +-# since all deps are actually installed from tlmgr itself +-# - reinstall a package: assume that i want to donwgrade from a different +-# mirror or I want to fix an accidentally removed file ++# Not really necessary?!! + # - ordering or collections removal (see below for details) + # - (?) removal does not remove created format files from TEXMFSYSVAR + # - after install/update show the number of bytes transfered +@@ -32,6 +23,8 @@ # - move the remove_package function into TLPDB.pm, so that the remove_package # from TLPDB actually removes the files, too. Maybe some better names # are necessary. ++# Maybe not a good idea ... not sure. +# -+# -+# Some documentation I need to remember myself: -+# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever -+# anymore!!!! That has all to be done by hand. -+# -+# INSTALL -+# -+# tlmgr install foo bar baz -+# will create the closure under dependencies of {foo,bar,baz}, i.e. all -+# dependencies recursively down to the last package, and install all -+# the packages that are necessary -+# -+# tlmgr install --no-depends foo bar baz -+# will *only* install these three packages (if they are not already installed -+# but it will STILL INSTALL foo.ARCH if they are necessary!! -+# -+# tlmgr install --really-no-depends foo bar baz -+# will absolutely only install these three packages, and will not even -+# take .ARCH deps into account -+# -+# tlmgr install --reinstall ... -+# behaves exactely like without --reinstall BUT the following two -+# differences: -+# . dependencies are not expanded from collection to collection, so -+# if you reinstall a collection then all its dependencies of type -+# Package will be reinstalled, too, but not the dependencies on -+# other collection, because that would force the full reinstallation -+# of the whole installation -+# . it does not care for whether a package seems to be installed or -+# not (that is the --reinstall) -+# -+# REMOVE -+# -+# tlmgr remove foo bar baz -+# will remove the packages foo bar baz itself -+# and will remove all .ARCH dependencies, too -+# and if some of them are collections it will also remove the -+# depending packs which are NOT Collections|Schemes!!! -+# if some of them are referenced somewhere they will not be removed -+# unless --force given -+# -+# tlmgr remove --no-depends foo bar baz -+# will remove the packages foo bar baz itself without any dependencies -+# but it will still remove all .ARCH dependency -+# if some of them are referenced somewhere they will not be removed -+# unless --force given -+# -+# tlmgr remove --really-no-depends foo bar baz -+# willabsolutely only install foo bar baz not even taking .ARCH into -+# account -+# -+# UPDATE -+# -+# tlmgr update foo -+# if foo is of type Package|Documentation it will update only foo -+# and the respective .ARCH dependencies -+# if foo is of type Collection|Scheme it will update itself AND -+# will check all depending packs of type NOT(COllection|Scheme) -+# for necessary updates -+# -+# tlmgr update --no-depends foo -+# as above, but will not check for depends of Collections/Schemes -+# but it will still update .ARCH deps -+# -+# tlmgr update --really-no-depends foo -+# will absolutely only update foo not even taking .ARCH into account -+# my $svnrev = '$Revision$'; my $tlmgrrevision; -@@ -293,18 +361,6 @@ +@@ -293,18 +286,6 @@ $localtlpdb->remove_package($pkg); merge_into(\%ret, $tlp->make_return_hash_from_executes("disable")); $ret{'mktexlsr'} = 1; @@ -262,7 +48,7 @@ Index: texmf/scripts/texlive/tlmgr.pl # should we save at each removal??? # advantage: the tlpdb actually reflects what is installed # disadvantage: removing a collection calls the save routine several times -@@ -319,6 +375,26 @@ +@@ -319,6 +300,26 @@ return \%ret; } @@ -289,7 +75,7 @@ Index: texmf/scripts/texlive/tlmgr.pl sub action_remove { if ($opt_gui) { action_gui("remove"); -@@ -340,16 +416,24 @@ +@@ -340,16 +341,24 @@ # my %ret; my $opt_nodepends = 0; @@ -315,7 +101,7 @@ Index: texmf/scripts/texlive/tlmgr.pl my $tlp = $localtlpdb->get_package($pkg); next if defined($already_removed{$pkg}); if (!defined($tlp)) { -@@ -376,20 +460,6 @@ +@@ -376,20 +385,6 @@ # remove dependencies, too merge_into(\%ret, \%foo); $already_removed{$pkg} = 1; @@ -336,7 +122,7 @@ Index: texmf/scripts/texlive/tlmgr.pl } } else { # save all the other packages into the @more_removal list to -@@ -400,7 +470,7 @@ +@@ -400,7 +395,7 @@ } } } @@ -345,7 +131,7 @@ Index: texmf/scripts/texlive/tlmgr.pl if (!defined($already_removed{$pkg})) { info ("remove $pkg\n"); if (!$opt_dry) { -@@ -625,6 +695,22 @@ +@@ -625,6 +620,24 @@ } @@ -365,10 +151,12 @@ Index: texmf/scripts/texlive/tlmgr.pl +# tlmgr update --really-no-depends foo +# will absolutely only update foo not even taking .ARCH into account +# ++# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever ++# anymore!!!! That has all to be done by hand. sub action_update { if ($opt_gui) { action_gui("update"); -@@ -632,6 +718,7 @@ +@@ -632,6 +645,7 @@ init_local_db(1); # initialize the TLMedia from $location my $opt_nodepends = 0; @@ -376,7 +164,7 @@ Index: texmf/scripts/texlive/tlmgr.pl my $opt_dry = 0; my $opt_all = 0; my $opt_list = 0; -@@ -639,11 +726,13 @@ +@@ -639,11 +653,13 @@ my $opt_backupdir; Getopt::Long::Configure(qw(no_pass_through)); GetOptions("no-depends" => \$opt_nodepends, @@ -390,7 +178,7 @@ Index: texmf/scripts/texlive/tlmgr.pl my %ret; init_tlmedia(); my $mediatlpdb = $tlmediasrc->tlpdb; -@@ -721,7 +810,11 @@ +@@ -721,7 +737,11 @@ } my $updater_started = 0; my $nrupdated = 0; @@ -403,7 +191,7 @@ Index: texmf/scripts/texlive/tlmgr.pl next if ($pkg =~ m/^00texlive/); my $tlp = $localtlpdb->get_package($pkg); if (!defined($tlp)) { -@@ -832,7 +925,7 @@ +@@ -832,7 +852,7 @@ # the remove_package should also remove empty dirs in case # a dir is changed into a file merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1)); @@ -412,7 +200,7 @@ Index: texmf/scripts/texlive/tlmgr.pl if (ref $foo) { # installation succeeded because we got a reference merge_into (\%ret, $foo); -@@ -914,6 +1007,32 @@ +@@ -914,6 +934,34 @@ return(\%ret); } @@ -442,10 +230,12 @@ Index: texmf/scripts/texlive/tlmgr.pl +# . it does not care for whether a package seems to be installed or +# not (that is the --reinstall) +# ++# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever ++# anymore!!!! That has all to be done by hand. sub action_install { if ($opt_gui) { action_gui("install"); -@@ -921,19 +1040,41 @@ +@@ -921,19 +969,41 @@ init_local_db(1); # initialize the TLMedia from $location my $opt_nodepends = 0; @@ -493,7 +283,7 @@ Index: texmf/scripts/texlive/tlmgr.pl } } if ($opt_dry) { -@@ -1097,7 +1238,7 @@ +@@ -1097,7 +1167,7 @@ print "Installing $pkg.$a\n"; } else { info("install: $pkg.$a\n"); @@ -502,7 +292,7 @@ Index: texmf/scripts/texlive/tlmgr.pl } } } -@@ -1106,11 +1247,11 @@ +@@ -1106,11 +1176,11 @@ if (TeXLive::TLUtils::member('win32', @todoarchs)) { # install the necessary win32 stuff info("install: bin-tlperl.win32\n"); @@ -517,6 +307,238 @@ Index: texmf/scripts/texlive/tlmgr.pl } # update the option_archs list of installed archs my @larchs = $localtlpdb->option_available_architectures; +@@ -1696,11 +1766,28 @@ + + =over 8 + ++=item B<--reinstall> ++ ++Reinstall a package (including dependencies for collections) even if it ++seems to be already installed. Can be used to recover from accidently ++removed files of a package. ++ ++Note that when re-installing packages not all dependencies are reinstalled, ++only dependencies on normal packages (not of category Scheme or Collection). ++ + =item B<--no-depends> + + Do not install dependencies. (By default, installing a package ensures + that all dependencies of this package are fulfilled.) + ++=item B<--really-no-depends> ++ ++When you install a package which ships binary files the respective binary ++package will also be installed. (So for package bin-foobar also the package ++bin-foobar.i386-linux will be installed on an i386-linux system.) ++This switch supresses this behaviour, and also implies C<--no-depends>. ++Don't use it unless you are really sure what you are doing. ++ + =item B<--dry-run> + + Nothing is actually installed; instead, the actions to be performed are +@@ -1753,6 +1840,21 @@ + the update turns out to be problematic; see the C action for + details. + ++=item B<--no-depends> ++ ++If you call for updating a package normally all depending packages ++will also be checked for updates and updated if necessary. This switch ++supresses this behaviour. ++ ++=item B<--really-no-depends> ++ ++When you update a package which ships binary files the respective binary ++package will also be updated. (So for package bin-foobar also the package ++bin-foobar.i386-linux will be updated on an i386-linux system.) ++This switch supresses this behaviour, and also implies C<--no-depends>. ++Don't use it unless you are really sure what you are doing. ++ ++ + =back + + If the package on the server is older than the package already installed +@@ -1823,6 +1925,14 @@ + + Do not remove dependent packages. + ++=item B<--really-no-depends> ++ ++When you remove a package which ships binary files the respective binary ++package will also be removed. (So for package bin-foobar also the package ++bin-foobar.i386-linux will be removed on an i386-linux system.) ++This switch supresses this behaviour, and also implies C<--no-depends>. ++Don't use it unless you are really sure what you are doing. ++ + =item B<--force> + + By default, removal of a package or collection that is a dependency of +Index: tlpkg/TeXLive/TLPDB.pm +=================================================================== +--- tlpkg/TeXLive/TLPDB.pm (revision 10798) ++++ tlpkg/TeXLive/TLPDB.pm (working copy) +@@ -33,6 +33,8 @@ + $tlpdb->remove_package($pkg); + $tlpdb->get_package("packagename"); + $tlpdb->list_packages; ++ $tlpdb->expand_dependencies(["-only-arch",] $totlpdb, @list); ++ $tlpdb->expand_dependencies(["-no-collections",] $totlpdb, @list); + $tlpdb->find_file("filename"); + $tlpdb->collections; + $tlpdb->schemes; +@@ -446,6 +448,93 @@ + + =pod + ++=item C<< $tlpdb->expand_dependencies >> ++ ++This function takes as first argument the target TLPDB and then a list of ++packages and returns the closure of this ++list with respect to the depends operator. (Sorry, that was for ++mathematicians) ++ ++If the very first argument is "-only-arch" then it expands only dependencies ++of the form .ARCH. ++ ++=cut ++ ++sub expand_dependencies { ++ my $self = shift; ++ my $only_arch = 0; ++ my $no_collections = 0; ++ my $first = shift; ++ my $totlpdb; ++ if ($first eq "-only-arch") { ++ $only_arch = 1; ++ $totlpdb = shift; ++ } elsif ($first eq "-no-collections") { ++ $no_collections = 1; ++ $totlpdb = shift; ++ } else { ++ $totlpdb = $first; ++ } ++ my %install = (); ++ my @archs = $totlpdb->available_architectures; ++ for my $p (@_) { ++ $install{$p} = 1; ++ } ++ my $changed = 1; ++ while ($changed) { ++ $changed = 0; ++ my @pre_select = keys %install; ++ ddebug("pre_select = @pre_select\n"); ++ for my $p (@pre_select) { ++ next if ($p =~ m/^00texlive/); ++ my $pkg = $self->get_package($p); ++ if (!defined($pkg)) { ++ tlwarn("W: $p is mentioned somewhere but not available, disabling it!\n"); ++ $install{$p} = 0; ++ next; ++ } ++ for my $p_dep ($pkg->depends) { ++ ddebug("checking $p_dep in $p\n"); ++ my $tlpdd = $self->get_package($p_dep); ++ if (defined($tlpdd)) { ++ if ($tlpdd->category =~ m/$MetaCategoriesRegexp/) { ++ # we are taking a look at a dependency which is a collection ++ # or scheme, and if the option "-no-collections" is given ++ # we skip that one ++ ddebug("expand_deps: skipping $p_dep in $p due to -no-collections\n"); ++ next if $no_collections; ++ } ++ } ++ if ($p_dep =~ m/^(.*)\.ARCH$/) { ++ my $foo = "$1"; ++ foreach $a (@archs) { ++ $install{"$foo.$a"} = 1 if defined($self->get_package("$foo.$a")); ++ } ++ } elsif ($p_dep =~ m/^(.*)\.win32$/) { ++ # a win32 package should *only* be installed if we are installing ++ # the win32 arch ++ if (grep(/^win32$/,@archs)) { ++ $install{$p_dep} = 1; ++ } ++ } else { ++ $install{$p_dep} = 1 unless $only_arch; ++ } ++ } ++ } ++ ++ # check for newly selected packages ++ my @post_select = keys %install; ++ ddebug("post_select = @post_select\n"); ++ ddebug("nr pre select $#pre_select, nr post select $#post_select\n"); ++ if ($#pre_select != $#post_select) { ++ $changed = 1; ++ } ++ } ++ return(keys %install); ++} ++ ++=pod ++ + =item C<< $tlpdb->find_file("filename") >> + + The C returns a list of packages:filename +Index: tlpkg/TeXLive/TLMedia.pm +=================================================================== +--- tlpkg/TeXLive/TLMedia.pm (revision 10798) ++++ tlpkg/TeXLive/TLMedia.pm (working copy) +@@ -89,14 +89,14 @@ + # returns a scalar (0) on error + # returns a reference to a hash with actions on success + sub install_package { +- my ($self, $pkg, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia) = @_; ++ my ($self, $pkg, $totlpdb, $nopostinstall, $fallbackmedia) = @_; + my $fromtlpdb = $self->tlpdb; + my $ret; + die("TLMedia not initialized, cannot find tlpdb!") unless (defined($fromtlpdb)); + my $tlpobj = $fromtlpdb->get_package($pkg); + if (!defined($tlpobj)) { + if (defined($fallbackmedia)) { +- if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nodepends, $nopostinstall)) { ++ if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nopostinstall)) { + debug("installed $pkg from fallback"); + return $ret; + } else { +@@ -204,37 +204,6 @@ + # compute the return value + my %ret; + merge_into(\%ret, $tlpobj->make_return_hash_from_executes("enable")); +- # now install all the depends if they are not already present +- # NOTE: installation of .ARCH dependencies is done in *ANY*CASE*, regardless +- # of the $nodepends setting +- foreach my $d ($tlpobj->depends) { +- if ($d =~ m/^(.*)\.ARCH$/) { +- # we only want to try to install a .ARCH package if it actually contains +- # files +- my $foo = $1; +- foreach my $a ($totlpdb->available_architectures) { +- if (defined($fromtlpdb->get_package("$foo.$a")) && +- !defined($totlpdb->get_package("$foo.$a"))) { +- merge_into(\%ret, +- $self->install_package("$foo.$a", $totlpdb, $nodepends, $fallbackmedia, 0)); +- } +- } +- } elsif ($d =~ m/^(.*).win32$/) { +- # install only of win32 is under the available archs +- if (TeXLive::TLUtils::member("win32",$totlpdb->available_architectures)) { +- merge_into(\%ret, +- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); +- } +- } else { +- if (!$nodepends) { +- if (!defined($totlpdb->get_package($d))) { +- # we have to install it! +- merge_into(\%ret, +- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); +- } +- } +- } +- } + if (!$nopostinstall) { + # do the postinstallation actions + if (defined($PostInstall{$pkg})) { Index: tlpkg/bin/tl-update-containers =================================================================== --- tlpkg/bin/tl-update-containers (revision 10800) @@ -539,3 +561,644 @@ Index: tlpkg/bin/tl-update-containers $nettlpdb = TeXLive::TLPDB->new; die "Cannot create new tlpdb" unless defined($nettlpdb); } else { +Index: tlpkg/etc/rework-tlmgr-install-logic.patch +=================================================================== +--- tlpkg/etc/rework-tlmgr-install-logic.patch (revision 10811) ++++ tlpkg/etc/rework-tlmgr-install-logic.patch (working copy) +@@ -1,249 +1,35 @@ +-Index: tlpkg/TeXLive/TLPDB.pm +-=================================================================== +---- tlpkg/TeXLive/TLPDB.pm (revision 10798) +-+++ tlpkg/TeXLive/TLPDB.pm (working copy) +-@@ -33,6 +33,8 @@ +- $tlpdb->remove_package($pkg); +- $tlpdb->get_package("packagename"); +- $tlpdb->list_packages; +-+ $tlpdb->expand_dependencies(["-only-arch",] $totlpdb, @list); +-+ $tlpdb->expand_dependencies(["-no-collections",] $totlpdb, @list); +- $tlpdb->find_file("filename"); +- $tlpdb->collections; +- $tlpdb->schemes; +-@@ -446,6 +448,93 @@ +- +- =pod +- +-+=item C<< $tlpdb->expand_dependencies >> +-+ +-+This function takes as first argument the target TLPDB and then a list of +-+packages and returns the closure of this +-+list with respect to the depends operator. (Sorry, that was for +-+mathematicians) +-+ +-+If the very first argument is "-only-arch" then it expands only dependencies +-+of the form .ARCH. +-+ +-+=cut +-+ +-+sub expand_dependencies { +-+ my $self = shift; +-+ my $only_arch = 0; +-+ my $no_collections = 0; +-+ my $first = shift; +-+ my $totlpdb; +-+ if ($first eq "-only-arch") { +-+ $only_arch = 1; +-+ $totlpdb = shift; +-+ } elsif ($first eq "-no-collections") { +-+ $no_collections = 1; +-+ $totlpdb = shift; +-+ } else { +-+ $totlpdb = $first; +-+ } +-+ my %install = (); +-+ my @archs = $totlpdb->available_architectures; +-+ for my $p (@_) { +-+ $install{$p} = 1; +-+ } +-+ my $changed = 1; +-+ while ($changed) { +-+ $changed = 0; +-+ my @pre_select = keys %install; +-+ ddebug("pre_select = @pre_select\n"); +-+ for my $p (@pre_select) { +-+ next if ($p =~ m/^00texlive/); +-+ my $pkg = $self->get_package($p); +-+ if (!defined($pkg)) { +-+ tlwarn("W: $p is mentioned somewhere but not available, disabling it!\n"); +-+ $install{$p} = 0; +-+ next; +-+ } +-+ for my $p_dep ($pkg->depends) { +-+ ddebug("checking $p_dep in $p\n"); +-+ my $tlpdd = $self->get_package($p_dep); +-+ if (defined($tlpdd)) { +-+ if ($tlpdd->category =~ m/$MetaCategoriesRegexp/) { +-+ # we are taking a look at a dependency which is a collection +-+ # or scheme, and if the option "-no-collections" is given +-+ # we skip that one +-+ ddebug("expand_deps: skipping $p_dep in $p due to -no-collections\n"); +-+ next if $no_collections; +-+ } +-+ } +-+ if ($p_dep =~ m/^(.*)\.ARCH$/) { +-+ my $foo = "$1"; +-+ foreach $a (@archs) { +-+ $install{"$foo.$a"} = 1 if defined($self->get_package("$foo.$a")); +-+ } +-+ } elsif ($p_dep =~ m/^(.*)\.win32$/) { +-+ # a win32 package should *only* be installed if we are installing +-+ # the win32 arch +-+ if (grep(/^win32$/,@archs)) { +-+ $install{$p_dep} = 1; +-+ } +-+ } else { +-+ $install{$p_dep} = 1 unless $only_arch; +-+ } +-+ } +-+ } +-+ +-+ # check for newly selected packages +-+ my @post_select = keys %install; +-+ ddebug("post_select = @post_select\n"); +-+ ddebug("nr pre select $#pre_select, nr post select $#post_select\n"); +-+ if ($#pre_select != $#post_select) { +-+ $changed = 1; +-+ } +-+ } +-+ return(keys %install); +-+} +-+ +-+=pod +-+ +- =item C<< $tlpdb->find_file("filename") >> +- +- The C returns a list of packages:filename +-Index: tlpkg/TeXLive/TLMedia.pm +-=================================================================== +---- tlpkg/TeXLive/TLMedia.pm (revision 10798) +-+++ tlpkg/TeXLive/TLMedia.pm (working copy) +-@@ -89,14 +89,14 @@ +- # returns a scalar (0) on error +- # returns a reference to a hash with actions on success +- sub install_package { +-- my ($self, $pkg, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia) = @_; +-+ my ($self, $pkg, $totlpdb, $nopostinstall, $fallbackmedia) = @_; +- my $fromtlpdb = $self->tlpdb; +- my $ret; +- die("TLMedia not initialized, cannot find tlpdb!") unless (defined($fromtlpdb)); +- my $tlpobj = $fromtlpdb->get_package($pkg); +- if (!defined($tlpobj)) { +- if (defined($fallbackmedia)) { +-- if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nodepends, $nopostinstall)) { +-+ if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nopostinstall)) { +- debug("installed $pkg from fallback"); +- return $ret; +- } else { +-@@ -204,37 +204,6 @@ +- # compute the return value +- my %ret; +- merge_into(\%ret, $tlpobj->make_return_hash_from_executes("enable")); +-- # now install all the depends if they are not already present +-- # NOTE: installation of .ARCH dependencies is done in *ANY*CASE*, regardless +-- # of the $nodepends setting +-- foreach my $d ($tlpobj->depends) { +-- if ($d =~ m/^(.*)\.ARCH$/) { +-- # we only want to try to install a .ARCH package if it actually contains +-- # files +-- my $foo = $1; +-- foreach my $a ($totlpdb->available_architectures) { +-- if (defined($fromtlpdb->get_package("$foo.$a")) && +-- !defined($totlpdb->get_package("$foo.$a"))) { +-- merge_into(\%ret, +-- $self->install_package("$foo.$a", $totlpdb, $nodepends, $fallbackmedia, 0)); +-- } +-- } +-- } elsif ($d =~ m/^(.*).win32$/) { +-- # install only of win32 is under the available archs +-- if (TeXLive::TLUtils::member("win32",$totlpdb->available_architectures)) { +-- merge_into(\%ret, +-- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); +-- } +-- } else { +-- if (!$nodepends) { +-- if (!defined($totlpdb->get_package($d))) { +-- # we have to install it! +-- merge_into(\%ret, +-- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); +-- } +-- } +-- } +-- } +- if (!$nopostinstall) { +- # do the postinstallation actions +- if (defined($PostInstall{$pkg})) { + Index: texmf/scripts/texlive/tlmgr.pl + =================================================================== + --- texmf/scripts/texlive/tlmgr.pl (revision 10809) + +++ texmf/scripts/texlive/tlmgr.pl (working copy) +-@@ -32,6 +32,74 @@ ++@@ -13,16 +13,7 @@ ++ # tlmgr fileassoc pdf psv ++ # tlmgr fileassoc ps psv ++ # only setting is possible ++-# - tlmgr update collection-foobar should check for updates of all ++-# dependencies, too, so that tlmgr update collection-foobar will get updates ++-# to sub-packages anyway. ++-# - update and install should work differently: ++-# . create a list of all packages to be installed together with ++-# the depends closure operation ++-# . call TLMedia->install_package so that deps are NOT installed ++-# since all deps are actually installed from tlmgr itself ++-# - reinstall a package: assume that i want to donwgrade from a different ++-# mirror or I want to fix an accidentally removed file +++# Not really necessary?!! ++ # - ordering or collections removal (see below for details) ++ # - (?) removal does not remove created format files from TEXMFSYSVAR ++ # - after install/update show the number of bytes transfered ++@@ -32,6 +23,8 @@ + # - move the remove_package function into TLPDB.pm, so that the remove_package + # from TLPDB actually removes the files, too. Maybe some better names + # are necessary. +++# Maybe not a good idea ... not sure. + +# +-+# +-+# Some documentation I need to remember myself: +-+# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever +-+# anymore!!!! That has all to be done by hand. +-+# +-+# INSTALL +-+# +-+# tlmgr install foo bar baz +-+# will create the closure under dependencies of {foo,bar,baz}, i.e. all +-+# dependencies recursively down to the last package, and install all +-+# the packages that are necessary +-+# +-+# tlmgr install --no-depends foo bar baz +-+# will *only* install these three packages (if they are not already installed +-+# but it will STILL INSTALL foo.ARCH if they are necessary!! +-+# +-+# tlmgr install --really-no-depends foo bar baz +-+# will absolutely only install these three packages, and will not even +-+# take .ARCH deps into account +-+# +-+# tlmgr install --reinstall ... +-+# behaves exactely like without --reinstall BUT the following two +-+# differences: +-+# . dependencies are not expanded from collection to collection, so +-+# if you reinstall a collection then all its dependencies of type +-+# Package will be reinstalled, too, but not the dependencies on +-+# other collection, because that would force the full reinstallation +-+# of the whole installation +-+# . it does not care for whether a package seems to be installed or +-+# not (that is the --reinstall) +-+# +-+# REMOVE +-+# +-+# tlmgr remove foo bar baz +-+# will remove the packages foo bar baz itself +-+# and will remove all .ARCH dependencies, too +-+# and if some of them are collections it will also remove the +-+# depending packs which are NOT Collections|Schemes!!! +-+# if some of them are referenced somewhere they will not be removed +-+# unless --force given +-+# +-+# tlmgr remove --no-depends foo bar baz +-+# will remove the packages foo bar baz itself without any dependencies +-+# but it will still remove all .ARCH dependency +-+# if some of them are referenced somewhere they will not be removed +-+# unless --force given +-+# +-+# tlmgr remove --really-no-depends foo bar baz +-+# willabsolutely only install foo bar baz not even taking .ARCH into +-+# account +-+# +-+# UPDATE +-+# +-+# tlmgr update foo +-+# if foo is of type Package|Documentation it will update only foo +-+# and the respective .ARCH dependencies +-+# if foo is of type Collection|Scheme it will update itself AND +-+# will check all depending packs of type NOT(COllection|Scheme) +-+# for necessary updates +-+# +-+# tlmgr update --no-depends foo +-+# as above, but will not check for depends of Collections/Schemes +-+# but it will still update .ARCH deps +-+# +-+# tlmgr update --really-no-depends foo +-+# will absolutely only update foo not even taking .ARCH into account +-+# + + my $svnrev = '$Revision$'; + my $tlmgrrevision; +-@@ -293,18 +361,6 @@ ++@@ -293,18 +286,6 @@ + $localtlpdb->remove_package($pkg); + merge_into(\%ret, $tlp->make_return_hash_from_executes("disable")); + $ret{'mktexlsr'} = 1; +@@ -262,7 +48,7 @@ + # should we save at each removal??? + # advantage: the tlpdb actually reflects what is installed + # disadvantage: removing a collection calls the save routine several times +-@@ -319,6 +375,26 @@ ++@@ -319,6 +300,26 @@ + return \%ret; + } + +@@ -289,7 +75,7 @@ + sub action_remove { + if ($opt_gui) { + action_gui("remove"); +-@@ -340,16 +416,24 @@ ++@@ -340,16 +341,24 @@ + # + my %ret; + my $opt_nodepends = 0; +@@ -315,7 +101,7 @@ + my $tlp = $localtlpdb->get_package($pkg); + next if defined($already_removed{$pkg}); + if (!defined($tlp)) { +-@@ -376,20 +460,6 @@ ++@@ -376,20 +385,6 @@ + # remove dependencies, too + merge_into(\%ret, \%foo); + $already_removed{$pkg} = 1; +@@ -336,7 +122,7 @@ + } + } else { + # save all the other packages into the @more_removal list to +-@@ -400,7 +470,7 @@ ++@@ -400,7 +395,7 @@ + } + } + } +@@ -345,7 +131,7 @@ + if (!defined($already_removed{$pkg})) { + info ("remove $pkg\n"); + if (!$opt_dry) { +-@@ -625,6 +695,22 @@ ++@@ -625,6 +620,24 @@ + } + + +@@ -365,10 +151,12 @@ + +# tlmgr update --really-no-depends foo + +# will absolutely only update foo not even taking .ARCH into account + +# +++# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever +++# anymore!!!! That has all to be done by hand. + sub action_update { + if ($opt_gui) { + action_gui("update"); +-@@ -632,6 +718,7 @@ ++@@ -632,6 +645,7 @@ + init_local_db(1); + # initialize the TLMedia from $location + my $opt_nodepends = 0; +@@ -376,7 +164,7 @@ + my $opt_dry = 0; + my $opt_all = 0; + my $opt_list = 0; +-@@ -639,11 +726,13 @@ ++@@ -639,11 +653,13 @@ + my $opt_backupdir; + Getopt::Long::Configure(qw(no_pass_through)); + GetOptions("no-depends" => \$opt_nodepends, +@@ -390,7 +178,7 @@ + my %ret; + init_tlmedia(); + my $mediatlpdb = $tlmediasrc->tlpdb; +-@@ -721,7 +810,11 @@ ++@@ -721,7 +737,11 @@ + } + my $updater_started = 0; + my $nrupdated = 0; +@@ -403,7 +191,7 @@ + next if ($pkg =~ m/^00texlive/); + my $tlp = $localtlpdb->get_package($pkg); + if (!defined($tlp)) { +-@@ -832,7 +925,7 @@ ++@@ -832,7 +852,7 @@ + # the remove_package should also remove empty dirs in case + # a dir is changed into a file + merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1)); +@@ -412,7 +200,7 @@ + if (ref $foo) { + # installation succeeded because we got a reference + merge_into (\%ret, $foo); +-@@ -914,6 +1007,32 @@ ++@@ -914,6 +934,34 @@ + return(\%ret); + } + +@@ -442,10 +230,12 @@ + +# . it does not care for whether a package seems to be installed or + +# not (that is the --reinstall) + +# +++# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever +++# anymore!!!! That has all to be done by hand. + sub action_install { + if ($opt_gui) { + action_gui("install"); +-@@ -921,19 +1040,41 @@ ++@@ -921,19 +969,41 @@ + init_local_db(1); + # initialize the TLMedia from $location + my $opt_nodepends = 0; +@@ -493,7 +283,7 @@ + } + } + if ($opt_dry) { +-@@ -1097,7 +1238,7 @@ ++@@ -1097,7 +1167,7 @@ + print "Installing $pkg.$a\n"; + } else { + info("install: $pkg.$a\n"); +@@ -502,7 +292,7 @@ + } + } + } +-@@ -1106,11 +1247,11 @@ ++@@ -1106,11 +1176,11 @@ + if (TeXLive::TLUtils::member('win32', @todoarchs)) { + # install the necessary win32 stuff + info("install: bin-tlperl.win32\n"); +@@ -517,6 +307,238 @@ + } + # update the option_archs list of installed archs + my @larchs = $localtlpdb->option_available_architectures; ++@@ -1696,11 +1766,28 @@ ++ ++ =over 8 ++ +++=item B<--reinstall> +++ +++Reinstall a package (including dependencies for collections) even if it +++seems to be already installed. Can be used to recover from accidently +++removed files of a package. +++ +++Note that when re-installing packages not all dependencies are reinstalled, +++only dependencies on normal packages (not of category Scheme or Collection). +++ ++ =item B<--no-depends> ++ ++ Do not install dependencies. (By default, installing a package ensures ++ that all dependencies of this package are fulfilled.) ++ +++=item B<--really-no-depends> +++ +++When you install a package which ships binary files the respective binary +++package will also be installed. (So for package bin-foobar also the package +++bin-foobar.i386-linux will be installed on an i386-linux system.) +++This switch supresses this behaviour, and also implies C<--no-depends>. +++Don't use it unless you are really sure what you are doing. +++ ++ =item B<--dry-run> ++ ++ Nothing is actually installed; instead, the actions to be performed are ++@@ -1753,6 +1840,21 @@ ++ the update turns out to be problematic; see the C action for ++ details. ++ +++=item B<--no-depends> +++ +++If you call for updating a package normally all depending packages +++will also be checked for updates and updated if necessary. This switch +++supresses this behaviour. +++ +++=item B<--really-no-depends> +++ +++When you update a package which ships binary files the respective binary +++package will also be updated. (So for package bin-foobar also the package +++bin-foobar.i386-linux will be updated on an i386-linux system.) +++This switch supresses this behaviour, and also implies C<--no-depends>. +++Don't use it unless you are really sure what you are doing. +++ +++ ++ =back ++ ++ If the package on the server is older than the package already installed ++@@ -1823,6 +1925,14 @@ ++ ++ Do not remove dependent packages. ++ +++=item B<--really-no-depends> +++ +++When you remove a package which ships binary files the respective binary +++package will also be removed. (So for package bin-foobar also the package +++bin-foobar.i386-linux will be removed on an i386-linux system.) +++This switch supresses this behaviour, and also implies C<--no-depends>. +++Don't use it unless you are really sure what you are doing. +++ ++ =item B<--force> ++ ++ By default, removal of a package or collection that is a dependency of ++Index: tlpkg/TeXLive/TLPDB.pm ++=================================================================== ++--- tlpkg/TeXLive/TLPDB.pm (revision 10798) +++++ tlpkg/TeXLive/TLPDB.pm (working copy) ++@@ -33,6 +33,8 @@ ++ $tlpdb->remove_package($pkg); ++ $tlpdb->get_package("packagename"); ++ $tlpdb->list_packages; +++ $tlpdb->expand_dependencies(["-only-arch",] $totlpdb, @list); +++ $tlpdb->expand_dependencies(["-no-collections",] $totlpdb, @list); ++ $tlpdb->find_file("filename"); ++ $tlpdb->collections; ++ $tlpdb->schemes; ++@@ -446,6 +448,93 @@ ++ ++ =pod ++ +++=item C<< $tlpdb->expand_dependencies >> +++ +++This function takes as first argument the target TLPDB and then a list of +++packages and returns the closure of this +++list with respect to the depends operator. (Sorry, that was for +++mathematicians) +++ +++If the very first argument is "-only-arch" then it expands only dependencies +++of the form .ARCH. +++ +++=cut +++ +++sub expand_dependencies { +++ my $self = shift; +++ my $only_arch = 0; +++ my $no_collections = 0; +++ my $first = shift; +++ my $totlpdb; +++ if ($first eq "-only-arch") { +++ $only_arch = 1; +++ $totlpdb = shift; +++ } elsif ($first eq "-no-collections") { +++ $no_collections = 1; +++ $totlpdb = shift; +++ } else { +++ $totlpdb = $first; +++ } +++ my %install = (); +++ my @archs = $totlpdb->available_architectures; +++ for my $p (@_) { +++ $install{$p} = 1; +++ } +++ my $changed = 1; +++ while ($changed) { +++ $changed = 0; +++ my @pre_select = keys %install; +++ ddebug("pre_select = @pre_select\n"); +++ for my $p (@pre_select) { +++ next if ($p =~ m/^00texlive/); +++ my $pkg = $self->get_package($p); +++ if (!defined($pkg)) { +++ tlwarn("W: $p is mentioned somewhere but not available, disabling it!\n"); +++ $install{$p} = 0; +++ next; +++ } +++ for my $p_dep ($pkg->depends) { +++ ddebug("checking $p_dep in $p\n"); +++ my $tlpdd = $self->get_package($p_dep); +++ if (defined($tlpdd)) { +++ if ($tlpdd->category =~ m/$MetaCategoriesRegexp/) { +++ # we are taking a look at a dependency which is a collection +++ # or scheme, and if the option "-no-collections" is given +++ # we skip that one +++ ddebug("expand_deps: skipping $p_dep in $p due to -no-collections\n"); +++ next if $no_collections; +++ } +++ } +++ if ($p_dep =~ m/^(.*)\.ARCH$/) { +++ my $foo = "$1"; +++ foreach $a (@archs) { +++ $install{"$foo.$a"} = 1 if defined($self->get_package("$foo.$a")); +++ } +++ } elsif ($p_dep =~ m/^(.*)\.win32$/) { +++ # a win32 package should *only* be installed if we are installing +++ # the win32 arch +++ if (grep(/^win32$/,@archs)) { +++ $install{$p_dep} = 1; +++ } +++ } else { +++ $install{$p_dep} = 1 unless $only_arch; +++ } +++ } +++ } +++ +++ # check for newly selected packages +++ my @post_select = keys %install; +++ ddebug("post_select = @post_select\n"); +++ ddebug("nr pre select $#pre_select, nr post select $#post_select\n"); +++ if ($#pre_select != $#post_select) { +++ $changed = 1; +++ } +++ } +++ return(keys %install); +++} +++ +++=pod +++ ++ =item C<< $tlpdb->find_file("filename") >> ++ ++ The C returns a list of packages:filename ++Index: tlpkg/TeXLive/TLMedia.pm ++=================================================================== ++--- tlpkg/TeXLive/TLMedia.pm (revision 10798) +++++ tlpkg/TeXLive/TLMedia.pm (working copy) ++@@ -89,14 +89,14 @@ ++ # returns a scalar (0) on error ++ # returns a reference to a hash with actions on success ++ sub install_package { ++- my ($self, $pkg, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia) = @_; +++ my ($self, $pkg, $totlpdb, $nopostinstall, $fallbackmedia) = @_; ++ my $fromtlpdb = $self->tlpdb; ++ my $ret; ++ die("TLMedia not initialized, cannot find tlpdb!") unless (defined($fromtlpdb)); ++ my $tlpobj = $fromtlpdb->get_package($pkg); ++ if (!defined($tlpobj)) { ++ if (defined($fallbackmedia)) { ++- if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nodepends, $nopostinstall)) { +++ if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nopostinstall)) { ++ debug("installed $pkg from fallback"); ++ return $ret; ++ } else { ++@@ -204,37 +204,6 @@ ++ # compute the return value ++ my %ret; ++ merge_into(\%ret, $tlpobj->make_return_hash_from_executes("enable")); ++- # now install all the depends if they are not already present ++- # NOTE: installation of .ARCH dependencies is done in *ANY*CASE*, regardless ++- # of the $nodepends setting ++- foreach my $d ($tlpobj->depends) { ++- if ($d =~ m/^(.*)\.ARCH$/) { ++- # we only want to try to install a .ARCH package if it actually contains ++- # files ++- my $foo = $1; ++- foreach my $a ($totlpdb->available_architectures) { ++- if (defined($fromtlpdb->get_package("$foo.$a")) && ++- !defined($totlpdb->get_package("$foo.$a"))) { ++- merge_into(\%ret, ++- $self->install_package("$foo.$a", $totlpdb, $nodepends, $fallbackmedia, 0)); ++- } ++- } ++- } elsif ($d =~ m/^(.*).win32$/) { ++- # install only of win32 is under the available archs ++- if (TeXLive::TLUtils::member("win32",$totlpdb->available_architectures)) { ++- merge_into(\%ret, ++- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); ++- } ++- } else { ++- if (!$nodepends) { ++- if (!defined($totlpdb->get_package($d))) { ++- # we have to install it! ++- merge_into(\%ret, ++- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia)); ++- } ++- } ++- } ++- } ++ if (!$nopostinstall) { ++ # do the postinstallation actions ++ if (defined($PostInstall{$pkg})) { + Index: tlpkg/bin/tl-update-containers + =================================================================== + --- tlpkg/bin/tl-update-containers (revision 10800) -- cgit v1.2.3