diff options
author | Norbert Preining <preining@logic.at> | 2008-05-12 22:39:30 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-05-12 22:39:30 +0000 |
commit | a860ccc6a5d98527536463dbc948cf8b4ab8e9b7 (patch) | |
tree | 52f4a10592798374c1b517f882e52e90563cfc50 /Master | |
parent | 62271d4cebfe60d1805b3aea096c5fa4dbc9fab5 (diff) |
bugfixes for tlmgr restore functionality, first test did now succeed
git-svn-id: svn://tug.org/texlive/trunk@8098 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 664dda052b2..f7921f00274 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -448,13 +448,13 @@ sub action_restore { closedir (DIR) || warn "closedir($opt_backupdir) failed: $!"; for my $dirent (@dirents) { next if (-d $dirent); - next if ($dirent !~ m/^(.*)_r([0-9]+).tar.lzma$/; + next if ($dirent !~ m/^(.*)_r([0-9]+).tar.lzma$/); $backups{$1}->{$2} = 1; } my $ret; my ($pkg, $rev) = @ARGV; if (!defined($pkg)) { - if (keys %backup) { + if (keys %backups) { print "Available backups:\n"; foreach my $p (sort keys %backups) { print "$p: "; @@ -468,12 +468,12 @@ sub action_restore { } if (!defined($rev)) { print "Available backups for $pkg: "; - my @rs = sort (keys %{$backups{$p}}); + my @rs = sort (keys %{$backups{$pkg}}); print "@rs\n"; exit 0; } # we did arrive here, so we try to restore ... - if (defined($backup{$pkg}->{$rev})) { + if (defined($backups{$pkg}->{$rev})) { if (!$opt_force) { print "Do you really want to restore $pkg to revision $rev (y/N): "; my $yesno = <STDIN>; @@ -484,12 +484,19 @@ sub action_restore { } print "Restoring $pkg, $rev from $opt_backupdir/${pkg}_r${rev}.tar.lzma\n"; if (!$opt_dry) { + init_local_db(); # first remove the package, then reinstall it # this way we get rid of useless files # force the deinstallation since we will reinstall it + $opt_backupdir = abs_path($opt_backupdir); merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1)); - $tlmediasrc->_install_package("$opt_backupdir/${pkg}_r${rev}.tar.lzma" , [] ,$localtlpdb); + TeXLive::TLMedia->_install_package("$opt_backupdir/${pkg}_r${rev}.tar.lzma" , [] ,$localtlpdb); + # now we have to read the .tlpobj file and add it to the DB + my $tlpobj = TeXLive::TLPOBJ->new; + $tlpobj->from_file($localtlpdb->root . "/tlpkg/tlpobj/$pkg.tlpobj"); + $localtlpdb->add_tlpobj($tlpobj); $ret = $localtlpdb->get_package($pkg)->make_return_hash_from_executes; + $localtlpdb->save; } } else { print "revision $rev for $pkg is not present in $opt_backupdir\n"; |