summaryrefslogtreecommitdiffstats
path: root/urpm/parallel_ssh.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-12-18 15:52:44 +0000
committerFrancois Pons <fpons@mandriva.com>2002-12-18 15:52:44 +0000
commitf87605f8e27a17aa146acd6bed0f36d394bca78d (patch)
treee237e164737b9f3e11cf5309db72a2c2c1abf5dc /urpm/parallel_ssh.pm
parent2a025b6a7401fd56308282adcfa936942a4cc357 (diff)
downloadurpmi-f87605f8e27a17aa146acd6bed0f36d394bca78d.tar
urpmi-f87605f8e27a17aa146acd6bed0f36d394bca78d.tar.gz
urpmi-f87605f8e27a17aa146acd6bed0f36d394bca78d.tar.bz2
urpmi-f87605f8e27a17aa146acd6bed0f36d394bca78d.tar.xz
urpmi-f87605f8e27a17aa146acd6bed0f36d394bca78d.zip
4.2-1mdk
Diffstat (limited to 'urpm/parallel_ssh.pm')
-rw-r--r--urpm/parallel_ssh.pm71
1 files changed, 67 insertions, 4 deletions
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index 4d66b372..f5c29405 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -18,6 +18,72 @@ sub parallel_register_rpms {
}
}
+#- parallel find_packages_to_remove
+sub parallel_find_remove {
+ my ($parallel, $urpm, $state, $l, %options) = @_;
+ my ($test, $node, %bad_nodes, %base_to_remove);
+ local (*F, $_);
+
+ #- keep in mind if the previous selection is still active, it avoid
+ #- to re-start urpme --test on each node.
+ if ($options{find_packages_to_remove}) {
+ delete $state->{ask_remove};
+ delete $urpm->{error_remove};
+ $test = '--test ';
+ } else {
+ @{$urpm->{error_remove} || []} and return @{$urpm->{error_remove}};
+ #- no need to restart what has been started before.
+ $options{test} and return keys %{$state->{ask_remove}};
+ $test = '';
+ }
+
+ #- now try an iteration of urpme.
+ foreach my $node (keys %{$parallel->{nodes}}) {
+ $urpm->{log}("parallel_ssh: ssh $node urpme --no-locales --auto $test".(join ' ', map { "'$_'" } @$l));
+ open F, "ssh 2>&1 $node urpme --no-locales --auto $test".(join ' ', map { "'$_'" } @$l)." |";
+ while (defined ($_ = <F>)) {
+ chomp;
+ /^\s*$/ and next;
+ /Checking to remove the following packages/ and next;
+ /To satisfy dependencies, the following packages are going to be removed/
+ and $urpm->{fatal}(1, ("node %s has bad version of urpme, please upgrade", $node));
+ if (/unknown packages?:? (.*)/) {
+ $options{callback_notfound} and $options{callback_notfound}->($urpm, split ", ", $1)
+ or delete $state->{ask_remove}, last;
+ } elsif (/The following packages contain ([^:]*): (.*)/) {
+ $options{callback_fuzzy} and $options{callback_fuzzy}->($urpm, $1, split " ", $2)
+ or delete $state->{ask_remove}, last;
+ } elsif (/removing package (.*) will break your system/) {
+ $base_to_remove{$1} = undef;
+ } elsif (/Removing failed/) {
+ $bad_nodes{$node} = [];
+ } else {
+ if (exists $bad_nodes{$node}) {
+ /^\s+(.*)/ and push @{$bad_nodes{$node}}, $1;
+ } else {
+ $state->{ask_remove}{$_}{$node} = undef;
+ }
+ }
+ }
+ close F;
+ }
+
+ #- check base, which has been delayed until there.
+ $options{callback_base} and %base_to_remove and $options{callback_base}->($urpm, keys %base_to_remove)
+ || return ();
+
+ #- build error list contains all the error returned by each node.
+ $urpm->{error_remove} = [];
+ foreach (keys %bad_nodes) {
+ my $msg = _("on node %s", $_);
+ foreach (@{$bad_nodes{$_}}) {
+ push @{$urpm->{error_remove}}, "$msg, $_";
+ }
+ }
+
+ keys %{$state->{ask_remove}};
+}
+
#- parallel resolve_dependencies
sub parallel_resolve_dependencies {
my ($parallel, $synthesis, $urpm, $state, $requested, %options) = @_;
@@ -74,7 +140,7 @@ sub parallel_resolve_dependencies {
foreach my $node (keys %{$parallel->{nodes}}) {
$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>) {
+ while (defined ($_ = <F>)) {
chomp;
if (/^\@removing\@(.*)/) {
$state->{ask_remove}{$1}{$node} = undef;
@@ -106,9 +172,6 @@ sub parallel_resolve_dependencies {
#- keep trace of what has been chosen finally (if any).
$parallel->{line} .= "$line ".join(' ', keys %chosen);
-
- #- update ask_remove, ask_unselect too along with provided value.
- #TODO
}
#- parallel install.