summaryrefslogtreecommitdiffstats
path: root/urpm/parallel_ka_run.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-08-29 09:40:49 +0000
committerFrancois Pons <fpons@mandriva.com>2002-08-29 09:40:49 +0000
commitf6c7d40924ba941dd18d85446ae980c56cf1367d (patch)
tree0b53e7710c6d84c40a21da9d080b5f4593ac6c86 /urpm/parallel_ka_run.pm
parent451d040fd9c7322c5b528898c93c4a7463c64f0d (diff)
downloadurpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar
urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar.gz
urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar.bz2
urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar.xz
urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.zip
4.0-8mdk
Diffstat (limited to 'urpm/parallel_ka_run.pm')
-rw-r--r--urpm/parallel_ka_run.pm36
1 files changed, 30 insertions, 6 deletions
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index 8a60ed8f..92f5aedf 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -13,10 +13,29 @@ sub parallel_resolve_dependencies {
my $line = $options{auto_select} ? ' --auto-select' : '';
foreach (keys %$requested) {
if (/\|/) {
+ #- taken from URPM::Resolve to filter out choices, not complete though.
+ my $packages = $urpm->find_candidate_packages($_);
+ foreach (values %$packages) {
+ my ($best_requested, $best);
+ foreach (@$_) {
+ exists $state->{selected}{$_->id} and $best_requested = $_, last;
+ exists $avoided{$_->name} and next;
+ if ($best_requested || exists $requested{$_->id}) {
+ if ($best_requested && $best_requested != $_) {
+ $_->compare_pkg($best_requested) > 0 and $best_requested = $_;
+ } else {
+ $best_requested = $_;
+ }
+ } elsif ($best && $best != $_) {
+ $_->compare_pkg($best) > 0 and $best = $_;
+ } else {
+ $best = $_;
+ }
+ }
+ $_ = $best_requested || $best;
+ }
#- simplified choices resolution.
- my $choice = $options{callback_choices}->($urpm, undef, $state, [ map { /^\d+$/ ?
- $urpm->{depslist}[$_] :
- $urpm->search($_) } split '\|', $_ ]);
+ my $choice = $options{callback_choices}->($urpm, undef, $state, [ values %$packages ]);
$line .= ' '.$choice->fullname;
} else {
my $pkg = $urpm->{depslist}[$_] or next;
@@ -42,10 +61,15 @@ sub parallel_resolve_dependencies {
#- or continue iteration to make sure no more choices are left.
$cont ||= 1; #- invalid transitory state (still choices is strange here if next sentence is not executed).
unless (grep { exists $chosen{$_} } split '\|', $_) {
- #- it has not yet been chosen so need to ask user.
- $cont = 2;
my $choice = $options{callback_choices}->($urpm, undef, $state, [ map { $urpm->search($_) } split '\|', $_ ]);
- $chosen{scalar $choice->fullname} = $choice;
+ if ($choice) {
+ $chosen{scalar $choice->fullname} = $choice;
+ #- it has not yet been chosen so need to ask user.
+ $cont = 2;
+ } else {
+ #- no choices resolved, so forget it (no choices means no choices at all).
+ $cont = 0;
+ }
}
} else {
my $pkg = $urpm->search($_) or next; #TODO