diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-09-07 21:56:29 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-09-07 21:56:29 +0000 |
commit | be692c90818532fdc18460cde5cb2e692a5ad55a (patch) | |
tree | f2c4db71a76e50a37ccd9c8a1a48c96c616807fe | |
parent | fd59607448e20bee4658277efbc92b6d71f6e5b9 (diff) | |
download | perl-URPM-be692c90818532fdc18460cde5cb2e692a5ad55a.tar perl-URPM-be692c90818532fdc18460cde5cb2e692a5ad55a.tar.gz perl-URPM-be692c90818532fdc18460cde5cb2e692a5ad55a.tar.bz2 perl-URPM-be692c90818532fdc18460cde5cb2e692a5ad55a.tar.xz perl-URPM-be692c90818532fdc18460cde5cb2e692a5ad55a.zip |
create _handle_diff_provides() out of resolve_requested__no_suggests()
-rw-r--r-- | URPM/Resolve.pm | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index a4d9c41..861b544 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -719,57 +719,7 @@ sub resolve_requested__no_suggests { } } if (defined ($dep = shift @diff_provides)) { - my ($n, $pkg) = ($dep->{name}, $dep->{pkg}); - with_db_unsatisfied_requires($urpm, $db, $state, $n, sub { - my ($p, @l) = @_; - - #- try if upgrading the package will be satisfying all the requires... - #- there is no need to avoid promoting epoch as the package examined is not - #- already installed. - my $packages = $urpm->find_candidate_packages($p->name, avoided => $state->{rejected}); - my $best = join '|', map { $_->id } - grep { ($_->name eq $p->name || - $_->obsoletes_overlap($p->name . " == " . $p->epoch . ":" . $p->version . "-" . $p->release)) - && $_->fullname ne $p->fullname && - $urpm->unsatisfied_requires($db, $state, $_, name => $n) == 0 } - map { @{$_ || []} } values %$packages; - - if (length $best) { - $urpm->{debug_URPM}("promoting " . $urpm->{depslist}[$best]->fullname . " because of conflict above") if $urpm->{debug_URPM}; - push @properties, { required => $best, promote => $n, psel => $pkg }; - } else { - #- no package have been found, we may need to remove the package examined unless - #- there exists enough packages that provided the unsatisfied requires. - my @best; - foreach (@l) { - $packages = $urpm->find_candidate_packages($_, - avoided => $state->{rejected}); - $best = join('|', - map { $_->id } - grep { $_->fullname ne $p->fullname } - map { @{$_ || []} } values %$packages); - $best and push @best, $best; - } - - if (@best == @l) { - $urpm->{debug_URPM}("promoting " . join(' ', _ids_to_fullnames($urpm, @best)) . " because of conflict above") if $urpm->{debug_URPM}; - push @properties, map { +{ required => $_, promote => $n, psel => $pkg } } @best; - } else { - if ($options{keep}) { - unshift @properties, $urpm->backtrack_selected($db, $state, - { keep => [ scalar $p->fullname ], - psel => $pkg, - }, - %options); - } else { - resolve_rejected_($urpm, $db, $state, $p, \@properties, - removed => 1, - from => scalar $pkg->fullname, - why => { unsatisfied => \@l }); - } - } - } - }); + _handle_diff_provides($urpm, $db, $state, \@properties, $dep->{name}, $dep->{pkg}, %options); } } while @diff_provides || @properties; @@ -880,6 +830,59 @@ sub _compute_diff_provides_one { }); } +sub _handle_diff_provides { + my ($urpm, $db, $state, $properties, $n, $pkg, %options) = @_; + + with_db_unsatisfied_requires($urpm, $db, $state, $n, sub { + my ($p, @l) = @_; + + #- try if upgrading the package will be satisfying all the requires... + #- there is no need to avoid promoting epoch as the package examined is not + #- already installed. + my $packages = $urpm->find_candidate_packages($p->name, avoided => $state->{rejected}); + my $best = join '|', map { $_->id } + grep { ($_->name eq $p->name || + $_->obsoletes_overlap($p->name . " == " . $p->epoch . ":" . $p->version . "-" . $p->release)) + && $_->fullname ne $p->fullname && + $urpm->unsatisfied_requires($db, $state, $_, name => $n) == 0 } + map { @{$_ || []} } values %$packages; + + if (length $best) { + $urpm->{debug_URPM}("promoting " . $urpm->{depslist}[$best]->fullname . " because of conflict above") if $urpm->{debug_URPM}; + push @$properties, { required => $best, promote => $n, psel => $pkg }; + } else { + #- no package have been found, we may need to remove the package examined unless + #- there exists enough packages that provided the unsatisfied requires. + my @best; + foreach (@l) { + $packages = $urpm->find_candidate_packages($_, + avoided => $state->{rejected}); + $best = join('|', map { $_->id } + grep { $_->fullname ne $p->fullname } + map { @{$_ || []} } values %$packages); + $best and push @best, $best; + } + + if (@best == @l) { + $urpm->{debug_URPM}("promoting " . join(' ', _ids_to_fullnames($urpm, @best)) . " because of conflict above") if $urpm->{debug_URPM}; + push @$properties, map { +{ required => $_, promote => $n, psel => $pkg } } @best; + } else { + if ($options{keep}) { + unshift @$properties, + $urpm->backtrack_selected($db, $state, + { keep => [ scalar $p->fullname ], psel => $pkg }, + %options); + } else { + resolve_rejected_($urpm, $db, $state, $p, $properties, + removed => 1, + from => scalar $pkg->fullname, + why => { unsatisfied => \@l }); + } + } + } + }); +} + sub _handle_provides_overlap { my ($urpm, $db, $state, $pkg, $p, $property, $name, $properties, $keep) = @_; |