diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-07-28 13:15:32 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-07-28 13:15:32 +0000 |
commit | 4e1b93d8e18f451f76fd6f8c966c0fbeb3b8c56b (patch) | |
tree | d3b2c3259b8518367cfa52329f019b43e45ae4aa /URPM/Resolve.pm | |
parent | 8f468c2310106a3c0b3fd57b2d156db2ed4935fa (diff) | |
download | perl-URPM-4e1b93d8e18f451f76fd6f8c966c0fbeb3b8c56b.tar perl-URPM-4e1b93d8e18f451f76fd6f8c966c0fbeb3b8c56b.tar.gz perl-URPM-4e1b93d8e18f451f76fd6f8c966c0fbeb3b8c56b.tar.bz2 perl-URPM-4e1b93d8e18f451f76fd6f8c966c0fbeb3b8c56b.tar.xz perl-URPM-4e1b93d8e18f451f76fd6f8c966c0fbeb3b8c56b.zip |
unselect current package if an avoided package is already selected
Patch by Anssi Hannula, fixes bug #52145
If package 'a' Conflicts on 'b', and user (or a dependency chain) tries to
install both at the same time, perl-URPM will only detect the conflict if
package 'a' gets selected first (this depends on hdlist order), as
_set_rejected_from is only called in one direction from _handle_conflicts and
it does not detect that a package it is about to reject_from is already
selected.
This bug currently causes a failure in urpmi handle-conflict-deps2 testcase.
This commit checks if avoided package is already selected, and unselects
current package in such a case
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r-- | URPM/Resolve.pm | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 5c51206..279e58c 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -984,7 +984,7 @@ sub resolve_requested__no_suggests_ { _unselect_package_deprecated_by($urpm, $db, $state, \%diff_provides_h, $pkg); } - _handle_conflicts_with_selected($urpm, $state, $pkg); + _handle_conflicts_with_selected($urpm, $db, $state, $pkg, $dep, \@properties) or next; #- all requires should be satisfied according to selected package, or installed packages. if (my @l = unsatisfied_requires($urpm, $db, $state, $pkg)) { @@ -1035,20 +1035,31 @@ sub resolve_requested__no_suggests_ { grep { exists $state->{selected}{$_->id} } @selected; } -#- pre-disables packages that $pkg has conflict entries for +#- pre-disables packages that $pkg has conflict entries for, and +#- unselects $pkg if such a package is already selected #- side-effects: #- + those of _set_rejected_from ($state->{rejected}) +#- + those of disable_selected (flag_requested, flag_required, $state->{selected}, $state->{rejected}, $state->{whatrequires}) +#- + those of backtrack_selected ($state->{backtrack}, $state->{rejected}, $state->{selected}, $state->{whatrequires}, flag_requested, flag_required) sub _handle_conflicts_with_selected { - my ($urpm, $state, $pkg) = @_; + my ($urpm, $db, $state, $pkg, $dep, $properties) = @_; foreach ($pkg->conflicts) { if (my ($n, $o, $v) = property2name_op_version($_)) { foreach my $p ($urpm->packages_providing($n)) { $pkg == $p and next; $p->provides_overlap($_) or next; + if (exists $state->{selected}{$p->id}) { + $urpm->{debug_URPM}($pkg->fullname . " conflicts with already selected package " . $p->fullname) if $urpm->{debug_URPM}; + disable_selected($urpm, $db, $state, $pkg); + _set_rejected_from($state, $pkg, $p); + unshift @$properties, backtrack_selected($urpm, $db, $state, $dep); + return; + } _set_rejected_from($state, $p, $pkg); } } } + 1; } #- side-effects: |