summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/install_any.pm133
-rw-r--r--perl-install/install_steps_interactive.pm5
-rw-r--r--perl-install/pkgs.pm49
3 files changed, 105 insertions, 82 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index dd1ddb0dc..f01f69b6b 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -595,6 +595,7 @@ sub load_rate_files {
#- if there is a supplementary media, the rpmsrate/compssUsers are overridable
pkgs::read_rpmsrate(
$o->{packages},
+ $o->{rpmsrate_flags_chosen},
getFile(-e "/tmp/rpmsrate" ? "/tmp/rpmsrate" : "media/media_info/rpmsrate")
);
($o->{compssUsers}, $o->{gtk_display_compssUsers}) = pkgs::readCompssUsers(
@@ -622,12 +623,15 @@ sub setPackages {
pkgs::selectPackage($o->{packages},
pkgs::packageByName($o->{packages}, 'basesystem') || die("missing basesystem package"), 1);
+ my $rpmsrate_flags_was_chosen = $o->{rpmsrate_flags_chosen};
+
+ put_in_hash($o->{rpmsrate_flags_chosen}, rpmsrate_always_flags($o)); #- must be done before pkgs::read_rpmsrate()
load_rate_files($o);
- #- preselect default_packages and compssUsers selected.
- setDefaultPackages($o);
- pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}};
+ set_rpmsrate_default_category_flags($o, $rpmsrate_flags_was_chosen);
+ push @{$o->{default_packages}}, default_packages($o);
+ select_default_packages($o);
} else {
#- this has to be done to make sure necessary files for urpmi are
#- present.
@@ -638,55 +642,47 @@ sub setPackages {
}
}
-sub setDefaultPackages {
- my ($o) = @_;
+sub set_rpmsrate_default_category_flags {
+ my ($o, $rpmsrate_flags_was_chosen) = @_;
- push @{$o->{default_packages}}, "brltty" if cat_("/proc/cmdline") =~ /brltty=/;
- push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs";
- push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock};
- push @{$o->{default_packages}}, "mdadm" if !is_empty_array_ref($o->{all_hds}{raids});
- push @{$o->{default_packages}}, "lvm2" if !is_empty_array_ref($o->{all_hds}{lvms});
- push @{$o->{default_packages}}, "alsa", "alsa-utils" if any { $o->{modules_conf}->get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4;
- my %dmi = map { $_->{name} => $_ } detect_devices::dmidecode();
- if ($dmi{System}{Manufacturer} eq "Dell Computer" && member($dmi{System}{'Product Name'}, qw(Inspiron Latitude))) {
- modules::append_to_modules_loaded_at_startup($_, 'i8k') foreach "$::prefix/etc/modules", "$::prefix/etc/modprobe.preload";
- push @{$o->{default_packages}}, "i8kutils";
+ #- if no cleaning needed, populate by default, clean is used for second or more call to this function.
+ if ($::auto_install && ($o->{rpmsrate_flags_chosen} || {})->{CAT_ALL}) {
+ $o->{rpmsrate_flags_chosen}{"CAT_$_"} = 1 foreach map { @{$_->{flags}} } @{$o->{compssUsers}};
}
- if ($dmi{System}{Manufacturer} eq 'TOSHIBA' && $dmi{BIOS}{Vendor} eq 'TOSHIBA') {
- modules::append_to_modules_loaded_at_startup($_, 'toshiba') foreach "$::prefix/etc/modules", "$::prefix/etc/modprobe.preload";
- push @{$o->{default_packages}}, "toshutils";
+ if (!$rpmsrate_flags_was_chosen && !$o->{isUpgrade}) {
+ #- use default selection seen in compssUsers directly.
+ $_->{selected} = $_->{default_selected} foreach @{$o->{compssUsers}};
+ set_rpmsrate_category_flags($o, $o->{compssUsers});
}
- push @{$o->{default_packages}}, "grub" if isLoopback(fs::get::root($o->{fstab}));
- push @{$o->{default_packages}}, uniq(grep { $_ } map { fs::format::package_needed_for_partition_type($_) } @{$o->{fstab}});
+}
- #- if no cleaning needed, populate by default, clean is used for second or more call to this function.
- {
- if ($::auto_install && ($o->{rpmsrate_flags_chosen} || {})->{CAT_ALL}) {
- $o->{rpmsrate_flags_chosen}{"CAT_$_"} = 1 foreach map { @{$_->{flags}} } @{$o->{compssUsers}};
- }
- if (!$o->{rpmsrate_flags_chosen} && !$o->{isUpgrade}) {
- #- use default selection seen in compssUsers directly.
- foreach (@{$o->{compssUsers}}) {
- $_->{selected} = $_->{default_selected} or next;
- $o->{rpmsrate_flags_chosen}{"CAT_$_"} = 1 foreach @{$_->{flags}};
- }
- }
- }
- $o->{rpmsrate_flags_chosen}{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia');
- $o->{rpmsrate_flags_chosen}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall();
+sub set_rpmsrate_category_flags {
+ my ($o, $compssUsers) = @_;
+
+ $o->{rpmsrate_flags_chosen}{$_} = 0 foreach grep { /^CAT_/ } keys %{$o->{rpmsrate_flags_chosen}};
+ $o->{rpmsrate_flags_chosen}{"CAT_$_"} = 1 foreach map { @{$_->{flags}} } grep { $_->{selected} } @$compssUsers;
$o->{rpmsrate_flags_chosen}{CAT_SYSTEM} = 1;
- $o->{rpmsrate_flags_chosen}{DOCS} = !$o->{excludedocs};
- $o->{rpmsrate_flags_chosen}{UTF8} = $o->{locale}{utf8};
- $o->{rpmsrate_flags_chosen}{BURNER} = 1 if detect_devices::burners();
- $o->{rpmsrate_flags_chosen}{DVD} = 1 if detect_devices::dvdroms();
- $o->{rpmsrate_flags_chosen}{USB} = 1 if $o->{modules_conf}->get_probeall("usb-interface");
- $o->{rpmsrate_flags_chosen}{PCMCIA} = 1 if detect_devices::hasPCMCIA();
- $o->{rpmsrate_flags_chosen}{HIGH_SECURITY} = 1 if $o->{security} > 3;
- $o->{rpmsrate_flags_chosen}{BIGMEM} = 1 if detect_devices::BIGMEM();
- $o->{rpmsrate_flags_chosen}{SMP} = 1 if detect_devices::hasSMP();
- $o->{rpmsrate_flags_chosen}{CDCOM} = 1 if any { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}};
- $o->{rpmsrate_flags_chosen}{TV} = 1 if detect_devices::getTVcards();
- $o->{rpmsrate_flags_chosen}{'3D'} = 1 if
+}
+
+
+sub rpmsrate_always_flags {
+ my ($o) = @_;
+
+ my $rpmsrate_flags_chosen = {};
+ $rpmsrate_flags_chosen->{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia');
+ $rpmsrate_flags_chosen->{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall();
+ $rpmsrate_flags_chosen->{DOCS} = !$o->{excludedocs};
+ $rpmsrate_flags_chosen->{UTF8} = $o->{locale}{utf8};
+ $rpmsrate_flags_chosen->{BURNER} = 1 if detect_devices::burners();
+ $rpmsrate_flags_chosen->{DVD} = 1 if detect_devices::dvdroms();
+ $rpmsrate_flags_chosen->{USB} = 1 if $o->{modules_conf}->get_probeall("usb-interface");
+ $rpmsrate_flags_chosen->{PCMCIA} = 1 if detect_devices::hasPCMCIA();
+ $rpmsrate_flags_chosen->{HIGH_SECURITY} = 1 if $o->{security} > 3;
+ $rpmsrate_flags_chosen->{BIGMEM} = 1 if detect_devices::BIGMEM();
+ $rpmsrate_flags_chosen->{SMP} = 1 if detect_devices::hasSMP();
+ $rpmsrate_flags_chosen->{CDCOM} = 1 if any { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}};
+ $rpmsrate_flags_chosen->{TV} = 1 if detect_devices::getTVcards();
+ $rpmsrate_flags_chosen->{'3D'} = 1 if
detect_devices::matching_desc__regexp('Matrox.* G[245][05]0') ||
detect_devices::matching_desc__regexp('Rage X[CL]') ||
detect_devices::matching_desc__regexp('3D Rage (?:LT|Pro)') ||
@@ -702,20 +698,51 @@ sub setDefaultPackages {
detect_devices::matching_desc__regexp('[nN][vV]idia.*NV1[15]') ||
detect_devices::matching_desc__regexp('[nN][vV]idia.*Quadro');
+ foreach (lang::langsLANGUAGE($o->{locale}{langs})) {
+ $rpmsrate_flags_chosen->{qq(LOCALES"$_")} = 1;
+ }
+ $rpmsrate_flags_chosen->{'CHARSET"' . lang::l2charset($o->{locale}{lang}) . '"'} = 1;
- my @locale_pkgs = map { pkgs::packagesProviding($o->{packages}, 'locales-' . $_) } lang::langsLANGUAGE($o->{locale}{langs});
- unshift @{$o->{default_packages}}, uniq(map { $_->name } @locale_pkgs);
+ $rpmsrate_flags_chosen;
+}
- foreach (lang::langsLANGUAGE($o->{locale}{langs})) {
- $o->{rpmsrate_flags_chosen}{qq(LOCALES"$_")} = 1;
+sub default_packages {
+ my ($o) = @_;
+ my @l;
+
+ push @l, "brltty" if cat_("/proc/cmdline") =~ /brltty=/;
+ push @l, "nfs-utils-clients" if $o->{method} eq "nfs";
+ push @l, "numlock" if $o->{miscellaneous}{numlock};
+ push @l, "mdadm" if !is_empty_array_ref($o->{all_hds}{raids});
+ push @l, "lvm2" if !is_empty_array_ref($o->{all_hds}{lvms});
+ push @l, "alsa", "alsa-utils" if any { $o->{modules_conf}->get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4;
+ my %dmi = map { $_->{name} => $_ } detect_devices::dmidecode();
+ if ($dmi{System}{Manufacturer} eq "Dell Computer" && member($dmi{System}{'Product Name'}, qw(Inspiron Latitude))) {
+ modules::append_to_modules_loaded_at_startup($_, 'i8k') foreach "$::prefix/etc/modules", "$::prefix/etc/modprobe.preload";
+ push @l, "i8kutils";
+ }
+ if ($dmi{System}{Manufacturer} eq 'TOSHIBA' && $dmi{BIOS}{Vendor} eq 'TOSHIBA') {
+ modules::append_to_modules_loaded_at_startup($_, 'toshiba') foreach "$::prefix/etc/modules", "$::prefix/etc/modprobe.preload";
+ push @l, "toshutils";
}
- $o->{rpmsrate_flags_chosen}{'CHARSET"' . lang::l2charset($o->{locale}{lang}) . '"'} = 1;
+ push @l, "grub" if isLoopback(fs::get::root($o->{fstab}));
+ push @l, uniq(grep { $_ } map { fs::format::package_needed_for_partition_type($_) } @{$o->{fstab}});
+
+ my @locale_pkgs = map { pkgs::packagesProviding($o->{packages}, 'locales-' . $_) } lang::langsLANGUAGE($o->{locale}{langs});
+ unshift @l, uniq(map { $_->name } @locale_pkgs);
+
+ @l;
+}
+
+sub select_default_packages {
+ my ($o) = @_;
+ pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}};
}
sub unselectMostPackages {
my ($o) = @_;
pkgs::unselectAllPackages($o->{packages});
- pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}};
+ select_default_packages($o);
}
sub warnAboutNaughtyServers {
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index a7f7a5af9..f6cb196cd 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -583,10 +583,7 @@ sub chooseGroups {
$o->ask_warn('', N("Selected size is larger than available space"));
}
-
- $o->{rpmsrate_flags_chosen}{$_} = 0 foreach grep { /^CAT_/ } keys %{$o->{rpmsrate_flags_chosen}};
- $o->{rpmsrate_flags_chosen}{"CAT_$_"} = 1 foreach map { @{$_->{flags}} } grep { $_->{selected} } @$compssUsers;
- $o->{rpmsrate_flags_chosen}{CAT_SYSTEM} = 1;
+ install_any::set_rpmsrate_category_flags($o, $compssUsers);
log::l("compssUsersChoice selected: ", join(', ', map { qq("$_->{path}|$_->{label}") } grep { $_->{selected} } @$compssUsers));
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 010ba9568..71f7832fc 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -604,35 +604,35 @@ sub read_rpmsrate_raw {
}
sub read_rpmsrate {
- my ($packages, $f) = @_;
+ my ($packages, $rpmsrate_flags_chosen, $f) = @_;
my ($rates, $flags, $need_to_copy) = read_rpmsrate_raw($f);
foreach (keys %$flags) {
my $p = packageByName($packages, $_) or next;
- my @more_flags = map { if_(/locales-(.*)/, qq(LOCALES"$1")) } $p->requires_nosense;
-
- my @flags = map {
- my $ok = 0;
- my $flag = join('||', grep {
- if (my ($inv, $p) = /^(!)?HW"(.*)"/) {
- ($inv xor detect_devices::matching_desc__regexp($p)) and $ok = 1;
- 0;
- } elsif (($inv, $p) = /^(!)?DRIVER"(.*)"/) {
- ($inv xor detect_devices::matching_driver__regexp($p)) and $ok = 1;
- 0;
- } elsif (($inv, $p) = /^(!)?TYPE"(.*)"/) {
- ($inv xor detect_devices::matching_type($p)) and $ok = 1;
- 0;
- } else {
- 1;
- }
- } split '\|\|', $_);
- $ok ? 'TRUE' : $flag || 'FALSE';
- } @{$flags->{$_}};
+ my @flags = (@{$flags->{$_}}, map { if_(/locales-(.*)/, qq(LOCALES"$1")) } $p->requires_nosense);
+
+ @flags = map {
+ my ($user_flags, $known_flags) = partition { /^!?CAT_/ } split('\|\|', $_);
+ my $ok = find {
+ my $inv = s/^!//;
+ $inv xor do {
+ if (my ($p) = /^HW"(.*)"/) {
+ detect_devices::matching_desc__regexp($p);
+ } elsif (($p) = /^DRIVER"(.*)"/) {
+ detect_devices::matching_driver__regexp($p);
+ } elsif (($p) = /^TYPE"(.*)"/) {
+ detect_devices::matching_type($p);
+ } else {
+ $rpmsrate_flags_chosen->{$_};
+ }
+ };
+ } @$known_flags;
+ $ok ? 'TRUE' : @$user_flags ? join('||', @$user_flags) : 'FALSE';
+ } @flags;
$p->set_rate($rates->{$_});
- $p->set_rflags(@flags, @more_flags);
+ $p->set_rflags(member('FALSE', @flags) ? 'FALSE' : @flags);
}
$packages->{needToCopy} = $need_to_copy;
}
@@ -747,8 +747,7 @@ sub computeGroupSize {
map { "$_&&$n" } @l;
} split('\|\|');
}
- #- HACK, remove LOCALES & CHARSET, too costly
- grep { !/LOCALES|CHARSET/ } @l;
+ @l;
}
sub or_clean {
my (@l) = map { [ sort split('&&') ] } @_ or return '';
@@ -768,7 +767,7 @@ sub computeGroupSize {
foreach my $p (@{$packages->{depslist}}) {
my @flags = $p->rflags;
- next if !$p->rate || $p->rate < $min_level;
+ next if !$p->rate || $p->rate < $min_level || @flags == 1 && $flags[0] eq 'FALSE';
my $flags = join("\t", @flags = or_ify(@flags));
$group{$p->name} = ($memo{$flags} ||= or_clean(@flags));