diff options
-rw-r--r-- | urpm.pm | 7 | ||||
-rw-r--r-- | urpm/parallel_ka_run.pm | 36 | ||||
-rw-r--r-- | urpm/parallel_ssh.pm | 42 | ||||
-rwxr-xr-x | urpmi | 3 | ||||
-rw-r--r-- | urpmi.spec | 7 | ||||
-rwxr-xr-x | urpmq | 6 |
6 files changed, 80 insertions, 21 deletions
@@ -1,10 +1,10 @@ package urpm; use strict; -use vars qw($VERSION @ISA); +use vars qw($VERSION); +use base 'URPM'; $VERSION = '4.0'; -@ISA = qw(URPM); =head1 NAME @@ -1635,6 +1635,8 @@ sub search_packages { sub resolve_dependencies { my ($urpm, $state, $requested, %options) = @_; + require URPM::Resolve; + if ($urpm->{parallel_handler}) { #- let each node determine what is requested, according to handler given. $urpm->{parallel_handler}->parallel_resolve_dependencies("$urpm->{cachedir}/partial/parallel.cz", @_); @@ -1652,7 +1654,6 @@ sub resolve_dependencies { local $SIG{INT} = $sig_handler; local $SIG{QUIT} = $sig_handler; - require URPM::Resolve; #- auto select package for upgrading the distribution. $options{auto_select} and $urpm->request_packages_to_upgrade($db, $state, $requested, requested => undef); 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 @@ -498,7 +498,8 @@ if (%sources_install || %sources) { message(_("distributing %s\n", join(' ', values %sources_install, values %sources))); #- no remove are handle here, automatically done by each distant node. $urpm->{log}("starting distributed install"); - $urpm->parallel_install([ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources); + $urpm->parallel_install([ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources, + test => $test); } else { message(_("installing %s\n", join(' ', values %sources_install, values %sources))); log_it(scalar localtime, " ", join(' ', values %sources_install, values %sources), "\n"); @@ -2,7 +2,7 @@ Name: urpmi Version: 4.0 -Release: 7mdk +Release: 8mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -177,6 +177,11 @@ fi %changelog +* Thu Aug 29 2002 François Pons <fpons@mandrakesoft.com> 4.0-8mdk +- added --parallel option to urpmq. +- allowed test upgrade in parallel mode. +- improved first choices in parallel mode a little. + * Wed Aug 28 2002 François Pons <fpons@mandrakesoft.com> 4.0-7mdk - added --list-media to urpmq. - fixed old package not upgraded. @@ -60,6 +60,7 @@ usage: stdout (root only). ") . _(" --sources - give all source packages before downloading (root only). ") . _(" --force - force invocation even if some packages do not exist. +") . _(" --parallel - distributed urpmi accross machines of alias. ") . _(" --wget - use wget to retrieve distant files. ") . _(" --curl - use curl to retrieve distant files. ") . _(" --proxy - use specified HTTP proxy, the port number is assumed @@ -91,6 +92,7 @@ for (@ARGV) { /^--sources$/ and do { $query->{sources} = 1; next }; /^--force$/ and do { $query->{force} = 1; next }; /^--root$/ and do { push @nextargv, \$query->{root}; next }; + /^--parallel$/ and do { push @nextargv, \$query->{parallel}; next }; /^--wget$/ and do { $urpm->{sync} = sub { my $options = shift @_; if (ref $options) { $options->{prefer} = 'wget' } else { $options = { dir => $options, prefer => 'wget' } } @@ -143,6 +145,8 @@ $urpm->configure(nocheck_access => 1, media => $query->{media}, synthesis => $query->{synthesis}, update => $query->{update}, + root => $query->{root}, + parallel => $query->{parallel}, ); my $state = {}; @@ -252,7 +256,7 @@ my $query_sub = sub { my %hack_only_one; foreach my $id ($state->{selected} ? keys %{$state->{selected}} : keys %requested) { my $class = $state->{selected}{$id} || $requested{$id}; - if (ref $class) { + if (ref $class eq 'ARRAY') { foreach my $choices (@{$class || []}) { exists $hack_only_one{$choices} and next; print join('|', map { $query_sub->($_) } @$choices), "\n"; |