From df42ed1c2cd033cd17aa055ddf2b7d1174c8a16c Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 22 Oct 2022 16:38:48 +0100 Subject: Use a better algorithm for selecting packages from rpmsrate. The old algorithm mimicked the behaviour of the bcd tool, which selected a package if any of the rpmsrate flags for that package matched. The new algorithm behaves more like the installer, which only selects a package if all the rpmsrate flags match. Any rpmsrate flags that aren't listed in the package group lists are now treated as having a threshold value of 1. This avoids having to specify threshold values for all the hardware and driver specific flags. --- lib/MGA/DrakISO/BuildMedia.pm | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/MGA/DrakISO/BuildMedia.pm b/lib/MGA/DrakISO/BuildMedia.pm index 8f2717a..8d589b4 100644 --- a/lib/MGA/DrakISO/BuildMedia.pm +++ b/lib/MGA/DrakISO/BuildMedia.pm @@ -325,23 +325,16 @@ sub add_rated_packages { my ($ratings, $flag_expressions) = partition { /^\d$/ } @values; my ($rating) = @$ratings or die "ERROR: missing rating at $file line $line_number\n"; - # In the installer, the set of flag expressions is treated as a - # list of conditions, all of which must be true for the package - # to be selected. But we need to include the packages for any - # possible selection of categories, so we need to determine - # whether any individual flag matches one of groups specified by - # the user and whether the package rating meets the specified - # threshold for that group. - my @flags = map { split('\|\|', $_) } @$flag_expressions; - # Skip any architecture-specific packages that don't match our # architecture. my $arch = $build->{settings}{arch}; - next if $arch eq 'x86_64' && member('!TYPE"64bit"', @flags); - next if $arch ne 'x86_64' && member( 'TYPE"64bit"', @flags); + next if $arch eq 'x86_64' && member('!TYPE"64bit"', @$flag_expressions); + next if $arch ne 'x86_64' && member( 'TYPE"64bit"', @$flag_expressions); # Skip any packages that don't match the user's requirements. - next if !any { defined $group_threshold{$_} && $rating >= $group_threshold{$_} } @flags; + next if any { + !any { $_ =~ /^!/ || !defined $group_threshold{$_} || $rating >= $group_threshold{$_} } split('\|\|', $_) + } @$flag_expressions; # For each package, set the package class to 1 to indicate it is # an explicitly selected package. -- cgit v1.2.1