diff options
author | Francois Pons <fpons@mandriva.com> | 2002-08-29 09:40:49 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-08-29 09:40:49 +0000 |
commit | f6c7d40924ba941dd18d85446ae980c56cf1367d (patch) | |
tree | 0b53e7710c6d84c40a21da9d080b5f4593ac6c86 /urpm | |
parent | 451d040fd9c7322c5b528898c93c4a7463c64f0d (diff) | |
download | urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar.gz urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar.bz2 urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.tar.xz urpmi-f6c7d40924ba941dd18d85446ae980c56cf1367d.zip |
4.0-8mdk
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/parallel_ka_run.pm | 36 | ||||
-rw-r--r-- | urpm/parallel_ssh.pm | 42 |
2 files changed, 63 insertions, 15 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 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 |