summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm/orphans.pm21
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;