diff options
Diffstat (limited to 'urpm/parallel.pm')
-rw-r--r-- | urpm/parallel.pm | 32 |
1 files changed, 32 insertions, 0 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; |