From 3d692c574343529272f35f53b35c9cfe8e7472ce Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 5 Sep 2009 11:33:10 +0000 Subject: make tlmgr more robust in the computation of forcibly removed. The changes are in sub auto_remove_install_force_packages and are as follows: The initial expansion starts from all schemes and collections present locally, so all new/removed/force are computed, and finally only those packages where the update is asked for are returned. git-svn-id: svn://tug.org/texlive/trunk@15125 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgr.pl | 72 +++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 32 deletions(-) (limited to 'Master') diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 56ecf1b105b..6b755646a3f 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -1537,9 +1537,9 @@ EOF # the list of packages passed in is already expanded sub auto_remove_install_force_packages { my @todo = @_; - my %removals; - my %forcermpkgs; - my %newpkgs; + my %removals_full; + my %forcermpkgs_full; + my %newpkgs_full; # check for new/removed/forcibly removed packages. # we start from the list of installed collections in the local tlpdb # which are also present in the remote database @@ -1552,43 +1552,51 @@ sub auto_remove_install_force_packages { # A \ B set of packages removed on the server # A \cup B set of packages which should be checked for forcible removal # - my @schmscolls = (); - for my $p (@todo) { - my $localtlp = $localtlpdb->get_package($p); - if (defined($localtlp)) { - if ($localtlp->category =~ m/^$TeXLive::TLConfig::MetaCategoriesRegexp$/) { - push @schmscolls, $p if defined($tlmediatlpdb->get_package($p)); - } - } - } - my @localexpansion = - $localtlpdb->expand_dependencies($localtlpdb, @schmscolls); - my @remoteexpansion = - $tlmediatlpdb->expand_dependencies($localtlpdb, @schmscolls); - - for my $p (@remoteexpansion) { - $newpkgs{$p} = 1; - } - for my $p (@localexpansion) { - delete($newpkgs{$p}); - $removals{$p} = 1; - } - for my $p (@remoteexpansion) { - delete($removals{$p}); - } - for my $p (@localexpansion) { + my @all_schmscolls = (); + push @all_schmscolls, $localtlpdb->schemes; + push @all_schmscolls, $localtlpdb->collections; + my @localexpansion_full = + $localtlpdb->expand_dependencies($localtlpdb, @all_schmscolls); + my @remoteexpansion_full = + $tlmediatlpdb->expand_dependencies($localtlpdb, @all_schmscolls); + + # compute new/remove/forcerm based on the full expansions + for my $p (@remoteexpansion_full) { + $newpkgs_full{$p} = 1; + } + for my $p (@localexpansion_full) { + delete($newpkgs_full{$p}); + $removals_full{$p} = 1; + } + for my $p (@remoteexpansion_full) { + delete($removals_full{$p}); + } + for my $p (@localexpansion_full) { # intersection, don't check A\B and B\A - next if $newpkgs{$p}; - next if $removals{$p}; + next if $newpkgs_full{$p}; + next if $removals_full{$p}; my $tlp = $localtlpdb->get_package($p); if (!defined($tlp)) { if ($opts{"reinstall-forcibly-removed"}) { - $newpkgs{$p} = 1; + $newpkgs_full{$p} = 1; } else { - $forcermpkgs{$p} = 1; + $forcermpkgs_full{$p} = 1; } } } + # + # now take only the subset of packages that is in @todo + # note that @todo is already expanded in action_updated according + # to the --no-depends and --no-depends-at-all options + # + my %removals; + my %forcermpkgs; + my %newpkgs; + for my $p (@todo) { + $removals{$p} = 1 if defined($removals_full{$p}); + $forcermpkgs{$p} = 1 if defined($forcermpkgs_full{$p}); + $newpkgs{$p} = 1 if defined($newpkgs_full{$p}); + } debug ("tlmgr: new pkgs: " . join("\n\t",keys %newpkgs) . "\n"); debug ("tlmgr: deleted : " . join("\n\t",keys %removals) . "\n"); debug ("tlmgr: forced : " . join("\n\t",keys %forcermpkgs) . "\n"); -- cgit v1.2.3