diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2022-07-27 09:55:20 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2022-12-10 14:15:07 +0100 |
commit | 87d850a66a4c3b1108e9b932926804afa90df0b1 (patch) | |
tree | d0e93c8c988dc4e3fc8257ec41ee0fd74fd03976 | |
parent | e00ff233a72f1539ac4c94352ee8146ba1c323e4 (diff) | |
download | urpmi-87d850a66a4c3b1108e9b932926804afa90df0b1.tar urpmi-87d850a66a4c3b1108e9b932926804afa90df0b1.tar.gz urpmi-87d850a66a4c3b1108e9b932926804afa90df0b1.tar.bz2 urpmi-87d850a66a4c3b1108e9b932926804afa90df0b1.tar.xz urpmi-87d850a66a4c3b1108e9b932926804afa90df0b1.zip |
(_replace_kernel_by_its_provide) split it out
Rationale: so that we can document kernel management
-rw-r--r-- | urpm/orphans.pm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/urpm/orphans.pm b/urpm/orphans.pm index cc9e76d2..60bfb4a1 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -421,6 +421,24 @@ sub _get_current_kernel_package() { -e "/boot/vmlinuz-$release" && ($release, `rpm -qf --qf '%{name}' /boot/vmlinuz-$release`); } +=item _replace_kernel_by_its_provide($urpm, $pkg) + +Take a dep, replace it by the pkg providing it. +Eg: +Return the current kernel's package so that we can filter out current running +kernel: + +On mdv & mga[1-8], it's for getting the fullname of the matching pkg. +Eg: kernel-desktop-5.15.45-1.mga8 -> kernel-desktop-5.15.45-1.mga8-1-1.x86_64 + +=cut + +sub _replace_kernel_by_its_provide { + my ($urpm, $pkg) = @_; + my ($req) = grep { /^kernel/ } $pkg->requires; + my @a = $urpm->packages_providing($pkg->requires); + $a[0]; +} =item _kernel_callback ($pkg, $unreq_list) @@ -464,8 +482,7 @@ sub _kernel_callback { # keep track of packages required by latest kernels in order not to try removing requested kernels: if ($n =~ /latest/) { - my @a = $urpm->packages_providing($pkg->requires); - my $kpkg = $a[0]; + my $kpkg = _replace_kernel_by_its_provide($urpm, $pkg); push @req_by_latest_kernels, scalar $kpkg->fullname if $kpkg; } else { $kernels{$n} = $pkg; |