diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-07-28 13:15:08 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-07-28 13:15:08 +0000 |
commit | 8f468c2310106a3c0b3fd57b2d156db2ed4935fa (patch) | |
tree | c57742898d702dba2dd8b1df43d8a1f18843a0d5 /URPM/Resolve.pm | |
parent | a03cc8fca2f2910417d63086bc8b84081d588042 (diff) | |
download | perl-URPM-8f468c2310106a3c0b3fd57b2d156db2ed4935fa.tar perl-URPM-8f468c2310106a3c0b3fd57b2d156db2ed4935fa.tar.gz perl-URPM-8f468c2310106a3c0b3fd57b2d156db2ed4935fa.tar.bz2 perl-URPM-8f468c2310106a3c0b3fd57b2d156db2ed4935fa.tar.xz perl-URPM-8f468c2310106a3c0b3fd57b2d156db2ed4935fa.zip |
move part of _handle_conflicts to _handle_conflicts_with_selected
Patch by Anssi Hannula, first step toward fixing 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 patch moves part of _handle_conflicts to _handle_conflicts_with_selected
to be called before dependencies get added, needed by next patch
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r-- | URPM/Resolve.pm | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 9aa7064..5c51206 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -984,6 +984,8 @@ sub resolve_requested__no_suggests_ { _unselect_package_deprecated_by($urpm, $db, $state, \%diff_provides_h, $pkg); } + _handle_conflicts_with_selected($urpm, $state, $pkg); + #- all requires should be satisfied according to selected package, or installed packages. if (my @l = unsatisfied_requires($urpm, $db, $state, $pkg)) { $urpm->{debug_URPM}("requiring " . join(',', sort @l) . " for " . $pkg->fullname) if $urpm->{debug_URPM}; @@ -1033,8 +1035,23 @@ sub resolve_requested__no_suggests_ { grep { exists $state->{selected}{$_->id} } @selected; } +#- pre-disables packages that $pkg has conflict entries for #- side-effects: #- + those of _set_rejected_from ($state->{rejected}) +sub _handle_conflicts_with_selected { + my ($urpm, $state, $pkg) = @_; + 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; + _set_rejected_from($state, $p, $pkg); + } + } + } +} + +#- side-effects: #- + those of set_rejected_and_compute_diff_provides ($state->{rejected}, $diff_provides_h) #- + those of _handle_conflict ($properties, $keep, $diff_provides_h) sub _handle_conflicts { @@ -1044,14 +1061,6 @@ sub _handle_conflicts { #- be upgraded to a new version which will be safe, else it should be removed. foreach ($pkg->conflicts) { $keep && @$keep and last; - #- propagate conflicts to avoid - if (my ($n, $o, $v) = property2name_op_version($_)) { - foreach my $p ($urpm->packages_providing($n)) { - $pkg == $p and next; - $p->provides_overlap($_) or next; - _set_rejected_from($state, $p, $pkg); - } - } if (my ($file) = m!^(/[^\s\[]*)!) { $db->traverse_tag('path', [ $file ], sub { $keep && @$keep and return; |