diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-06-08 18:51:20 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-06-08 18:51:20 +0000 |
commit | 8139d7672c2c2f04eed6562f32ce4a4796e506ba (patch) | |
tree | f9a55fae02e1f41fa0346b4afbbb1f9a30f7d71f /urpm | |
parent | 036cd696331f2353eb569935de67b700561ca5a5 (diff) | |
download | urpmi-8139d7672c2c2f04eed6562f32ce4a4796e506ba.tar urpmi-8139d7672c2c2f04eed6562f32ce4a4796e506ba.tar.gz urpmi-8139d7672c2c2f04eed6562f32ce4a4796e506ba.tar.bz2 urpmi-8139d7672c2c2f04eed6562f32ce4a4796e506ba.tar.xz urpmi-8139d7672c2c2f04eed6562f32ce4a4796e506ba.zip |
(_continue_on_error) split it out of run()
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/main_loop.pm | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm index 6e66571b..6e3c82ab 100644 --- a/urpm/main_loop.pm +++ b/urpm/main_loop.pm @@ -142,6 +142,27 @@ sub _install_src { } } +sub _continue_on_error { + my ($urpm, $callbacks, $msgs, $error_sources, $formatted_errors, $ok, $exit_code) = @_; + my $go_on; + if ($urpm->{options}{auto}) { + push @$formatted_errors, @$msgs; + } else { + my $sub = $callbacks->{ask_for_bad_or_missing} || $callbacks->{ask_yes_or_no}; + $go_on = $sub->( + N("Installation failed"), + join("\n\n", @$msgs, N("Try to continue anyway?"))); + } + if (!$go_on) { + my @missing = grep { $_->[1] eq 'missing' } @$error_sources; + if (@missing) { + $$exit_code = $ok ? 13 : 14; + } + return 0; + } + return 1; +} + # locking is left to callers sub run { my ($urpm, $state, $something_was_to_be_done, $ask_unselect, $_requested, $callbacks) = @_; @@ -211,22 +232,7 @@ sub run { my ($error_sources, $msgs) = _download_packages($urpm, $callbacks, $transaction_blists, $transaction_sources); if (@$error_sources) { $nok++; - my $go_on; - if ($urpm->{options}{auto}) { - push @formatted_errors, @$msgs; - } else { - my $sub = $callbacks->{ask_for_bad_or_missing} || $callbacks->{ask_yes_or_no}; - $go_on = $sub->( - N("Installation failed"), - join("\n\n", @$msgs, N("Try to continue anyway?"))); - } - if (!$go_on) { - my @missing = grep { $_->[1] eq 'missing' } @$error_sources; - if (@missing) { - $exit_code = $ok ? 13 : 14; - } - last; - } + last if !_continue_on_error($urpm, $callbacks, $msgs, $error_sources, \@formatted_errors, $ok, \$exit_code); } $callbacks->{post_download} and $callbacks->{post_download}->(); |