summaryrefslogtreecommitdiffstats
path: root/gurpmi2
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-04 13:44:42 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-04 13:44:42 +0000
commitdd207efc048dbd9e7faa7ed106f564232c31a7c7 (patch)
tree2a1121fc3f85a6a0fa1a6782814a53d537ac6be9 /gurpmi2
parent39ea4236f990210b8a15dd65e59841900561cfb9 (diff)
downloadurpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar.gz
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar.bz2
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar.xz
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.zip
handle priority upgrade list
Diffstat (limited to 'gurpmi2')
-rwxr-xr-xgurpmi221
1 files changed, 19 insertions, 2 deletions
diff --git a/gurpmi2 b/gurpmi2
index 2b6bed4b..64723936 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -77,11 +77,15 @@ my %requested = $urpm->register_rpms(@all_rpms);
if (@gurpmi::names) {
urpm::select::search_packages($urpm, \%requested, [ @gurpmi::names ]);
}
-urpm::select::resolve_dependencies($urpm,
+
+#- return value is true if program should be restarted (in order to take care of important
+#- packages being upgraded (problably urpmi and perl-URPM, but maybe rpm too, and glibc also ?).
+my $restart_itself = urpm::select::resolve_dependencies($urpm,
$state,
\%requested,
callback_choices => \&ask_choice,
auto_select => $::auto_select,
+ priority_upgrade => $urpm->{options}{'priority-upgrade'},
);
my @ask_unselect = urpm::select::unselected_packages($urpm, $state);
@ask_unselect
@@ -126,6 +130,7 @@ sub configure_urpm() {
$w->run;
$w->destroy;
};
+ urpm::select::set_priority_upgrade_option($urpm, $gurpmi::options{previous_priority_upgrade})
$rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive');
$urpmi_lock = urpm::lock::urpmi_db($urpm);
urpm::media::configure($urpm,
@@ -254,7 +259,7 @@ sub do_install_3 () {
sync();
};
- urpm::main_loop::run($urpm, $state, scalar(@gurpmi::names), \@ask_unselect, \%requested, {
+ my $exit_code = urpm::main_loop::run($urpm, $state, scalar(@gurpmi::names), \@ask_unselect, \%requested, {
bad_signature => sub {
my ($msg, $msg2) = @_;
ask_continue_blocking("$msg\n$msg2");
@@ -318,4 +323,16 @@ sub do_install_3 () {
trans => $callback_inst,
}
);
+
+ #- restart gurpmi if needed, keep command line for that.
+ if ($restart_itself && !$exit_code) {
+ print N("restarting urpmi"), "\n";
+ #- it seems to work correctly with exec instead of system, provided
+ #- added --previous-priority-upgrade to allow checking if yet if
+ #- priority-upgrade list has changed. and make sure we don't uselessly restart
+ @ARGV = ('--previous-priority-upgrade=' . $urpm->{options}{'priority-upgrade'},
+ grep { !/^--no-priority-upgrade$|--previous-priority-upgrade=/ } @ARGV);
+ exec $0, @ARGV;
+ }
+
}