From fd092504f5b651ddf09012d27dc7e2d69110bae5 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 18 Sep 2008 09:39:20 +0000 Subject: update safer-update.diff, but long from being done git-svn-id: svn://tug.org/texlive/trunk@10632 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/etc/safer-update.diff | 99 +++++++++++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 7 deletions(-) diff --git a/Master/tlpkg/etc/safer-update.diff b/Master/tlpkg/etc/safer-update.diff index 4c600720f14..c93fdc64b72 100644 --- a/Master/tlpkg/etc/safer-update.diff +++ b/Master/tlpkg/etc/safer-update.diff @@ -1,8 +1,8 @@ Index: texmf/scripts/texlive/tlmgr.pl =================================================================== ---- texmf/scripts/texlive/tlmgr.pl (revision 10534) +--- texmf/scripts/texlive/tlmgr.pl (revision 10623) +++ texmf/scripts/texlive/tlmgr.pl (working copy) -@@ -541,15 +541,44 @@ +@@ -550,15 +550,44 @@ print "Restoring $pkg, $rev from $opt_backupdir/${pkg}.r${rev}.tar.lzma\n"; if (!$opt_dry) { init_local_db(1); @@ -51,7 +51,23 @@ Index: texmf/scripts/texlive/tlmgr.pl $localtlpdb->add_tlpobj($tlpobj); $ret = $localtlpdb->get_package($pkg)->make_return_hash_from_executes("enable"); $localtlpdb->save; -@@ -734,10 +763,45 @@ +@@ -664,6 +693,7 @@ + printf STDERR "$0: cannot find package $pkg\n"; + next; + } ++ my $unwind_package; + my $rev = $tlp->revision; + my $mediatlp = $mediatlpdb->get_package($pkg); + if (!defined($mediatlp)) { +@@ -689,6 +719,7 @@ + my $tlp = $localtlpdb->get_package($pkg); + $tlp->make_container("lzma", $localtlpdb->root, + $opt_backupdir, "${pkg}.r" . $tlp->revision); ++ $unwind_package = "$opt_backupdir/${pkg}.r" . $tlp->revision " . ".tar.lzma"; + } + } + if (win32() && ($pkg =~ m/$WinSpecialUpdatePackagesRegexp/)) { +@@ -744,10 +775,45 @@ } } } else { @@ -100,7 +116,7 @@ Index: texmf/scripts/texlive/tlmgr.pl } } } elsif ($rev > $mediarev) { -@@ -790,6 +854,7 @@ +@@ -800,6 +866,7 @@ print "install: $pkg\n"; } else { # install the packages and run postinstall actions (that is the 0) @@ -108,7 +124,7 @@ Index: texmf/scripts/texlive/tlmgr.pl merge_into(\%ret, $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 0)); } } -@@ -943,6 +1008,7 @@ +@@ -963,6 +1030,7 @@ if ($opt_dry) { print "Installing $pkg.$a\n"; } else { @@ -116,7 +132,7 @@ Index: texmf/scripts/texlive/tlmgr.pl merge_into(\%ret, $tlmediasrc->install_package("$pkg.$a", $localtlpdb, 0, 0)); } } -@@ -951,8 +1017,11 @@ +@@ -971,8 +1039,11 @@ } if (TeXLive::TLUtils::member('win32', @todoarchs)) { # install the necessary win32 stuff @@ -128,9 +144,78 @@ 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 +Index: tlpkg/TeXLive/TLPOBJ.pm +=================================================================== +--- tlpkg/TeXLive/TLPOBJ.pm (revision 10611) ++++ tlpkg/TeXLive/TLPOBJ.pm (working copy) +@@ -512,8 +512,8 @@ + + sub make_container { + my ($self,$type,$instroot,$destdir,$containername,$relative) = @_; +- if ($type ne "lzma") { +- die("TLPOBJ currently supports only lzma containers"); ++ if (($type ne "lzma") && ($type ne "tar")) { ++ die("TLPOBJ currently supports only plain or lzma containers"); + } + if (!defined($containername)) { + $containername = $self->name; +@@ -572,18 +572,25 @@ + close(TMP); + push @files, "$tlpobjdir/$self->{'name'}.tlpobj"; + $tarname = "$containername.tar"; +- $containername = "$tarname.lzma"; ++ if ($type eq "tar") { ++ $containername = $tarname; ++ } else { ++ $containername = "$tarname.lzma"; ++ } + + # start the whole fun + my $tar = $::progs{'tar'}; +- my $lzma = $::progs{'lzma'}; ++ my $lzma; + if (!defined($tar)) { + tlwarn("Programs have not been set up, trying with \"tar\"!\n"); + $tar = "tar"; + } +- if (!defined($lzma)) { +- tlwarn("Programs have not been set up, trying with \"lzma\"!\n"); +- $lzma = "lzma"; ++ if ($type eq "lzma") { ++ my $lzma = $::progs{'lzma'}; ++ if (!defined($lzma)) { ++ tlwarn("Programs have not been set up, trying with \"lzma\"!\n"); ++ $lzma = "lzma"; ++ } + } + my @cmdline = ($tar, "--owner", "0", "--group", "0", "-c", "-f", "$destdir/$tarname", "--files-from=-"); + unlink("$destdir/$containername"); +@@ -603,14 +610,16 @@ + } + } @files; + close ZIP; +- if (-r "$destdir/$tarname") { +- system($lzma, "--force", "-z", "$destdir/$tarname"); +- } else { +- tlwarn("Couldn't find $destdir/$tarname\n"); ++ if ($type eq "lzma") { ++ if (-r "$destdir/$tarname") { ++ system($lzma, "--force", "-z", "$destdir/$tarname"); ++ } else { ++ tlwarn("Couldn't find $destdir/$tarname\n"); ++ } + } + # compute the size +- my $size = (stat "$destdir/$tarname.lzma") [7]; +- my $m = TeXLive::TLUtils::tlmd5("$destdir/$tarname.lzma"); ++ my $size = (stat "$destdir/$containername") [7]; ++ my $m = TeXLive::TLUtils::tlmd5("$destdir/$containername"); + # cleaning up + unlink("$tlpobjdir/$self->{'name'}.tlpobj"); + rmdir("$tlpobjdir") if $removetlpobjdir; Index: tlpkg/TeXLive/TLMedia.pm =================================================================== ---- tlpkg/TeXLive/TLMedia.pm (revision 10538) +--- tlpkg/TeXLive/TLMedia.pm (revision 10611) +++ tlpkg/TeXLive/TLMedia.pm (working copy) @@ -117,7 +117,6 @@ # even if opt_doc is false -- cgit v1.2.3