From e60d47449744866c1cc78079b8048dbc482d9b08 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 9 Jul 2008 18:53:29 +0000 Subject: merge small differences between those 2 modules --- urpm/parallel_ka_run.pm | 14 +++++++------- urpm/parallel_ssh.pm | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm index 2fc1dacd..d351e90a 100644 --- a/urpm/parallel_ka_run.pm +++ b/urpm/parallel_ka_run.pm @@ -41,7 +41,7 @@ sub parallel_find_remove { my ($parallel, $urpm, $state, $l, %options) = @_; my ($test, $node, %bad_nodes, %base_to_remove, %notfound); - #- keep in mind if the previous selection is still active, it avoid + #- keep in mind if the previous selection is still active, it avoids #- to re-start urpme --test on each node. if ($options{find_packages_to_remove}) { delete $state->{rejected}; @@ -54,7 +54,7 @@ sub parallel_find_remove { $test = '--force '; } - #- now try an iteration of urpmq. + #- now try an iteration of urpme. $urpm->{log}("parallel_ka_run: $rshp_command -v $parallel->{options} -- urpme --no-locales --auto $test" . (join ' ', map { "'$_'" } @$l)); open my $fh, "$rshp_command -v $parallel->{options} -- urpme --no-locales --auto $test" . join(' ', map { "'$_'" } @$l) . " 2>&1 |"; local $_; @@ -66,7 +66,7 @@ sub parallel_find_remove { /To satisfy dependencies, the following packages are going to be removed/ and $urpm->{fatal}(1, N("node %s has an old version of urpme, please upgrade", $node)); if (/unknown packages?:? (.*)/) { - #- keep in mind unknown package from the node, because it should not be a fatal error + #- remember unknown packages from the node, because it should not be a fatal error #- if other node have it. @notfound{split ", ", $1} = (); } elsif (/The following packages contain ([^:]*): (.*)/) { @@ -82,7 +82,7 @@ sub parallel_find_remove { if (exists $bad_nodes{$node}) { /^\s+(.+)/ and push @{$bad_nodes{$node}}, $1; } else { - s/\s*\(.*//; #- remove reason (too complex to handle and needed to be removed). + s/\s*\(.*//; #- remove reason (too complex to handle, needs to be removed) $state->{rejected}{$_}{removed} = 1; $state->{rejected}{$_}{nodes}{$node} = undef; } @@ -116,7 +116,7 @@ sub parallel_resolve_dependencies { my ($parallel, $synthesis, $urpm, $state, $requested, %options) = @_; my (%avoided, %requested); - #- first propagate the synthesis file to all machine. + #- first propagate the synthesis file to all machines $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- '$synthesis' '$synthesis'", N("Propagating synthesis to nodes...")); system($mput_command, $parallel->{options}, '--', $synthesis, $synthesis); $? == 0 || $? == 256 or $urpm->{fatal}(1, N("mput failed, maybe a node is unreacheable")); @@ -147,7 +147,7 @@ sub parallel_resolve_dependencies { } $_ = $best_requested || $best; } - #- simplified choices resolution. + #- simplified choice resolution. my $choice = $options{callback_choices}->($urpm, undef, $state, [ values %$packages ]); if ($choice) { $urpm->{source}{$choice->id} and next; #- local packages have already been added. @@ -182,7 +182,7 @@ sub parallel_resolve_dependencies { #- 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). - unless (grep { exists $chosen{$_} } split '\|', $_) { + unless (grep { exists $chosen{$_} } split /\|/, $_) { my $choice = $options{callback_choices}->($urpm, undef, $state, [ map { $urpm->search($_) } split '\|', $_ ]); if ($choice) { $chosen{scalar $choice->fullname} = $choice; diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm index 10a57a83..35b6e79a 100644 --- a/urpm/parallel_ssh.pm +++ b/urpm/parallel_ssh.pm @@ -68,11 +68,11 @@ sub parallel_find_remove { /^\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)); + and $urpm->{fatal}(1, N("node %s has an old version of urpme, please upgrade", $node)); if (/unknown packages?:? (.*)/) { #- remember unknown packages from the node, because it should not be a fatal error #- if other nodes have it. - @notfound{split /, /, $1} = (); + @notfound{split ", ", $1} = (); } elsif (/The following packages contain ([^:]*): (.*)/) { $options{callback_fuzzy} && $options{callback_fuzzy}->($urpm, $1, split(" ", $2)) or delete $state->{rejected}, last; @@ -96,7 +96,7 @@ sub parallel_find_remove { } #- check base, which has been delayed until there. - if ($options{callback_base} && keys %base_to_remove) { + if ($options{callback_base} && %base_to_remove) { $options{callback_base}->($urpm, keys %base_to_remove) or return (); } @@ -108,7 +108,7 @@ sub parallel_find_remove { #- if at least one node has the package, it should be seen as unknown... delete @notfound{map { /^(.*)-[^-]*-[^-]*$/ } keys %{$state->{rejected}}}; - if (keys %notfound) { + if (%notfound) { $options{callback_notfound} && $options{callback_notfound}->($urpm, keys %notfound) or delete $state->{rejected}; } @@ -212,7 +212,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} = join(' ', $line, keys %chosen); } #- parallel install. @@ -249,7 +249,7 @@ sub parallel_install { exists $bad_nodes{$_} or next; $urpm->{error}(N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_}); } - keys %bad_nodes and return; + %bad_nodes and return; if ($options{test}) { $urpm->{error}(N("Installation is possible")); @@ -302,7 +302,6 @@ sub handle_parallel_options { nodes => \%nodes, }, "urpm::parallel_ssh"; } - return undef; } -- cgit v1.2.1