diff options
author | Norbert Preining <preining@logic.at> | 2008-10-06 09:00:46 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-10-06 09:00:46 +0000 |
commit | 7bd5dea325b7ad05e831e46b64856c4851862143 (patch) | |
tree | 151efe32d776624117dbdcb50c07ea2844a08ddb /Master | |
parent | 9976b952eb3ec8d610d7b5992a7fde4c7c34ff95 (diff) |
tlmgr update now does:
- if a package is new on the server then install it on update of the colelction
- but, if the package has been forcibly removed (tlmgr remove --force), so
it is not actually new, it is NOT reinstalled
git-svn-id: svn://tug.org/texlive/trunk@10869 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 79 |
1 files changed, 59 insertions, 20 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 5f83896e270..c7b2667c5b5 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -848,6 +848,7 @@ sub action_update { "backupdir=s" => \$opt_backupdir, "dry-run" => \$opt_dry) or pod2usage(2); $opt_nodepends = 1 if $opt_reallynodepends; + my $nrupdated = 0; my %ret; init_tlmedia(); my $mediatlpdb = $tlmediasrc->tlpdb; @@ -881,7 +882,8 @@ sub action_update { for my $d ($tlc->depends) { my $tlp = $localtlpdb->get_package($d); if (!defined($tlp)) { - info("forcibly removed $d, mentioned in $c\n"); + # forcibly removed package, but no need to mention it here + # we do it below } else { # now check the remote tlpdb for reference of that package if (!defined($mediatlpdb->get_package($d))) { @@ -898,23 +900,35 @@ sub action_update { } else { @todo = @ARGV; } - if ($opt_list) { - # we check for new packages - # loop over all installed collections - for my $c ($localtlpdb->collections) { - my $tlc = $mediatlpdb->get_package($c); - if (!defined($tlc)) { - debug("collection $c has disappeared from the network!\n"); - } else { - # 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)) { - # there is a dep that is either new or has been forcibly - # removed by the user. report it as new, if the user does - # forcible removals it is their own problem. - info("$d ($c): new package\n"); + my %forcermpkgs; + my %newpkgs; + # we check for new packages + # loop over all installed collections + for my $c ($localtlpdb->collections) { + my $localtlc = $localtlpdb->get_package($c); + if (!defined($localtlc)) { + tlwarn("That should not happen!\n"); + next; + } + my @localtlcdeps = $localtlc->depends; + my $tlc = $mediatlpdb->get_package($c); + if (!defined($tlc)) { + debug("collection $c has disappeared from the network!\n"); + } else { + # 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)) { + # here we have two cases: + # 1) the packages is already mentioned in the local tlpdb, in this + # case it was forcibly removed and we do NOT reinstall it! + # 2) it is not mentioned, then it is really a new package and will + # be auto installed + if (grep(/^$d$/, @localtlcdeps)) { + $forcermpkgs{$d} = "$c"; + } else { + $newpkgs{$d} = "$c"; } } } @@ -923,7 +937,6 @@ sub action_update { if (!@todo) { tlwarn ("tlmgr update: please specify a list of packages or --all.\n"); } - my $nrupdated = 0; # update all .ARCH dependencies, too, unless $opt_reallynodepends @todo = $mediatlpdb->expand_dependencies("-only-arch", $localtlpdb, @todo) unless $opt_reallynodepends; # update deps unless $opt_nodepends @@ -932,7 +945,33 @@ sub action_update { next if ($pkg =~ m/^00texlive/); my $tlp = $localtlpdb->get_package($pkg); if (!defined($tlp)) { - tlwarn("$0: $pkg not installed locally\n"); + if ($forcermpkgs{$pkg}) { + info("not reinstalling forcibly removed package $pkg ($forcermpkgs{$pkg})\n"); + next; + } elsif ($newpkgs{$pkg}) { + # do nothing here, it will be reported below! + } else { + tlwarn("That should not happen: $pkg mentioned somewhere, but neither new nor force removed, please report!\n"); + next; + } + # install new packages + my $mediatlp = $mediatlpdb->get_package($pkg); + if (!defined($mediatlp)) { + tlwarn("strange, that should not happen: $pkg cannot be found in $location\n"); + next; + } + my $mediarev = $mediatlp->revision; + info("auto-install: $pkg ($newpkgs{$pkg})\n"); + next if ($opt_dry || $opt_list); + my $foo = $tlmediasrc->install_package($pkg, $localtlpdb); + if (ref $foo) { + # installation succeeded because we got a reference + merge_into (\%ret, $foo); + logpackage("auto install new: $pkg ($mediarev)"); + $nrupdated++; + } else { + tlwarn("$0: couldn't install new package $pkg\n"); + } next; } my $unwind_package; |