summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2022-07-27 09:55:20 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2023-04-13 15:18:22 +0200
commitd0f58d7b1e214f7738fee6e28da372abf785df4d (patch)
treed4ac7ae6c0542487543c5f21accddb62cac735bd /urpm
parentd48431a762f74f6a68f8cf956f154a878ea5368d (diff)
downloadurpmi-d0f58d7b1e214f7738fee6e28da372abf785df4d.tar
urpmi-d0f58d7b1e214f7738fee6e28da372abf785df4d.tar.gz
urpmi-d0f58d7b1e214f7738fee6e28da372abf785df4d.tar.bz2
urpmi-d0f58d7b1e214f7738fee6e28da372abf785df4d.tar.xz
urpmi-d0f58d7b1e214f7738fee6e28da372abf785df4d.zip
(_replace_kernel_by_its_provide) split it out
Rationale: so that we can document kernel management
Diffstat (limited to 'urpm')
-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;