diff options
author | Norbert Preining <preining@logic.at> | 2010-03-12 17:53:24 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2010-03-12 17:53:24 +0000 |
commit | edb543fd68f53404a38825694f9d54535feb7b50 (patch) | |
tree | 258d1655fc06e08ce19d782f526a569212a9f7a1 | |
parent | 354c0864a5566b532eba4b6c12244e22d2f9078f (diff) |
tlmgr: do not warn if during an upgrade a file is moved from one to another
package
git-svn-id: svn://tug.org/texlive/trunk@17443 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 50 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLMedia.pm | 27 |
2 files changed, 73 insertions, 4 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index f0daffa7810..36d71c8de7f 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -1994,6 +1994,53 @@ sub action_update { for (@addlines) { print; } # + # compute the list of moved files from %removals, @new, @updated + # + my %do_warn_on_move; + { + # keep all these vars local to this block + my @removals = keys %removals; + my %old_files_to_pkgs; + my %new_files_to_pkgs; + # first save for each file in the currently installed packages + # to be updated the packages it is contained it (might be more!) + # + for my $p (@updated, @removals) { + my $pkg = $localtlpdb->get_package($p); + tlwarn("Should not happen: $p not found in local tlpdb\n") if (!$pkg); + next; + for my $f ($pkg->all_files) { + push @{$old_files_to_pkgs{$f}}, $p; + } + } + for my $p (@updated, @new) { + my $pkg = $tlmediatlpdb->get_package($p); + tlwarn("Should not happen: $p not found in $location\n") if (!$pkg); + next; + for my $f ($pkg->all_files) { + if ($pkg->relocated) { + $f =~ s:^$RelocPrefix/:$RelocTree/:; + } + push @{$new_files_to_pkgs{$f}}, $p; + } + } + # + # the idea of supressing warnings is simply that if a file is present + # in more than one package either in the beginning or after a full + # update then this should give a warning. In all other cases + # the warning should be supressed. + for my $f (keys %old_files_to_pkgs) { + my @a = @{$old_files_to_pkgs{$f}}; + $do_warn_on_move{$f} = 1 if ($#a > 0) + } + for my $f (keys %new_files_to_pkgs) { + my @a = @{$new_files_to_pkgs{$f}}; + $do_warn_on_move{$f} = 1 if ($#a > 0) + } + } + + + # # ORDER OF PACKAGE ACTIONS # 1. removals # 2. updates @@ -2220,7 +2267,8 @@ sub action_update { if ($pkg =~ m/$CriticalPackagesRegexp/) { debug("Not removing critical package $pkg\n"); } else { - $localtlmedia->remove_package($pkg); + $localtlmedia->remove_package($pkg, + "remove-warn-files" => \%do_warn_on_move); } if ($tlmediasrc->install_package($pkg, $localtlpdb)) { # installation succeeded because we got a reference diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm index 31d128fe50c..99eb234d896 100644 --- a/Master/tlpkg/TeXLive/TLMedia.pm +++ b/Master/tlpkg/TeXLive/TLMedia.pm @@ -398,7 +398,7 @@ sub _install_package { # remove_package removes a single package with all files (including the # # tlpobj files) and the entry from the tlpdb. sub remove_package { - my ($self, $pkg, $nopostinstall) = @_; + my ($self, $pkg, %opts) = @_; my $localtlpdb = $self->tlpdb; my $tlp = $localtlpdb->get_package($pkg); if (!defined($tlp)) { @@ -445,15 +445,36 @@ sub remove_package { } my @goodfiles = (); my @badfiles = (); + my @debugfiles = (); for my $f (@files) { # in usermode we have to add texmf-dist again for comparison if (defined($allfiles{$f})) { # this file should be removed but is mentioned somewhere, too - push @badfiles, $f; + # take into account if we got a warn list + if (defined($opts{'remove-warn-files'})) { + my %a = %{$opts{'remove-warn-files'}}; + if (defined($a{$f})) { + push @badfiles, $f; + } else { + # NO NOTHING HERE!!! + # DON'T PUSH IT ON @goodfiles, it will be removed, which we do + # NOT want. We only want to supress the warning! + push @debugfiles, $f; + } + } else { + push @badfiles, $f; + } } else { push @goodfiles, $f; } } + if ($#debugfiles >= 0) { + debug("The following files will not be removed due to the removal of $pkg.\n"); + debug("But we do not warn on it because they are moved to other packages.\n"); + for my $f (@debugfiles) { + debug(" $f - $allfiles{$f}\n"); + } + } if ($#badfiles >= 0) { # warn the user tlwarn("The following files should be removed due to the removal of $pkg,\n"); @@ -465,7 +486,7 @@ sub remove_package { # # Run only the postaction code thing now since afterwards the # files will be gone ... - if (!$nopostinstall) { + if (defined($opts{'nopostinstall'}) && $opts{'nopostinstall'}) { &TeXLive::TLUtils::do_postaction("remove", $tlp, 0, # option_file_assocs, 0, # option_desktop_integration, |