summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2009-11-24 13:28:24 +0000
committerThierry Vignaud <tv@mandriva.org>2009-11-24 13:28:24 +0000
commit879e74c563c6f683087ed4ca0fab72d0fe380557 (patch)
tree35730976ce87a4f93e49b4225334741215dfa226
parent8c94e4aac664a6e65cdbe7c98fa49314ef18d278 (diff)
downloadurpmi-879e74c563c6f683087ed4ca0fab72d0fe380557.tar
urpmi-879e74c563c6f683087ed4ca0fab72d0fe380557.tar.gz
urpmi-879e74c563c6f683087ed4ca0fab72d0fe380557.tar.bz2
urpmi-879e74c563c6f683087ed4ca0fab72d0fe380557.tar.xz
urpmi-879e74c563c6f683087ed4ca0fab72d0fe380557.zip
(handle_need_restart) split it out of run() for readability
(it has kept growing and it's needed for next commit anyway)
-rw-r--r--urpm/main_loop.pm26
1 files changed, 18 insertions, 8 deletions
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;