diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-09-05 14:35:49 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-09-05 14:35:49 +0000 |
commit | 44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd (patch) | |
tree | e989382f139313ad36cd4fef0cad2bcc80de269c /perl-install/pkgs.pm | |
parent | b998ce73afeffd221b2eb42955187006dc5f22e0 (diff) | |
download | drakx-backup-do-not-use-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar drakx-backup-do-not-use-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar.gz drakx-backup-do-not-use-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar.bz2 drakx-backup-do-not-use-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar.xz drakx-backup-do-not-use-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.zip |
merge remove-unused-hardware-packages and remove-unselected-locales
helpers into a new remove-unused-packages tool (and make it reusable)
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r-- | perl-install/pkgs.pm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index dea3f3273..8a37da2ed 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -221,4 +221,45 @@ sub detect_unselected_locale_packages { member($selected_locale, @available_locales) ? difference2(\@available_locales, [ $selected_locale ]) : (); } +sub remove_unused_packages { + my ($in, $do_pkgs) = @_; + + my $wait; + $wait = $in->wait_message(N("Unused packages removal"), N("Finding unused hardware packages...")); + my @unused_hardware_packages = detect_unused_hardware_packages($do_pkgs); + undef $wait; + $wait = $in->wait_message(N("Unused packages removal"), N("Finding unused localization packages...")); + my @unselected_locales = detect_unselected_locale_packages($do_pkgs); + undef $wait; + + @unused_hardware_packages || @unselected_locales or return; + + my $hardware = @unused_hardware_packages; + my $locales = @unselected_locales; + $in->ask_from( + N("Unused packages removal"), + N("The following packages do not seem to be useful for your system.") . "\n" . + N("Please select the packages group that should be removed:"), + [ + if_(@unused_hardware_packages, + { text => N("Unused hardware support"), val => \$hardware, type => "bool" }, + { label => N("Unused hardware support") . "\n" . join("\n", map { " " . $_ } sort(@unused_hardware_packages)), advanced => 1 }, + ), + if_(@unselected_locales, + { text => N("Unused localization"), val => \$locales, type => "bool" }, + { label => N("Unused localization") . "\n" . join("\n", map { " " . $_ } sort(@unselected_locales)), advanced => 1 }, + ), + ], + if_($::isWizard, cancel => N("Skip")), + ) && ($hardware || $locales) or return; + + #- we should have some gurpme + $wait = $in->wait_message(N("Please wait"), N("Removing packages...")); + run_program::run('urpme', '--auto', + if_($hardware, @unused_hardware_packages), + if_($locales, @unselected_locales), + ); + #- use script from One to list language files (/usr/share/locale mainly) and remove them? +} + 1; |