From 933d4974697b7561b1ea880c4b7d9b75d92087bd Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 10 Dec 2002 16:30:57 +0000 Subject: 4.1-11mdk --- urpm/parallel_ka_run.pm | 24 ++++++++++++++++++++---- urpm/parallel_ssh.pm | 29 ++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 9 deletions(-) (limited to 'urpm') diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm index 7c43b34d..1ce539d9 100644 --- a/urpm/parallel_ka_run.pm +++ b/urpm/parallel_ka_run.pm @@ -1,5 +1,19 @@ package urpm::parallel_ka_run; +#- parallel copy +sub parallel_register_rpms { + my ($parallel, $urpm, @files) = @_; + + $urpm->{log}("parallel_ka_run: mput $parallel->{options} -- ".join(' ', @files)." $urpm->{cachedir}/rpms/"); + system "mput", split(' ', $parallel->{options}), '--', @files, "$urpm->{cachedir}/rpms/"; + + #- keep trace of direct files. + foreach (@files) { + my $basename = (/^.*\/([^\/]*)$/ && $1) || $_; + $parallel->{line} .= "$urpm->{cachedir}/rpms/$basename"; + } +} + #- parallel resolve_dependencies sub parallel_resolve_dependencies { my ($parallel, $synthesis, $urpm, $state, $requested, %options) = @_; @@ -11,7 +25,7 @@ sub parallel_resolve_dependencies { $parallel->{synthesis} = $synthesis; #- compute command line of urpm? tools. - my $line = $options{auto_select} ? ' --auto-select' : ''; + my $line = $parallel->{line} . ($options{auto_select} ? ' --auto-select' : ''); foreach (keys %$requested) { if (/\|/) { #- taken from URPM::Resolve to filter out choices, not complete though. @@ -52,12 +66,14 @@ sub parallel_resolve_dependencies { #- the following state should be cleaned for each iteration. delete $state->{selected}; #- now try an iteration of urpmq. - $urpm->{log}("parallel_ka_run: rshp -v $parallel->{options} -- urpmq --synthesis $synthesis -f $line ".join(' ', keys %chosen)); - open F, "rshp -v $parallel->{options} -- urpmq --synthesis $synthesis -fdu $line ".join(' ', keys %chosen)." |"; + $urpm->{log}("parallel_ka_run: rshp -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen)); + open F, "rshp -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen)." |"; while (defined ($_ = )) { chomp; s/<([^>]*)>.*:->:(.*)/$2/ and $node = $1; - if (/\|/) { + if (/^\@removing\@(.*)/) { + $state->{ask_remove}{$1}{$node}; + } elsif (/\|/) { #- distant urpmq returned a choices, check if it has already been chosen #- 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). diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm index e376b8f8..41edfa39 100644 --- a/urpm/parallel_ssh.pm +++ b/urpm/parallel_ssh.pm @@ -1,5 +1,22 @@ package urpm::parallel_ssh; +#- parallel copy +sub parallel_register_rpms { + my ($parallel, $urpm, @files) = @_; + + foreach (keys %{$parallel->{nodes}}) { + my $sources = join ' ', map { "'$_'" } @files; + $urpm->{log}("parallel_ssh: scp $sources $_:$urpm->{cachedir}/rpms"); + system "scp $sources $_:$urpm->{cachedir}/rpms"; + } + + #- keep trace of direct files. + foreach (@files) { + my $basename = (/^.*\/([^\/]*)$/ && $1) || $_; + $parallel->{line} .= "$urpm->{cachedir}/rpms/$basename"; + } +} + #- parallel resolve_dependencies sub parallel_resolve_dependencies { my ($parallel, $synthesis, $urpm, $state, $requested, %options) = @_; @@ -12,7 +29,7 @@ sub parallel_resolve_dependencies { $parallel->{synthesis} = $synthesis; #- compute command line of urpm? tools. - my $line = $options{auto_select} ? ' --auto-select' : ''; + my $line = $parallel->{line} . ($options{auto_select} ? ' --auto-select' : ''); foreach (keys %$requested) { if (/\|/) { #- taken from URPM::Resolve to filter out choices, not complete though. @@ -53,11 +70,13 @@ sub parallel_resolve_dependencies { delete $state->{selected}; #- now try an iteration of urpmq. foreach my $node (keys %{$parallel->{nodes}}) { - $urpm->{log}("parallel_ssh: ssh $node urpmq --synthesis $synthesis -f $line ".join(' ', keys %chosen)); - open F, "ssh $node urpmq --synthesis $synthesis -fdu $line ".join(' ', keys %chosen)." |"; + $urpm->{log}("parallel_ssh: ssh $node urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen)); + open F, "ssh $node urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen)." |"; while ($_ = ) { chomp; - if (/\|/) { + if (/^\@removing\@(.*)/) { + $state->{ask_remove}{$1}{$node}; + } elsif (/\|/) { #- distant urpmq returned a choices, check if it has already been chosen #- 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). @@ -84,7 +103,7 @@ sub parallel_resolve_dependencies { } while ($cont); #- keep trace of what has been chosen finally (if any). - $parallel->{line} = "$line ".join(' ', keys %chosen); + $parallel->{line} .= "$line ".join(' ', keys %chosen); #- update ask_remove, ask_unselect too along with provided value. #TODO -- cgit v1.2.1