summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-09-10 15:14:28 +0000
committerNorbert Preining <preining@logic.at>2008-09-10 15:14:28 +0000
commit448c8b761fa413e31b7f3efa167485e650d9b6d6 (patch)
tree4969e5ac2de80fd49418c09ee6173ffc18068f3f /Master
parentdf86444f11e7040b19a55e2a71171d878885601d (diff)
add a patch for safer update procedure
git-svn-id: svn://tug.org/texlive/trunk@10541 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/etc/safer-update.diff53
1 files changed, 53 insertions, 0 deletions
diff --git a/Master/tlpkg/etc/safer-update.diff b/Master/tlpkg/etc/safer-update.diff
new file mode 100644
index 00000000000..5cb8859aca1
--- /dev/null
+++ b/Master/tlpkg/etc/safer-update.diff
@@ -0,0 +1,53 @@
+Index: tlmgr.pl
+===================================================================
+--- tlmgr.pl (revision 10534)
++++ tlmgr.pl (working copy)
+@@ -734,10 +734,45 @@
+ }
+ }
+ } else {
+- print "update: $pkg (first remove old, then install new)\n";
+- merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1));
++ print "update: $pkg (install new ... ";
++ # we have to be careful hear. If we remove the package and
++ # later the install_package call which downloads fails, then
++ # we are in a rather bad shape ...
++ #
++ # We will create a list of currently contained files, and a
++ # list of files in the newer version, and do first install
++ # the new version, and if that succeeded, we will remove the
++ # files that are not present anymore in the package
++ my @oldfiles = $tlp->all_files;
++ my @newfiles = $mediatlp->all_files;
++ my %removefiles = ();
++ # we create an array with key of all the old files, and then
++ # remove all key/value pairs for files occurring in the new
++ # files list. The remaining files should be removed.
++ for my $f (@oldfiles) {
++ $removefiles{$f} = 1;
++ }
++ for my $f (@newfiles) {
++ delete $removefiles{$f};
++ }
+ merge_into(\%ret, $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 0));
+- print "update: $pkg done\n";
++ # If we are still here, then that means that the installation
++ # has succeeded, because $tlmediasrc->_install_package dies
++ # in case of download/un-lzma/untar problems
++ #
++ print "remove old files ... ";
++ # we have to chdir to $localtlpdb->root
++ my $Master = $localtlpdb->root;
++ chdir ($Master) || die "chdir($Master) failed: $!";
++ my @files = keys %removefiles;
++ my @removals = &removed_dirs (@files);
++ foreach my $entry (@files) {
++ unlink $entry;
++ }
++ foreach my $entry (@removals) {
++ rmdir $entry;
++ }
++ print "done)\n";
+ }
+ }
+ } elsif ($rev > $mediarev) {