diff options
author | Norbert Preining <preining@logic.at> | 2008-09-18 15:26:40 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-09-18 15:26:40 +0000 |
commit | 998c301f2c517e2e72c82126098d63e76f5c6e28 (patch) | |
tree | db71fea23ee923b8397ac12db87abfa70c6ceb80 | |
parent | d694b2b295e61686087c8744f8da6e185dac1568 (diff) |
another update of the safer-update.diff. Now a missing .tar.lzma on the
server side actually triggered a reinstallation of the old package.
git-svn-id: svn://tug.org/texlive/trunk@10635 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/etc/safer-update.diff | 145 |
1 files changed, 119 insertions, 26 deletions
diff --git a/Master/tlpkg/etc/safer-update.diff b/Master/tlpkg/etc/safer-update.diff index 25e7102bc71..a58eae3bf7c 100644 --- a/Master/tlpkg/etc/safer-update.diff +++ b/Master/tlpkg/etc/safer-update.diff @@ -151,35 +151,114 @@ Index: tlpkg/TeXLive/TLMedia.pm } if (ref $what) { -@@ -296,7 +303,9 @@ - # we are installing from the NET - # download the file and put it into temp - if (!download_file($what, $lzmafile) || (! -r $lzmafile)) { +@@ -271,48 +278,84 @@ + mkdirhier("$target/$dn"); + copy "$location/$file", "$target/$dn"; + } +- } elsif ($what =~ m,\.tar.lzma$,) { +- # this is the case when we install from CD or the NET ++ } elsif ($what =~ m,\.tar(\.lzma)?$,) { ++ my $type = defined($1) ? "lzma" : "tar"; ++ ++ # this is the case when we install from CD or the NET, or a backup + # + # in all other cases we create temp files .tar.lzma (or use the present + # one), lzmadec them, and then call tar + + my $fn = basename($what); + mkdirhier("$target/temp"); +- my $lzmafile = "$target/temp/$fn"; +- my $tarfile = "$target/temp/$fn"; $tarfile =~ s/\.lzma$//; +- my $lzmafile_quote = $lzmafile; +- my $tarfile_quote = $tarfile; +- my $target_quote = $target; +- if (win32()) { +- $lzmafile =~ s!/!\\!g; +- $lzmafile_quote = "\"$lzmafile\""; +- $tarfile =~ s!/!\\!g; +- $tarfile_quote = "\"$tarfile\""; +- $target =~ s!/!\\!g; +- $target_quote = "\"$target\""; +- } +- if ($what =~ m,http://|ftp://,) { +- # we are installing from the NET +- # download the file and put it into temp +- if (!download_file($what, $lzmafile) || (! -r $lzmafile)) { - die "Downloading $what did not succeed, please retry!"; -+ tlwarn("Downloading $what did not succeed, please retry!\n"); ++ my $tarfile; ++ if ($type eq "lzma") { ++ my $lzmafile = "$target/temp/$fn"; ++ $tarfile = "$target/temp/$fn"; $tarfile =~ s/\.lzma$//; ++ my $lzmafile_quote = $lzmafile; ++ my $tarfile_quote = $tarfile; ++ my $target_quote = $target; ++ if (win32()) { ++ $lzmafile =~ s!/!\\!g; ++ $lzmafile_quote = "\"$lzmafile\""; ++ $tarfile =~ s!/!\\!g; ++ $tarfile_quote = "\"$tarfile\""; ++ $target =~ s!/!\\!g; ++ $target_quote = "\"$target\""; + } ++ if ($what =~ m,http://|ftp://,) { ++ # we are installing from the NET ++ # download the file and put it into temp ++ if (!download_file($what, $lzmafile) || (! -r $lzmafile)) { ++ tlwarn("Downloading \n"); ++ tlwarn(" $what\n"); ++ tlwarn("did not succeed, please retry!\n"); ++ unlink($tarfile, $lzmafile); ++ return(0); ++ } ++ } else { ++ # we are installing from CD ++ # copy it to temp ++ copy($what, "$target/temp"); ++ } ++ debug("Un-lzmaing $lzmafile to $tarfile\n"); ++ system("$lzmadec < $lzmafile_quote > $tarfile_quote"); ++ if (! -f $tarfile) { ++ tlwarn("Unpacking $lzmafile did not succeed, please retry!\n"); + unlink($tarfile, $lzmafile); + return(0); - } ++ } ++ unlink($lzmafile); } else { - # we are installing from CD -@@ -306,13 +315,22 @@ - debug("Un-lzmaing $lzmafile to $tarfile\n"); - system("$lzmadec < $lzmafile_quote > $tarfile_quote"); - if (! -f $tarfile) { -- die "Unpacking $lzmafile did not succeed, please retry!"; -+ tlwarn("Unpacking $lzmafile did not succeed, please retry!\n"); -+ unlink($tarfile, $lzmafile); -+ return(0); +- # we are installing from CD +- # copy it to temp +- copy($what, "$target/temp"); ++ $tarfile = "$target/temp/$fn"; ++ if ($what =~ m,http://|ftp://,) { ++ if (!download_file($what, $tarfile) || (! -r $tarfile)) { ++ tlwarn("Downloading \n"); ++ tlwarn(" $what\n"); ++ tlwarn("did not succeed, please retry!\n"); ++ unlink($tarfile); ++ return(0); ++ } ++ } else { ++ # we are installing from CD ++ my $aa = abs_path(dirname($what)); ++ my $bb = abs_path("$target/temp"); ++ # copy if the file is not already there ++ copy($what, "$target/temp") unless ($aa eq $bb); ++ } } - debug("Unpacking $tarfile\n"); -- system($tar,"-x","-C",$target,"-f",$tarfile); +- debug("Un-lzmaing $lzmafile to $tarfile\n"); +- system("$lzmadec < $lzmafile_quote > $tarfile_quote"); +- if (! -f $tarfile) { +- die "Unpacking $lzmafile did not succeed, please retry!"; ++ debug("Unpacking $tarfile\n"); + if (system($tar,"-x","-C",$target,"-f",$tarfile) != 0) { + tlwarn("Untarring $tarfile did not succeed, please retry!\n"); -+ unlink($tarfile, $lzmafile); ++ unlink($tarfile); + return(0); -+ } + } +- debug("Unpacking $tarfile\n"); +- system($tar,"-x","-C",$target,"-f",$tarfile); +- unlink($tarfile, $lzmafile); + # we are still here, so success! - unlink($tarfile, $lzmafile); ++ unlink($tarfile); + return(1); } else { - die "Don't know how to install $what!\n"; @@ -274,7 +353,7 @@ Index: texmf/scripts/texlive/tlmgr.pl } } if (win32() && ($pkg =~ m/$WinSpecialUpdatePackagesRegexp/)) { -@@ -757,10 +764,47 @@ +@@ -757,10 +764,51 @@ } } } else { @@ -287,7 +366,7 @@ Index: texmf/scripts/texlive/tlmgr.pl + my $root = $localtlpdb->root; + my $temp = "$root/temp"; + my ($s, $m, $fullname) = $tlp->make_container("tar", $root, $temp, -+ "${pkg}.r" . $tlp->revision); ++ "__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"); @@ -314,18 +393,22 @@ Index: texmf/scripts/texlive/tlmgr.pl + # TODO + tlwarn("\n\nInstallation of new version of $pkg did fail, trying to unwind!\n"); + if (TeXLive::TLMedia->_install_package("$unwind_package" , [] ,$localtlpdb)) { ++ # now we have to include the tlpobj ++ my $tlpobj = TeXLive::TLPOBJ->new; ++ $tlpobj->from_file($localtlpdb->root . "/tlpkg/tlpobj/$pkg.tlpobj"); ++ $localtlpdb->add_tlpobj($tlpobj); ++ $localtlpdb->save; + tlwarn("Restoring old package state succeeded.\n"); + } else { + tlwarn("Restoring of old package did NOT succeed!\n"); + tlwarn("Best is to call tlmgr install $pkg and hope to get it right!\n"); -+ tlwarn("TODO TODO restoring of the tlpobj???\n"); + } + } + info("done\n"); } } } elsif ($rev > $mediarev) { -@@ -813,6 +857,7 @@ +@@ -813,6 +861,7 @@ print "install: $pkg\n"; } else { # install the packages and run postinstall actions (that is the 0) @@ -333,7 +416,7 @@ Index: texmf/scripts/texlive/tlmgr.pl merge_into(\%ret, $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 0)); } } -@@ -976,6 +1021,7 @@ +@@ -976,6 +1025,7 @@ if ($opt_dry) { print "Installing $pkg.$a\n"; } else { @@ -341,7 +424,7 @@ Index: texmf/scripts/texlive/tlmgr.pl merge_into(\%ret, $tlmediasrc->install_package("$pkg.$a", $localtlpdb, 0, 0)); } } -@@ -984,8 +1030,11 @@ +@@ -984,8 +1034,11 @@ } if (TeXLive::TLUtils::member('win32', @todoarchs)) { # install the necessary win32 stuff @@ -353,3 +436,13 @@ Index: texmf/scripts/texlive/tlmgr.pl merge_into (\%ret, $tlmediasrc->install_package("bin-tlpsv.win32", $localtlpdb, 1, 0)); } # update the option_archs list of installed archs +@@ -1072,6 +1125,9 @@ + if (!defined($location)) { + die("No installation source found, nor in the texlive.tlpdb nor on the cmd line.\nPlease specify one!"); + } ++ if ($location =~ m/^ctan$/i) { ++ $location = "$TeXLive::TLConfig::TeXLiveURL"; ++ } + if ($location !~ m!^(http|ftp)://!i) { + # seems to be a local path, try to normalize it + my $testloc = abs_path($location); |