summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-10-07 00:35:35 +0000
committerNorbert Preining <preining@logic.at>2008-10-07 00:35:35 +0000
commit72a576ec9293cef879e3008caec535a58addbde9 (patch)
tree7e82a8f583d05b7543bae63216195a36753c2311
parent854b371ebd7a7da43c99c209c54af1dcccbe1236 (diff)
tlmgr: move removals before installation to make sure that nothing wrong
is removed. And make the computation more transparent (at least for me) git-svn-id: svn://tug.org/texlive/trunk@10877 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl82
1 files changed, 45 insertions, 37 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 8fb13435fda..8f7578e439d 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -874,7 +874,7 @@ sub action_update {
unlink($f) unless $opt_dry;
}
my @todo;
- my @removal = ();
+ my %removals;
if ($opt_all || $opt_list) {
@todo = $localtlpdb->list_packages;
# we check for deleted packages by checking:
@@ -882,38 +882,58 @@ sub action_update {
# . the package is present in the local tlpdb
# . the collection is present in the remote tlpdb
# . the package is not referenced any more in the remote tlpdb
+ # That is done as follows:
+ # . collect all the dependencies of the LOCAL collection in a hash
+ # . delete all hash entries for dependencies occuring on the local
for my $c ($localtlpdb->collections) {
- my $tlcremote = $mediatlpdb->get_package($c);
- # continue with next package if the local connection is not
- # present on the server side
- next if !defined($tlcremote);
my $tlc = $localtlpdb->get_package($c);
die ("That should not happen, listed but not found!") if !defined($tlc);
- # 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)) {
- # forcibly removed package, but no need to mention it here
- # we do it below
- } else {
- # now check the remote tlpdb for reference of that package
- if (!defined($mediatlpdb->get_package($d))) {
- # it seems that the package is present in the local tlpdb
- # is referenced in $c in the local tlpdb
- # $c is present in the remote tlpdb
- # the package is NOT present in the remote tlpdb
- info("$d ($c): removed package\n");
- push @removal, $d;
- }
+ my $tlcremote = $mediatlpdb->get_package($c);
+ if (!defined($tlcremote)) {
+ debug("Collection $c is not present on the server!\n");
+ } else {
+ for my $d ($tlc->depends) {
+ $removals{$d} = $c;
}
+ for my $d ($tlcremote->depends) {
+ delete($removals{$d});
+ }
+ }
+ }
+ # make an additional round over all collections on the remote server
+ # in case a package has been moved between collections
+ for my $c ($mediatlpdb->collections) {
+ my $tlc = $mediatlpdb->get_package($c);
+ die ("That should not happen, listed but not found!") if !defined($tlc);
+ for my $d ($tlc->depends) {
+ # those package are referenced, so not remove them
+ delete($removals{$d});
}
}
+ for my $d (keys %removals) {
+ info("$d ($removals{$d}): removed package\n");
+ }
} else {
@todo = @ARGV;
}
my %forcermpkgs;
my %newpkgs;
+ #
+ # we have to remove all the stuff *BEFORE* we install other packages
+ # to support moving of files from one package to the next
+ # remove the packages that have disappeared
+ for my $p (keys %removals) {
+ if ($opt_noremove) {
+ info("not removing $p due to -no-remove (removed on server)\n");
+ } else {
+ info("remove $p (removed on server)\n");
+ }
+ if (!($opt_dry or $opt_list or $opt_noremove)) {
+ merge_into(\%ret, &remove_package($p, $localtlpdb, 1));
+ logpackage("remove: $p");
+ }
+ }
+ #
# we check for new packages
# loop over all installed collections
for my $c ($localtlpdb->collections) {
@@ -1030,9 +1050,9 @@ sub action_update {
"__BACKUP_${pkg}.r" . $tlp->revision);
if ($s <= 0) {
tlwarn("\nCreation of backup container of $pkg didn't succeed\n");
- tlwarn("I will not continue, either retry or call update --force\n");
- tlwarn("Exiting!\n");
- exit(1);
+ tlwarn("I will continue updating other packages, please retry\n");
+ # we should try to update other packages at least
+ next;
}
$remove_unwind_container = 1;
$unwind_package = "$fullname";
@@ -1089,18 +1109,6 @@ sub action_update {
next;
}
}
- # remove the packages that have disappeared
- for my $p (@removal) {
- if ($opt_noremove) {
- info("not removing $p due to -no-remove (removed on server)\n");
- } else {
- info("remove $p (removed on server)\n");
- }
- if (!($opt_dry or $opt_list or $opt_noremove)) {
- merge_into(\%ret, &remove_package($p, $localtlpdb, 1));
- logpackage("remove: $p");
- }
- }
# that already checks whether we actually have to do something
close_win32_updater();
if (($nrupdated == 0) && ($tlmediasrc->media ne "NET") && $opt_all) {