From 7a7c616d0add53a98641410376588fca509524a6 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 17:44:59 +0200 Subject: (_all_unrequested_orphans) handle mga9 kernels Now kernel names are unversionned and we've multiple packages with the same "kernel" name which make orphans handling to derail --- Changes | 3 +++ urpm/orphans.pm | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 2960d6e8..b52463e9 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ - cpan_testers: o Skip mirrorlist tests if there's only one broken mirror such as on mga[1-6] +- urpmi: + o Fix --auto-orphans vs new kernel naming + (having multuple "kernel" pkgs with different versions) - urpmq: o --requires/suggests: do not warn about 14y+ old behavior change (mga#26448) diff --git a/urpm/orphans.pm b/urpm/orphans.pm index a5d5cc5c..11bd555e 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -1,7 +1,7 @@ package urpm::orphans; use strict; -use urpm::util qw(add2hash_ append_to_file cat_ output_safe partition put_in_hash uniq wc_l); +use urpm::util qw(add2hash_ append_to_file cat_ member output_safe partition put_in_hash uniq wc_l); use urpm::msg; use urpm; @@ -519,12 +519,22 @@ sub _all_unrequested_orphans { my (%l, %provides); # 1- list explicit provides (not files) from installed packages: + + my $need_expand = 0; foreach my $pkg (@$unreq) { $l{$pkg->fullname} = $pkg; + my $n = $pkg->name; + # Instead of hardcoding desktop/linus/server/... flavors, blacklist: + $need_expand++ if $n =~ /^kernel-(\w+)$/ && !member($1, qw(doc firmware source)); push @{$provides{$_}}, $pkg foreach $pkg->provides_nosense; } my $unreq_list = unrequested_list($urpm); + # we need to replace/augment eg "kernel-desktop" by the "kernel-desktop-V-R" for each installed kernel: + if ($need_expand) { + $kernels{$_->fullname} = $_ foreach grep { /^kernel/ } @$unreq; + } + my ($current_kernel_version, $current_kernel) = _get_current_kernel_package(); # 2- check if "unrequested" packages are still needed: -- cgit v1.2.1