summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-09-05 14:35:49 +0000
committerOlivier Blin <oblin@mandriva.com>2008-09-05 14:35:49 +0000
commit44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd (patch)
treee989382f139313ad36cd4fef0cad2bcc80de269c /perl-install
parentb998ce73afeffd221b2eb42955187006dc5f22e0 (diff)
downloaddrakx-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar
drakx-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar.gz
drakx-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar.bz2
drakx-44e35ec2d2ad1a8c8808852b4cb52dcac932e4fd.tar.xz
drakx-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')
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/pkgs.pm41
-rw-r--r--perl-install/standalone/remove-unselected-locales29
-rw-r--r--perl-install/standalone/remove-unused-hardware-packages27
-rwxr-xr-xperl-install/standalone/remove-unused-packages11
5 files changed, 54 insertions, 56 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index c656af1b3..d8725c93d 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -3,6 +3,8 @@
.before-migrate-to-uuids
- libDrakX:
o fix handling KDE4 in running_window_manager() and ask_window_manager_to_logout()
+- merge remove-unused-hardware-packages and remove-unselected-locales
+ helpers into a new remove-unused-packages tool (and make it reusable)
Version 11.35 - 4 September 2008
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;
diff --git a/perl-install/standalone/remove-unselected-locales b/perl-install/standalone/remove-unselected-locales
deleted file mode 100644
index 8e4eabccc..000000000
--- a/perl-install/standalone/remove-unselected-locales
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-use common;
-use lang;
-use interactive;
-use do_pkgs;
-use run_program;
-use standalone;
-
-my $in = interactive->vnew;
-my $wait = $in->wait_message(N("Localization packages removal"),
- N("Finding unused localization packages..."));
-my $do_pkgs = do_pkgs->do_pkgs($in);
-my @unselected_locales = pkgs::detect_unselected_locale_packages($do_pkgs);
-undef $wait;
-
-#- we should have some gurpme
-if (@unselected_locales &&
- $in->ask_yesorno(
- N("Localization packages removal"),
- N("The following localization packages do not seem to be useful for your system:") . "\n" .
- join("\n", map { " " . $_ } sort(@unselected_locales)) . "\n" .
- N("Do you want to remove these packages?"))) {
- my $_wait = $in->wait_message(N("Please wait"), N("Removing packages..."));
- run_program::run('urpme', '--auto', @unselected_locales);
-}
-
-# use script from One to list language files (/usr/share/locale mainly) and remove them?
diff --git a/perl-install/standalone/remove-unused-hardware-packages b/perl-install/standalone/remove-unused-hardware-packages
deleted file mode 100644
index eb7a126dc..000000000
--- a/perl-install/standalone/remove-unused-hardware-packages
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-use common;
-use pkgs;
-use interactive;
-use do_pkgs;
-use run_program;
-use standalone;
-
-my $in = interactive->vnew;
-my $wait = $in->wait_message(N("Hardware packages removal"),
- N("Finding unused hardware packages..."));
-my $do_pkgs = do_pkgs->do_pkgs($in);
-my @unused_hardware_packages = pkgs::detect_unused_hardware_packages($do_pkgs);
-undef $wait;
-
-#- we should have some gurpme
-if (@unused_hardware_packages &&
- $in->ask_yesorno(
- N("Hardware packages removal"),
- N("The following hardware packages do not seem to be useful for your system:") . "\n" .
- join("\n", map { " " . $_ } sort(@unused_hardware_packages)) . "\n" .
- N("Do you want to remove these packages?"))) {
- my $_wait = $in->wait_message(N("Please wait"), N("Removing packages..."));
- run_program::run('urpme', '--auto', @unused_hardware_packages);
-}
diff --git a/perl-install/standalone/remove-unused-packages b/perl-install/standalone/remove-unused-packages
new file mode 100755
index 000000000..5d3989414
--- /dev/null
+++ b/perl-install/standalone/remove-unused-packages
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+use pkgs;
+use interactive;
+use do_pkgs;
+use standalone;
+
+my $in = interactive->vnew('su');
+my $do_pkgs = do_pkgs->do_pkgs($in);
+pkgs::remove_unused_packages($in, $do_pkgs);