diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-03-04 23:26:26 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-03-04 23:26:26 +0000 |
commit | 5d5bbe030dd56ef04900ef6ade7a63c6dbae1f39 (patch) | |
tree | 3646ccf273070069270216af8d7733e950ac19a6 | |
parent | ab33211db20a80f494950231098bba1ab5f8ba7d (diff) | |
download | rpmdrake-5d5bbe030dd56ef04900ef6ade7a63c6dbae1f39.tar rpmdrake-5d5bbe030dd56ef04900ef6ade7a63c6dbae1f39.tar.gz rpmdrake-5d5bbe030dd56ef04900ef6ade7a63c6dbae1f39.tar.bz2 rpmdrake-5d5bbe030dd56ef04900ef6ade7a63c6dbae1f39.tar.xz rpmdrake-5d5bbe030dd56ef04900ef6ade7a63c6dbae1f39.zip |
handle priority upgrade list
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | Rpmdrake/init.pm | 3 | ||||
-rw-r--r-- | Rpmdrake/open_db.pm | 2 | ||||
-rw-r--r-- | Rpmdrake/pkg.pm | 28 |
4 files changed, 31 insertions, 3 deletions
@@ -2,6 +2,7 @@ o don't want to force a device anymore o handle new "cdrom://" type - handle --test +- handle priority upgrade list - reuse more urpmi code Version 4.3.1 - Wed Feb 27 2008, Thierry Vignaud diff --git a/Rpmdrake/init.pm b/Rpmdrake/init.pm index eeb14f10..06415980 100644 --- a/Rpmdrake/init.pm +++ b/Rpmdrake/init.pm @@ -37,8 +37,11 @@ our @EXPORT = qw(init $changelog_first $default_list_mode %rpmdrake_options + @ARGV_copy ); +our @ARGV_copy = @ARGV; + BEGIN { #- we want to run this code before the Gtk->init of the use-my_gtk my $basename = sub { local $_ = shift; s|/*\s*$||; s|.*/||; $_ }; any { /^--?h/ } @ARGV and do { diff --git a/Rpmdrake/open_db.pm b/Rpmdrake/open_db.pm index 498e8520..5385d09f 100644 --- a/Rpmdrake/open_db.pm +++ b/Rpmdrake/open_db.pm @@ -97,6 +97,8 @@ sub open_urpmi_db { my $searchmedia = $urpmi_options{update} ? undef : join(',', get_inactive_backport_media($urpm)); $urpm->{lock} = urpm::lock::urpmi_db($urpm, undef, wait => $urpm->{options}{wait_lock}); + my $previous = $::rpmdrake_options{'previous-priority-upgrade'}; + urpm::select::set_priority_upgrade_option($urpm, (ref $previous ? join(',', @$previous) : ())); urpm::media::configure($urpm, media => $media, if_($searchmedia, searchmedia => $searchmedia), %urpmi_options); $urpm; } diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 43b4e032..1ab6fb18 100644 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -296,6 +296,11 @@ sub get_parallel_group() { $::rpmdrake_options{parallel} ? $::rpmdrake_options{parallel}[0] : undef; } + +urpm::select::add_packages_to_priority_upgrade_list('rpmdrake'); + +my ($restart_itself, $priority_state, $priority_requested); + our $probe_only_for_updates; sub get_pkgs { my ($opts) = @_; @@ -410,7 +415,9 @@ sub get_pkgs { # list of pure updates (w/o those matching /etc/urpmi/skip.list but with their deps): my @requested_strict; - urpm::select::resolve_dependencies( + #- return value is true if program should be restarted (in order to take care of important + #- packages being upgraded (urpmi, perl-URPM, rpm, glibc, ...). + $restart_itself = urpm::select::resolve_dependencies( $urpm, $state, $requested, callback_choices => \&Rpmdrake::gui::callback_choices, priority_upgrade => $urpm->{options}{'priority-upgrade'}, @@ -422,6 +429,8 @@ sub get_pkgs { resolve_req_callback => sub { @requested_strict = sort map { urpm_name($_) } @_ } ), ); + $priority_state = $restart_itself ? $state : undef; + $priority_requested = $restart_itself ? $requested : undef; if (!$probe_only_for_updates) { $urpm->compute_installed_flags($db); # TODO/FIXME: not for updates @@ -574,7 +583,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( my $lock = urpm::lock::urpmi_db($urpm, undef, wait => $urpm->{options}{wait_lock}); my $rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive'); - my $state = $probe_only_for_updates ? { } : $urpm->{rpmdrake_state}; + my $state = $priority_state || $probe_only_for_updates ? { } : $urpm->{rpmdrake_state}; my $bar_id = statusbar_msg(N("Checking validity of requested packages..."), 0); # select packages to install: @@ -582,6 +591,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( $restart_itself = urpm::select::resolve_dependencies( $urpm, $state, $requested, callback_choices => \&Rpmdrake::gui::callback_choices, + priority_upgrade => $urpm->{options}{'priority-upgrade'}, ); statusbar_msg_remove($bar_id); @@ -653,7 +663,8 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( } }; - urpm::main_loop::run($urpm, $state, undef, undef, $requested, + my $exit_code = + urpm::main_loop::run($urpm, $state, undef, undef, $requested, { completed => sub { # explicitly destroy the progress window when it's over; we may @@ -758,6 +769,17 @@ you may now inspect some in order to take actions:"), }, ); + #- restart rpmdrake if needed, keep command line for that. + if ($restart_itself && !$exit_code) { + log::explanations("restarting rpmdrake"); + #- added --previous-priority-upgrade to allow checking if yet if + #- priority-upgrade list has changed. and make sure we don't uselessly restart + my @argv = ('--previous-priority-upgrade=' . $urpm->{options}{'priority-upgrade'}, + grep { !/^--no-priority-upgrade$|--previous-priority-upgrade=/ } @Rpmdrake::init::ARGV_copy); + run_program::raw({ detach => 1 }, $0, @argv); + exit(0); + } + N("RPM transaction %d/%d"); N("Unselect all"); N("Details"); N("Filter"); |