summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2022-07-27 09:47:53 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2022-12-10 14:15:07 +0100
commite00ff233a72f1539ac4c94352ee8146ba1c323e4 (patch)
tree75787fb24435e91703266c158812f599561da51f
parent680e4b35b1aa7c447aff0f8ddb25944d444de051 (diff)
downloadurpmi-e00ff233a72f1539ac4c94352ee8146ba1c323e4.tar
urpmi-e00ff233a72f1539ac4c94352ee8146ba1c323e4.tar.gz
urpmi-e00ff233a72f1539ac4c94352ee8146ba1c323e4.tar.bz2
urpmi-e00ff233a72f1539ac4c94352ee8146ba1c323e4.tar.xz
urpmi-e00ff233a72f1539ac4c94352ee8146ba1c323e4.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"
-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;
}
}