From f6c7d40924ba941dd18d85446ae980c56cf1367d Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Thu, 29 Aug 2002 09:40:49 +0000 Subject: 4.0-8mdk --- urpm/parallel_ka_run.pm | 36 ++++++++++++++++++++++++++++++------ urpm/parallel_ssh.pm | 42 +++++++++++++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 15 deletions(-) (limited to 'urpm') 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 diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm index bd7ee200..db908add 100644 --- a/urpm/parallel_ssh.pm +++ b/urpm/parallel_ssh.pm @@ -6,8 +6,8 @@ sub parallel_resolve_dependencies { #- first propagate the synthesis file to all machine. foreach (keys %{$parallel->{nodes}}) { - $urpm->{log}("parallel_ssh: scp '$synthesis' '$_:$synthesis'"); - system "scp '$synthesis' '$_:$synthesis'"; + $urpm->{log}("parallel_ssh: scp -q '$synthesis' '$_:$synthesis'"); + system "scp -q '$synthesis' '$_:$synthesis'"; } $parallel->{synthesis} = $synthesis; @@ -15,11 +15,30 @@ 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 '\|', $_ ]); - $line .= ' '.$choice->fullname; + my $choice = $options{callback_choices}->($urpm, undef, $state, [ values %$packages ]); + $choice and $line .= ' '.$choice->fullname; } else { my $pkg = $urpm->{depslist}[$_] or next; $line .= ' '.$pkg->fullname; @@ -44,10 +63,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 -- cgit v1.2.1