diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-06-02 06:37:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-06-02 06:37:59 +0000 |
commit | 8f0e0f2a2fcc77de1dcf29e1aee7b83d1407db3e (patch) | |
tree | a548b4fad063583fa47004d29fe46e9faccd796f | |
parent | 8692b2fc28950c1dabd07a8ded38e747a9a83a9b (diff) | |
download | urpmi-8f0e0f2a2fcc77de1dcf29e1aee7b83d1407db3e.tar urpmi-8f0e0f2a2fcc77de1dcf29e1aee7b83d1407db3e.tar.gz urpmi-8f0e0f2a2fcc77de1dcf29e1aee7b83d1407db3e.tar.bz2 urpmi-8f0e0f2a2fcc77de1dcf29e1aee7b83d1407db3e.tar.xz urpmi-8f0e0f2a2fcc77de1dcf29e1aee7b83d1407db3e.zip |
- urpmi
o fix --replacepkgs when a package appears more than once in urpmi db (#40893)
(need perl-URPM 3.14)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | urpm/select.pm | 18 | ||||
-rwxr-xr-x | urpmi | 6 |
3 files changed, 21 insertions, 5 deletions
@@ -1,6 +1,8 @@ - urpmi: o --auto-update should behave like urpmi.update when mirrorlist is outdated (cf http://forum.mandriva.com/viewtopic.php?t=86837) + o fix --replacepkgs when a package appears more than once in urpmi db (#40893) + (need perl-URPM 3.14) - urpmi.addmedia: o add missing mark in "Do you want to add media '%s'?" message (from Nikos) - urpmi.addmedia, urpmi.update: diff --git a/urpm/select.pm b/urpm/select.pm index c67f4edc..608540d6 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -282,6 +282,24 @@ sub resolve_dependencies { $need_restart; } +sub select_replacepkgs { + my ($urpm, $state, $requested) = @_; + + my $db = urpm::db_open_or_die($urpm, $urpm->{root}); + foreach my $id (keys %$requested) { + my @pkgs = $urpm->find_candidate_packages_($id); + if (my @installed = grep { URPM::is_package_installed($db, $_) } @pkgs) { + foreach my $pkg (@installed) { + $urpm->{debug_URPM}("selecting replacepkg " . $pkg->fullname) if $urpm->{debug_URPM}; + $pkg->set_flag_requested; + $state->{selected}{$pkg->id} = undef; + } + } else { + $urpm->{fatal}(1, N("found package(s) %s in urpmi db, but none are installed", join(', ', map { scalar($_->fullname) } @pkgs))); + } + } +} + sub _priority_upgrade_pkgs { my ($urpm, $priority_upgrade_string) = @_; @@ -479,11 +479,7 @@ sub ask_choice { #- packages being upgraded (problably urpmi and perl-URPM, but maybe rpm too, and glibc also ?). my $restart_itself; if ($options{replacepkgs}) { - foreach (keys %requested) { - my $pkg = $urpm->{depslist}[$_] or next; - $pkg->set_flag_requested; - $state->{selected}{$_} = undef; - } + urpm::select::select_replacepkgs($urpm, $state, \%requested); } else { $restart_itself = urpm::select::resolve_dependencies($urpm, $state, |