summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-10 12:19:39 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-10 12:19:39 +0000
commitc835f00ab6b8041b1acc7292997adb34f24c8a10 (patch)
treeffe83542aa421b54b1675a9a6d6120de163174dd
parentd8e6ae21973271d2ccea937228ac55ec61c85bd2 (diff)
downloadurpmi-c835f00ab6b8041b1acc7292997adb34f24c8a10.tar
urpmi-c835f00ab6b8041b1acc7292997adb34f24c8a10.tar.gz
urpmi-c835f00ab6b8041b1acc7292997adb34f24c8a10.tar.bz2
urpmi-c835f00ab6b8041b1acc7292997adb34f24c8a10.tar.xz
urpmi-c835f00ab6b8041b1acc7292997adb34f24c8a10.zip
factorize parallel_install() which is now the same in each backend
-rw-r--r--urpm/parallel.pm32
-rw-r--r--urpm/parallel_ka_run.pm33
-rw-r--r--urpm/parallel_ssh.pm33
3 files changed, 32 insertions, 66 deletions
diff --git a/urpm/parallel.pm b/urpm/parallel.pm
index 912eec7b..d7f035eb 100644
--- a/urpm/parallel.pm
+++ b/urpm/parallel.pm
@@ -278,4 +278,36 @@ sub simple_resolve_dependencies {
join(' ', map { scalar $_->fullname } @pkgs);
}
+sub parallel_install {
+ my ($parallel, $urpm, undef, $install, $upgrade, %options) = @_;
+
+ copy_to_dir($parallel, $urpm, values %$install, values %$upgrade, "$urpm->{cachedir}/rpms");
+
+ my (%bad_nodes, @good_nodes);
+ $parallel->urpm_popen($urpm, 'urpmi', "--pre-clean --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}", sub {
+ my ($node, $s) = @_;
+ $s =~ /^\s*$/ and return;
+ $bad_nodes{$node} .= $s;
+ $s =~ /Installation failed/ and $bad_nodes{$node} = '';
+ $s =~ /Installation is possible/ and push @good_nodes, $node;
+ undef;
+ });
+ delete $bad_nodes{$_} foreach @good_nodes;
+
+ foreach (keys %{$parallel->{nodes}}) {
+ exists $bad_nodes{$_} or next;
+ $urpm->{error}(N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
+ }
+ %bad_nodes and return;
+
+ if ($options{test}) {
+ $urpm->{error}(N("Installation is possible"));
+ 1;
+ } else {
+ my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : "");
+ #- continue installation.
+ run_urpm_command($parallel, $urpm, 'urpmi', "--no-verify-rpm --auto --synthesis $parallel->{synthesis} $line");
+ }
+}
+
1;
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index 420921f2..9a2db2d6 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -75,39 +75,6 @@ sub _run_mput {
$? == 0 || $? == 256 or $urpm->{fatal}(1, N("mput failed, maybe a node is unreacheable"));
}
-#- parallel install.
-sub parallel_install {
- my ($parallel, $urpm, undef, $install, $upgrade, %options) = @_;
-
- copy_to_dir($parallel, $urpm, values %$install, values %$upgrade, "$urpm->{cachedir}/rpms");
-
- my (%bad_nodes, @good_nodes);
- $parallel->urpm_popen($urpm, 'urpmi', "--pre-clean --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}", sub {
- my ($node, $s) = @_;
- $s =~ /^\s*$/ and return;
- $bad_nodes{$node} .= $s;
- $s =~ /Installation failed/ and $bad_nodes{$node} = '';
- $s =~ /Installation is possible/ and push @good_nodes, $node;
- undef;
- });
- delete $bad_nodes{$_} foreach @good_nodes;
-
- foreach (keys %{$parallel->{nodes}}) {
- exists $bad_nodes{$_} or next;
- $urpm->{error}(N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
- }
- %bad_nodes and return;
-
- if ($options{test}) {
- $urpm->{error}(N("Installation is possible"));
- 1;
- } else {
- my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : "");
- #- continue installation.
- run_urpm_command($parallel, $urpm, 'urpmi', "--no-verify-rpm --auto --synthesis $parallel->{synthesis} $line");
- }
-}
-
sub _parse_rshp_output {
my ($s) = @_;
#- eg of output of rshp2: <tata2.mandriva.com> [rank:2]:@removing@mpich-1.2.5.2-10mlcs4.x86_64
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index ed49dc29..0fdb0dd7 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -89,39 +89,6 @@ sub run_urpm_command {
}
}
-#- parallel install.
-sub parallel_install {
- my ($parallel, $urpm, undef, $install, $upgrade, %options) = @_;
-
- copy_to_dir($parallel, $urpm, values %$install, values %$upgrade, "$urpm->{cachedir}/rpms");
-
- my (%bad_nodes, @good_nodes);
- $parallel->urpm_popen($urpm, 'urpmi', "--pre-clean --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}", sub {
- my ($node, $s) = @_;
- $s =~ /^\s*$/ and return;
- $bad_nodes{$node} .= $s;
- $s =~ /Installation failed/ and $bad_nodes{$node} = '';
- $s =~ /Installation is possible/ and push @good_nodes, $node;
- undef;
- });
- delete $bad_nodes{$_} foreach @good_nodes;
-
- foreach (keys %{$parallel->{nodes}}) {
- exists $bad_nodes{$_} or next;
- $urpm->{error}(N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
- }
- %bad_nodes and return;
-
- if ($options{test}) {
- $urpm->{error}(N("Installation is possible"));
- 1;
- } else {
- my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : "");
- #- continue installation.
- run_urpm_command($parallel, $urpm, 'urpmi', "--no-verify-rpm --auto --synthesis $parallel->{synthesis} $line");
- }
-}
-
#- allow to bootstrap from urpmi code directly (namespace is urpm).
package urpm;