summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-09-28 09:18:33 +0000
committerNorbert Preining <preining@logic.at>2008-09-28 09:18:33 +0000
commitf8a62b821a422193539da46f406fe45f8494fdb9 (patch)
treebdb85a61bd945c9badf56daf2d078d163b39e320 /Master
parent2efd3250151021ea59a1386e3089e148f0ba308b (diff)
tlmgr now removes packages that have been removed from the server
git-svn-id: svn://tug.org/texlive/trunk@10770 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl68
1 files changed, 59 insertions, 9 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index f30d1bc35ba..0cd181eb595 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -16,14 +16,6 @@
# - 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.
-# - removal of deleted packages:
-# if a package:
-# . is present in the local tlpdb
-# . is referenced in a collection in the local tlpdb
-# . is not present in the media tlpdb
-# . the collection is present in the media tlpdb
-# then remove that package, and when --list or --dry-run is given
-# give a warning
# - update and install should work differently:
# . create a list of all packages to be installed together with
# the depends closure operation
@@ -643,11 +635,13 @@ sub action_update {
my $opt_dry = 0;
my $opt_all = 0;
my $opt_list = 0;
+ my $opt_noremove = 0;
my $opt_backupdir;
Getopt::Long::Configure(qw(no_pass_through));
GetOptions("no-depends" => \$opt_nodepends,
"all" => \$opt_all,
"list" => \$opt_list,
+ "no-remove" => \$opt_noremove,
"backupdir=s" => \$opt_backupdir,
"dry-run" => \$opt_dry) or pod2usage(2);
my %ret;
@@ -663,8 +657,40 @@ sub action_update {
unlink($f) unless $opt_dry;
}
my @todo;
+ my @removal = ();
if ($opt_all || $opt_list) {
@todo = $localtlpdb->list_packages;
+ # we check for deleted packages by checking:
+ # . the package is referenced by collection of the local tlpdb
+ # . 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
+ 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)) {
+ info("forcibly removed $d, mentioned in $c\n");
+ } 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;
+ }
+ }
+ }
+ }
} else {
@todo = @ARGV;
}
@@ -851,6 +877,16 @@ EOF
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");
+ }
+ merge_into(\%ret, &remove_package($p, $localtlpdb, 1)) unless
+ ($opt_dry or $opt_list or $opt_noremove);
+ }
if ($updater_started) {
print UPDATER "del tlpkg\\installer\\tarsave.exe\n";
print UPDATER "rem del /s /q temp\n";
@@ -1676,7 +1712,15 @@ written to the terminal.
Updates the packages given as arguments to the latest version available
at the installation source. Either C<--all> or at least one I<pkg> name
-must be specified. Options:
+must be specified.
+
+Furthermore, it B<removes> packages which have disappeared on the server.
+To not remove any locally installed packages it does check that the
+package came from the server by checking for inclusion in collections.
+Both options C<--dry-run> and C<--list> will mention the packages
+to be removed. See <--no-remova> for a way to supress that.
+
+Options:
=over 8
@@ -1689,6 +1733,12 @@ collections. (Packages in uninstalled collections are not considered.)
List the packages which would be updated or newly installed.
+=item B<--no-remove>
+
+Under normal circumstances tlmgr tries to remove packages which have
+disappeared on the server when called with C<--all>. This prevents
+these removals.
+
=item B<--dry-run>
Nothing is actually installed; instead, the actions to be performed are