From 879e74c563c6f683087ed4ca0fab72d0fe380557 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 24 Nov 2009 13:28:24 +0000 Subject: (handle_need_restart) split it out of run() for readability (it has kept growing and it's needed for next commit anyway) --- urpm/main_loop.pm | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'urpm/main_loop.pm') diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm index cf739af8..31d09dea 100644 --- a/urpm/main_loop.pm +++ b/urpm/main_loop.pm @@ -351,18 +351,28 @@ if ($nok) { } elsif ($test && $exit_code == 0) { #- Warning : the following message is parsed in urpm::parallel_* print N("Installation is possible"), "\n"; - } elsif ($callbacks->{need_restart} && intersection([ keys %{$state->{selected}} ], - [ keys %{$urpm->{provides}{'should-restart'}} ])) { - if (my $need_restart_formatted = urpm::sys::need_restart_formatted($urpm->{root})) { - $callbacks->{need_restart}($need_restart_formatted); - - # need_restart() accesses rpm db, so we need to ensure things are clean: - urpm::sys::may_clean_rpmdb_shared_regions($urpm, $options{test}); - } + } else { + handle_need_restart($urpm, $state, $callbacks); } } } $exit_code; } +sub handle_need_restart { + my ($urpm, $state, $callbacks) = @_; + + return if !$callbacks->{need_restart}; + + if (intersection([ keys %{$state->{selected}} ], + [ keys %{$urpm->{provides}{'should-restart'}} ])) { + if (my $need_restart_formatted = urpm::sys::need_restart_formatted($urpm->{root})) { + $callbacks->{need_restart}($need_restart_formatted); + + # need_restart() accesses rpm db, so we need to ensure things are clean: + urpm::sys::may_clean_rpmdb_shared_regions($urpm, $options{test}); + } + } +} + 1; -- cgit v1.2.1