From 8da35bee0da6d6b5074941f598a15ab1031d4250 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 11 Jan 2021 11:38:39 +0000 Subject: Fix handling of TYPE"64bit" flags when reading rpmsrate. The previous fix that prevented false detection of hardware support packages allowed the installer to pre-select the wrong architecture package when both 32-bit and 64bit media were enabled. --- perl-install/NEWS | 1 + perl-install/install/NEWS | 3 +++ perl-install/pkgs.pm | 19 +++++++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index dbab0e6af..e9cdf5ff2 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,4 @@ +- fix handling of TYPE"64bit" flags when reading rpmsrate - Fix syntax of 51-mageia-resume.conf (mga#28055) Version 18.39 - 04 January 2021 diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index fb39f15ce..44055eb74 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,6 @@ +- fix handling of TYPE"64bit" flags when reading rpmsrate + o ensure 32-bit packages are not pre-selected on 64-bit systems + Version 18.39 - 04 January 2021 - Update translations diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 5e079f544..66dbead65 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -92,7 +92,7 @@ sub read_rpmsrate_raw { } sub read_rpmsrate { - my ($packages, $rpmsrate_flags_chosen, $file, $match_all_hardware) = @_; + my ($packages, $rpmsrate_flags_chosen, $file, $match_all_hardware, $o_match_only_hardware) = @_; my ($rates, $flags, $need_to_copy) = read_rpmsrate_raw($file); @@ -118,6 +118,7 @@ sub read_rpmsrate { @flags = map { my ($user_flags, $known_flags) = partition { /^!?CAT_/ } split('\|\|', $_); + my $bits_ok; my $ok = find { my $inv = s/^!//; return 0 if $::isStandalone && $inv; @@ -125,7 +126,13 @@ sub read_rpmsrate { $match_all_hardware ? 1 : ($inv xor find { $_->{description} =~ /$p/i } @probeall); } elsif (($p) = /^DRIVER"(.*)"/) { $match_all_hardware ? 1 : ($inv xor find { $_->{driver} =~ /$p/i } @probeall); - } elsif ((($p) = /^TYPE"(.*)"/) && $p ne '64bit') { + } elsif (/^TYPE"64bit"/) { + #- When searching for hardware support packages, we need to filter out packages + #- that don't match our architecture without signalling a positive match for + #- packages that do. So we record the result of the test here for use later. + $bits_ok ||= ($inv xor $TYPEs->{'64bit'}); + $o_match_only_hardware ? 0 : $bits_ok; + } elsif (($p) = /^TYPE"(.*)"/) { $match_all_hardware ? 1 : ($inv xor $TYPEs->{$p}); } elsif (($p) = /^HW_CAT"(.*)"/) { $match_all_hardware ? 1 : ($inv xor detect_devices::probe_category($p)); @@ -133,7 +140,7 @@ sub read_rpmsrate { $inv xor $rpmsrate_flags_chosen->{$_}; } } @$known_flags; - $ok ? 'TRUE' : @$user_flags ? join('||', @$user_flags) : 'FALSE'; + $ok ? 'TRUE' : @$user_flags ? join('||', @$user_flags) : $bits_ok ? () : 'FALSE'; } @flags; @flags = member('FALSE', @flags) ? 'FALSE' : @flags; @@ -150,8 +157,8 @@ sub read_rpmsrate { sub simple_read_rpmsrate { - my ($o_match_all_hardware, $o_ignore_flags) = @_; - my ($rates, $flags) = read_rpmsrate({}, {}, $::prefix . '/usr/share/meta-task/rpmsrate-raw', $o_match_all_hardware); + my ($o_match_all_hardware, $o_ignore_flags, $o_match_only_hardware) = @_; + my ($rates, $flags) = read_rpmsrate({}, {}, $::prefix . '/usr/share/meta-task/rpmsrate-raw', $o_match_all_hardware, $o_match_only_hardware); # FIXME: we do not handle !CAT_desktop but we do not care for now: if (!$o_match_all_hardware && $o_ignore_flags) { @@ -168,7 +175,7 @@ sub simple_read_rpmsrate { sub detect_rpmsrate_hardware_packages { my ($o_match_all_hardware, $ignore_flags) = @_; - grep { !/openoffice|java/ } simple_read_rpmsrate($o_match_all_hardware, $ignore_flags); + grep { !/openoffice|java/ } simple_read_rpmsrate($o_match_all_hardware, $ignore_flags, 'match-only-hardware'); } sub detect_graphical_drivers { -- cgit v1.2.1