diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-09-08 08:09:46 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-09-08 08:09:46 +0000 |
commit | 1a8fd0152093dba6cea8ba7e785f80d69db26d00 (patch) | |
tree | 2d2de5f6aa81c726de655018026d6750d74b7599 /URPM | |
parent | 041b2d73c4fd308f3c71cdd976b6382805eead23 (diff) | |
download | perl-URPM-1a8fd0152093dba6cea8ba7e785f80d69db26d00.tar perl-URPM-1a8fd0152093dba6cea8ba7e785f80d69db26d00.tar.gz perl-URPM-1a8fd0152093dba6cea8ba7e785f80d69db26d00.tar.bz2 perl-URPM-1a8fd0152093dba6cea8ba7e785f80d69db26d00.tar.xz perl-URPM-1a8fd0152093dba6cea8ba7e785f80d69db26d00.zip |
create _handle_conflicts() out of resolve_requested__no_suggests()
Diffstat (limited to 'URPM')
-rw-r--r-- | URPM/Resolve.pm | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 32a914b..ff65123 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -663,44 +663,7 @@ sub resolve_requested__no_suggests { $state->{whatrequires}{$_}{$pkg->id} = undef; } - #- examine conflicts, an existing package conflicting with this selection should - #- be upgraded to a new version which will be safe, else it should be removed. - foreach ($pkg->conflicts) { - @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->name eq $n && (!$o || eval($p->compare($v) . $o . 0)) or next; - $state->{rejected}{$p->fullname}{closure}{$pkg->fullname} = undef; - } - } - if (my ($file) = m!^(/[^\s\[]*)!) { - $db->traverse_tag('path', [ $file ], sub { - @keep and return; - my ($p) = @_; - if ($options{keep}) { - push @keep, scalar $p->fullname; - } else { - #- all these package should be removed. - resolve_rejected_($urpm, $db, $state, $p, \@properties, - removed => 1, - from => scalar $pkg->fullname, - why => { conflicts => $file }, - ); - } - }); - } elsif (my $name = property2name($_)) { - my $property = $_; - $db->traverse_tag('whatprovides', [ $name ], sub { - @keep and return; - my ($p) = @_; - if ($p->provides_overlap($property)) { - _handle_provides_overlap($urpm, $db, $state, $pkg, $p, $property, $name, \@properties, $options{keep} && \@keep); - } - }); - } - } + _handle_conflicts($urpm, $db, $state, $pkg, \@properties, $options{keep} && \@keep); #- examine if an existing package does not conflict with this one. $db->traverse_tag('whatconflicts', [ $pkg->name ], sub { @@ -728,6 +691,48 @@ sub resolve_requested__no_suggests { grep { exists $state->{selected}{$_->id} } @selected; } +sub _handle_conflicts { + my ($urpm, $db, $state, $pkg, $properties, $keep) = @_; + + #- examine conflicts, an existing package conflicting with this selection should + #- 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->name eq $n && (!$o || eval($p->compare($v) . $o . 0)) or next; + $state->{rejected}{$p->fullname}{closure}{$pkg->fullname} = undef; + } + } + if (my ($file) = m!^(/[^\s\[]*)!) { + $db->traverse_tag('path', [ $file ], sub { + $keep && @$keep and return; + my ($p) = @_; + if ($keep) { + push @$keep, scalar $p->fullname; + } else { + #- all these package should be removed. + resolve_rejected_($urpm, $db, $state, $p, $properties, + removed => 1, + from => scalar $pkg->fullname, + why => { conflicts => $file }, + ); + } + }); + } elsif (my $name = property2name($_)) { + my $property = $_; + $db->traverse_tag('whatprovides', [ $name ], sub { + $keep && @$keep and return; + my ($p) = @_; + if ($p->provides_overlap($property)) { + _handle_provides_overlap($urpm, $db, $state, $pkg, $p, $property, $name, $properties, $keep); + } + }); + } + } +} sub _compute_diff_provides { my ($urpm, $db, $state, $pkg) = @_; |