summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2022-10-22 16:38:48 +0100
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2022-10-22 17:00:54 +0100
commitdf42ed1c2cd033cd17aa055ddf2b7d1174c8a16c (patch)
treefc9091f36d763f6374a2452aa45312a3331d0390
parent57afd15d962b0ec7027db2c2fbfc25c601403aff (diff)
downloaddrakiso-df42ed1c2cd033cd17aa055ddf2b7d1174c8a16c.tar
drakiso-df42ed1c2cd033cd17aa055ddf2b7d1174c8a16c.tar.gz
drakiso-df42ed1c2cd033cd17aa055ddf2b7d1174c8a16c.tar.bz2
drakiso-df42ed1c2cd033cd17aa055ddf2b7d1174c8a16c.tar.xz
drakiso-df42ed1c2cd033cd17aa055ddf2b7d1174c8a16c.zip
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.
-rw-r--r--NEWS2
-rw-r--r--lib/MGA/DrakISO/BuildMedia.pm17
2 files changed, 7 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index df45017..e0d2ffb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- improved algorithm for selecting packages from rpmsrate
+
1.18
- change ESP label to MGAISO-ESP (mga#28409)
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.