From 83be6ef980f2667a7f72fbaf7c43ad47efdf524d Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 17 Apr 2009 14:50:03 +0000 Subject: (detect_hardware_packages,simple_read_rpmsrate) do not offer to install KDE packages on GNOME or LXDE (#49671) --- perl-install/NEWS | 1 + perl-install/pkgs.pm | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index ab34171a6..f0d1f43c2 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,6 +1,7 @@ - harddrake: o always detect PCI modems (even when (slow) detecting serial modems is disabled) + o do not offer to install KDE packages on GNOME or LXDE (#49671) Version 12.28.1 - 16 April 2009 diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index f89881145..19f98521b 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -149,14 +149,25 @@ sub read_rpmsrate { sub simple_read_rpmsrate { - my ($o_match_all_hardware) = @_; + my ($o_match_all_hardware, $o_ignore_flags) = @_; my ($rates, $flags) = read_rpmsrate({}, {}, $::prefix . '/usr/share/meta-task/rpmsrate-raw', $o_match_all_hardware); + + # FIXME: we do not handle !CAT_desktop but we do not care for now: + if (!$o_match_all_hardware && $o_ignore_flags) { + while (my ($pkg, $pkg_flags) = each %$flags) { + my $flags_str = "@$pkg_flags"; + if ($flags_str =~ /TRUE/ && any { $flags_str =~ /[^!]$_/ } @$o_ignore_flags) { + delete $flags->{$pkg}; + } + } + } + grep { member('TRUE', @{$flags->{$_}}) && $rates->{$_} >= 5 } keys %$flags; } sub detect_rpmsrate_hardware_packages { - my ($o_match_all_hardware) = @_; - grep { !/openoffice/ } simple_read_rpmsrate($o_match_all_hardware); + my ($o_match_all_hardware, $ignore_flags) = @_; + grep { !/openoffice/ } simple_read_rpmsrate($o_match_all_hardware, $ignore_flags); } sub detect_graphical_drivers { @@ -204,8 +215,12 @@ sub detect_network_drivers { sub detect_hardware_packages { my ($do_pkgs, $o_match_all_hardware) = @_; + my @ignore_flags = $::isInstall ? () : ( + if_(!$do_pkgs->are_installed('task-kde4-minimal', 'task-kde3-minimal'), "CAT_KDE"), + if_(!$do_pkgs->is_installed('task-gnome'), "CAT_GNOME"), + ); ( - ($::isInstall ? () : detect_rpmsrate_hardware_packages($o_match_all_hardware)), + ($::isInstall ? () : detect_rpmsrate_hardware_packages($o_match_all_hardware, \@ignore_flags)), detect_graphical_drivers($do_pkgs, $o_match_all_hardware), detect_network_drivers($do_pkgs, $o_match_all_hardware), ); -- cgit v1.2.1