From ecaeffa8d14553aec3069c51e6b3c88b3a883511 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 13 Feb 2009 17:16:52 +0000 Subject: (remove_package_for_upgrade) split it out of setPackages() --- perl-install/install/any.pm | 59 +++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 26 deletions(-) (limited to 'perl-install/install/any.pm') diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm index 9b8d4121d..a3a59d265 100644 --- a/perl-install/install/any.pm +++ b/perl-install/install/any.pm @@ -329,22 +329,7 @@ sub setPackages { install::pkgs::selectPackagesAlreadyInstalled($o->{packages}); } - if (my $extension = $o->{upgrade_by_removing_pkgs_matching}) { - my $time = time(); - my ($_w, $wait_message) = $o->wait_message_with_progress_bar; - $wait_message->(N("Removing packages prior to upgrade...")); - my ($current, $total); - my $callback = sub { - my (undef, $type, $_id, $subtype, $amount) = @_; - if ($type eq 'user') { - ($current, $total) = (0, $amount); - } elsif ($type eq 'uninst' && $subtype eq 'stop') { - $wait_message->('', $current++, $total); - } - }; - push @{$o->{default_packages}}, install::pkgs::upgrade_by_removing_pkgs($o->{packages}, $callback, $extension, $o->{isUpgrade}); - log::l("Removing packages took: ", formatTimeRaw(time() - $time)); - } + remove_package_for_upgrade($o); mark_skipped_packages($o); @@ -385,23 +370,45 @@ sub setPackages { } } +sub remove_package_for_upgrade { + my ($o) = @_; + my $extension; + + return if !$extension = $o->{upgrade_by_removing_pkgs_matching}; + + my $time = time(); + my ($_w, $wait_message) = $o->wait_message_with_progress_bar; + $wait_message->(N("Removing packages prior to upgrade...")); + my ($current, $total); + my $callback = sub { + my (undef, $type, $_id, $subtype, $amount) = @_; + if ($type eq 'user') { + ($current, $total) = (0, $amount); + } elsif ($type eq 'uninst' && $subtype eq 'stop') { + $wait_message->('', $current++, $total); + } + }; + push @{$o->{default_packages}}, install::pkgs::upgrade_by_removing_pkgs($o->{packages}, $callback, $extension, $o->{isUpgrade}); + log::l("Removing packages took: ", formatTimeRaw(time() - $time)); +} + sub upgrade_kde3_to_kde4 { my ($o) = @_; - if (-e "$::prefix/usr/bin/kicker" - && !install::pkgs::packageByName($o->{packages}, 'task-kde3')) { - log::l("kde3 installed, but task-kde3 not available so can't upgrade correctly"); + if (-e "$::prefix/usr/bin/kicker" + && !install::pkgs::packageByName($o->{packages}, 'task-kde3')) { + log::l("kde3 installed, but task-kde3 not available so can't upgrade correctly"); - my $choice; - $o->ask_from_({ messages => formatAlaTeX(N("You have decided to upgrade your system to %s. KDE 3.5 has been detected + my $choice; + $o->ask_from_({ messages => formatAlaTeX(N("You have decided to upgrade your system to %s. KDE 3.5 has been detected on your system. This installer cannot preserve KDE 3.5 in an upgrade. If you choose to proceed, KDE 4 will replace KDE 3, and you will lose your personal KDE configuration settings. To upgrade with KDE 3.5 and your personal settings preserved, please reboot your system and upgrade using the Mandriva update applet.", 'Mandriva Linux 2009')) }, - [ { val => \$choice, type => 'list', list => [ N_("Reboot"), N_("Proceed") ], format => \&translate } ]); - $choice eq 'Reboot' and install::steps::rebootNeeded($o); - log::l("ok, continuing anyway, but forcing install of task-kde4"); - install::pkgs::select_by_package_names($o->{packages}, ['task-kde4']); - } + [ { val => \$choice, type => 'list', list => [ N_("Reboot"), N_("Proceed") ], format => \&translate } ]); + $choice eq 'Reboot' and install::steps::rebootNeeded($o); + log::l("ok, continuing anyway, but forcing install of task-kde4"); + install::pkgs::select_by_package_names($o->{packages}, ['task-kde4']); + } } sub count_files { -- cgit v1.2.1