summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2022-07-27 09:47:53 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2023-04-13 15:18:22 +0200
commitd48431a762f74f6a68f8cf956f154a878ea5368d (patch)
tree10ed24899dc8759428fd635d9f2d7e4c1f92755e /urpm
parent208ed9c362e919b57097f94e534cd7312ba56846 (diff)
downloadurpmi-d48431a762f74f6a68f8cf956f154a878ea5368d.tar
urpmi-d48431a762f74f6a68f8cf956f154a878ea5368d.tar.gz
urpmi-d48431a762f74f6a68f8cf956f154a878ea5368d.tar.bz2
urpmi-d48431a762f74f6a68f8cf956f154a878ea5368d.tar.xz
urpmi-d48431a762f74f6a68f8cf956f154a878ea5368d.zip
Track kernels by their NVRA
No change for mdv-mga8, but it's needed for mga9+ where multiple kernel with the same short name "kernel-foobar" are installed with different versions instead of having different pkgs names such as "kernel-foobar-5.12-1-1.mga8" and "kernel-foobar-5.16.3-1-1.mga8"
Diffstat (limited to 'urpm')
-rw-r--r--urpm/orphans.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/urpm/orphans.pm b/urpm/orphans.pm
index f27bc610..cc9e76d2 100644
--- a/urpm/orphans.pm
+++ b/urpm/orphans.pm
@@ -443,7 +443,7 @@ so it's useless to look at them
# %kernels tracks !"*-latest" kernels (to be later filtered)
my (@req_by_latest_kernels, %requested_kernels, %kernels);
sub _kernel_callback {
- my ($pkg, $unreq_list) = @_;
+ my ($urpm, $pkg, $unreq_list) = @_;
my $shortname = $pkg->name;
my $n = $pkg->fullname;
@@ -464,9 +464,11 @@ sub _kernel_callback {
# keep track of packages required by latest kernels in order not to try removing requested kernels:
if ($n =~ /latest/) {
- push @req_by_latest_kernels, $pkg->requires;
+ my @a = $urpm->packages_providing($pkg->requires);
+ my $kpkg = $a[0];
+ push @req_by_latest_kernels, scalar $kpkg->fullname if $kpkg;
} else {
- $kernels{$shortname} = $pkg;
+ $kernels{$n} = $pkg;
}
}
@@ -498,7 +500,7 @@ sub _all_unrequested_orphans {
my (%l, %provides);
# 1- list explicit provides (not files) from installed packages:
foreach my $pkg (@$unreq) {
- $l{$pkg->name} = $pkg;
+ $l{$pkg->fullname} = $pkg;
push @{$provides{$_}}, $pkg foreach $pkg->provides_nosense;
}
my $unreq_list = unrequested_list($urpm);
@@ -508,12 +510,13 @@ sub _all_unrequested_orphans {
# 2- check if "unrequested" packages are still needed:
while (my $pkg = shift @$req) {
# do not do anything regarding kernels if we failed to detect the running one (ie: chroot)
- _kernel_callback($pkg, $unreq_list) if $current_kernel;
+ _kernel_callback($urpm, $pkg, $unreq_list) if $current_kernel;
foreach my $prop ($pkg->requires, $pkg->recommends_nosense) {
my $n = URPM::property2name($prop);
foreach my $p (@{$provides{$n} || []}) {
- if ($p != $pkg && $l{$p->name} && $p->provides_overlap($prop)) {
- delete $l{$p->name};
+ my $pfn = $p->fullname;
+ if ($p != $pkg && $l{$pfn} && $p->provides_overlap($prop)) {
+ delete $l{$pfn};
push @$req, $p;
}
}