From 8f468c2310106a3c0b3fd57b2d156db2ed4935fa Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 28 Jul 2009 13:15:08 +0000 Subject: 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 --- URPM/Resolve.pm | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'URPM/Resolve.pm') 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; -- cgit v1.2.1