diff options
author | Francois Pons <fpons@mandriva.com> | 2002-12-10 16:30:57 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-12-10 16:30:57 +0000 |
commit | 933d4974697b7561b1ea880c4b7d9b75d92087bd (patch) | |
tree | feafc352a3fa72a1590577aa7db2938634fe84b3 /urpm | |
parent | f7ed619b0b08764dc83b0bc8c314c59b8fecac48 (diff) | |
download | urpmi-933d4974697b7561b1ea880c4b7d9b75d92087bd.tar urpmi-933d4974697b7561b1ea880c4b7d9b75d92087bd.tar.gz urpmi-933d4974697b7561b1ea880c4b7d9b75d92087bd.tar.bz2 urpmi-933d4974697b7561b1ea880c4b7d9b75d92087bd.tar.xz urpmi-933d4974697b7561b1ea880c4b7d9b75d92087bd.zip |
4.1-11mdk
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/parallel_ka_run.pm | 24 | ||||
-rw-r--r-- | urpm/parallel_ssh.pm | 29 |
2 files changed, 44 insertions, 9 deletions
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 ($_ = <F>)) { 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 ($_ = <F>) { 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 |