summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changes7
-rw-r--r--MANIFEST11
-rw-r--r--t/README9
-rw-r--r--t/data/SPECS/kernel-1/kernel-desktop1.spec22
-rw-r--r--t/data/SPECS/kernel-1/kernel-desktop2.spec22
-rw-r--r--t/data/SPECS/kernel-1/kernel-desktop3.spec22
-rw-r--r--t/data/SPECS/kernel-1/kernel-desktop4.spec22
-rw-r--r--t/data/SPECS/kernel-1/kernel-desktop5.spec22
-rw-r--r--t/data/SPECS/kernel-1/virtualbox-kernel-desktop1.spec19
-rw-r--r--t/data/SPECS/kernel-1/virtualbox-kernel-desktop2.spec19
-rw-r--r--t/data/SPECS/kernel-1/virtualbox-kernel-desktop3.spec19
-rw-r--r--t/data/SPECS/kernel-1/virtualbox-kernel-desktop4.spec19
-rw-r--r--t/data/SPECS/kernel-1/virtualbox-kernel-desktop5.spec18
-rw-r--r--t/data/SPECS/kernel-2/kernel-desktop1.spec20
-rw-r--r--t/data/SPECS/kernel-2/kernel-desktop2.spec20
-rw-r--r--t/data/SPECS/kernel-2/kernel-desktop3.spec20
-rw-r--r--t/data/SPECS/kernel-2/kernel-desktop4.spec20
-rw-r--r--t/data/SPECS/kernel-2/kernel-desktop5.spec20
-rw-r--r--t/data/SPECS/kernel-2/virtualbox-kernel-desktop1.spec19
-rw-r--r--t/data/SPECS/kernel-2/virtualbox-kernel-desktop2.spec19
-rw-r--r--t/data/SPECS/kernel-2/virtualbox-kernel-desktop3.spec19
-rw-r--r--t/data/SPECS/kernel-2/virtualbox-kernel-desktop4.spec19
-rw-r--r--t/data/SPECS/kernel-2/virtualbox-kernel-desktop5.spec18
-rwxr-xr-xt/gendistrib2
-rwxr-xr-xt/genhdlist22
-rw-r--r--t/superuser--orphans-kernels.t50
-rw-r--r--urpm.pm2
-rw-r--r--urpm/orphans.pm59
-rw-r--r--urpmi.pm2
29 files changed, 529 insertions, 13 deletions
diff --git a/Changes b/Changes
index 1ceb22b2..aa815308 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,11 @@
- Set wget as default downloader (mga#24362)
+
+Version 8.131 - 13 April 2023
+
+- urpmi:
+ o Fix --auto-orphans vs new kernel naming
+ (having multuple "kernel" pkgs with different versions)
+
Version 8.130 - 28 January 2023
- library:
diff --git a/MANIFEST b/MANIFEST
index 1a132e0a..4625799e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -196,6 +196,16 @@ t/data/SPECS/handle-conflict-deps2/c-2.spec
t/data/SPECS/handle-conflict-deps2/d1-1.spec
t/data/SPECS/handle-conflict-deps2/d1-2.spec
t/data/SPECS/handle-conflict-deps2/d2.spec
+t/data/SPECS/kernel-1/kernel-desktop1.spec
+t/data/SPECS/kernel-1/kernel-desktop2.spec
+t/data/SPECS/kernel-1/kernel-desktop3.spec
+t/data/SPECS/kernel-1/kernel-desktop4.spec
+t/data/SPECS/kernel-1/kernel-desktop5.spec
+t/data/SPECS/kernel-2/kernel-desktop1.spec
+t/data/SPECS/kernel-2/kernel-desktop2.spec
+t/data/SPECS/kernel-2/kernel-desktop3.spec
+t/data/SPECS/kernel-2/kernel-desktop4.spec
+t/data/SPECS/kernel-2/kernel-desktop5.spec
t/data/SPECS/multi-line-macro.spec
t/data/SPECS/multi-line-macro2.spec
t/data/SPECS/obsolete-and-conflict/a.spec
@@ -437,6 +447,7 @@ t/superuser--mirrorlist.t
t/superuser--obsolete-and-conflict.t
t/superuser--ordering-scriptlets.t
t/superuser--orphans.t
+t/superuser--orphans-kernels.t
t/superuser--prefer.t
t/superuser--prefer2.t
t/superuser--priority-upgrade.t
diff --git a/t/README b/t/README
index 9c821497..41f48345 100644
--- a/t/README
+++ b/t/README
@@ -32,6 +32,15 @@ eatmydata make testall
If you didn't alter the tests data, you can further speedup a re-run by using:
[[ -d t/media ]] && mv -f t/02create_pkgs.t{,.i}
+You can selectively run some tests:
+# Run everything:
+PERL_DL_NONLAZY=1 perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
+# Only run everything orphans tests:
+PERL_DL_NONLAZY=1 perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*orphans*.t
+# If you want to see the output:
+perl t/superuser--orphans.t
+
+
Layout:
=======
diff --git a/t/data/SPECS/kernel-1/kernel-desktop1.spec b/t/data/SPECS/kernel-1/kernel-desktop1.spec
new file mode 100644
index 00000000..3466df6e
--- /dev/null
+++ b/t/data/SPECS/kernel-1/kernel-desktop1.spec
@@ -0,0 +1,22 @@
+%global ver 5.15.41
+Summary: x
+Name: kernel-desktop-%{ver}-1
+Version: 1
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Version: %ver
+Requires: kernel-desktop-%{ver}-1
+
+%description
+Kernel naming as used in mdv & mga[1-8].
+Each kernel has an unique name ("kernel-v-r")
+Thus fullname is "kernel-v-r-1-1".
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/kernel-desktop2.spec b/t/data/SPECS/kernel-1/kernel-desktop2.spec
new file mode 100644
index 00000000..9424b939
--- /dev/null
+++ b/t/data/SPECS/kernel-1/kernel-desktop2.spec
@@ -0,0 +1,22 @@
+%global ver 5.15.42
+Summary: x
+Name: kernel-desktop-%{ver}-1
+Version: 1
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Version: %ver
+Requires: kernel-desktop-%{ver}-1
+
+%description
+Kernel naming as used in mdv & mga[1-8].
+Each kernel has an unique name ("kernel-v-r")
+Thus fullname is "kernel-v-r-1-1".
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/kernel-desktop3.spec b/t/data/SPECS/kernel-1/kernel-desktop3.spec
new file mode 100644
index 00000000..aafd5468
--- /dev/null
+++ b/t/data/SPECS/kernel-1/kernel-desktop3.spec
@@ -0,0 +1,22 @@
+%global ver 5.15.43
+Summary: x
+Name: kernel-desktop-%{ver}-1
+Version: 1
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Version: %ver
+Requires: kernel-desktop-%{ver}-1
+
+%description
+Kernel naming as used in mdv & mga[1-8].
+Each kernel has an unique name ("kernel-v-r")
+Thus fullname is "kernel-v-r-1-1".
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/kernel-desktop4.spec b/t/data/SPECS/kernel-1/kernel-desktop4.spec
new file mode 100644
index 00000000..6b433a52
--- /dev/null
+++ b/t/data/SPECS/kernel-1/kernel-desktop4.spec
@@ -0,0 +1,22 @@
+%global ver 5.15.44
+Summary: x
+Name: kernel-desktop-%{ver}-1
+Version: 1
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Version: %ver
+Requires: kernel-desktop-%{ver}-1
+
+%description
+Kernel naming as used in mdv & mga[1-8].
+Each kernel has an unique name ("kernel-v-r")
+Thus fullname is "kernel-v-r-1-1".
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/kernel-desktop5.spec b/t/data/SPECS/kernel-1/kernel-desktop5.spec
new file mode 100644
index 00000000..9352a6f6
--- /dev/null
+++ b/t/data/SPECS/kernel-1/kernel-desktop5.spec
@@ -0,0 +1,22 @@
+%global ver 5.15.45
+Summary: x
+Name: kernel-desktop-%{ver}-1
+Version: 1
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Version: %ver
+Requires: kernel-desktop-%{ver}-1
+
+%description
+Kernel naming as used in mdv & mga[1-8].
+Each kernel has an unique name ("kernel-v-r")
+Thus fullname is "kernel-v-r-1-1".
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/virtualbox-kernel-desktop1.spec b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop1.spec
new file mode 100644
index 00000000..34306fb7
--- /dev/null
+++ b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop1.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.41
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 1
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-1
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/virtualbox-kernel-desktop2.spec b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop2.spec
new file mode 100644
index 00000000..eba571ef
--- /dev/null
+++ b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop2.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.42
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 2
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-2
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/virtualbox-kernel-desktop3.spec b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop3.spec
new file mode 100644
index 00000000..76e56f0e
--- /dev/null
+++ b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop3.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.43
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 3
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-3
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/virtualbox-kernel-desktop4.spec b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop4.spec
new file mode 100644
index 00000000..a6a68765
--- /dev/null
+++ b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop4.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.44
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 4
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-4
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-1/virtualbox-kernel-desktop5.spec b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop5.spec
new file mode 100644
index 00000000..4e8b8d7b
--- /dev/null
+++ b/t/data/SPECS/kernel-1/virtualbox-kernel-desktop5.spec
@@ -0,0 +1,18 @@
+%global kver 5.15.45
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 5
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-5
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/kernel-desktop1.spec b/t/data/SPECS/kernel-2/kernel-desktop1.spec
new file mode 100644
index 00000000..ca218706
--- /dev/null
+++ b/t/data/SPECS/kernel-2/kernel-desktop1.spec
@@ -0,0 +1,20 @@
+Summary: x
+Name: kernel-desktop
+Version: 5.15.41
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Requires: kernel-desktop = %{version}-%{release}
+
+%description
+Kernel naming as used in mga9+.
+Each kernel is named "kernel".
+So we can have multiple packages named "kernel" installed at the same time, with different versions
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/kernel-desktop2.spec b/t/data/SPECS/kernel-2/kernel-desktop2.spec
new file mode 100644
index 00000000..f42de4d0
--- /dev/null
+++ b/t/data/SPECS/kernel-2/kernel-desktop2.spec
@@ -0,0 +1,20 @@
+Summary: x
+Name: kernel-desktop
+Version: 5.15.42
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Requires: kernel-desktop = %{version}-%{release}
+
+%description
+Kernel naming as used in mga9+.
+Each kernel is named "kernel".
+So we can have multiple packages named "kernel" installed at the same time, with different versions
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/kernel-desktop3.spec b/t/data/SPECS/kernel-2/kernel-desktop3.spec
new file mode 100644
index 00000000..ff40fec8
--- /dev/null
+++ b/t/data/SPECS/kernel-2/kernel-desktop3.spec
@@ -0,0 +1,20 @@
+Summary: x
+Name: kernel-desktop
+Version: 5.15.43
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Requires: kernel-desktop = %{version}-%{release}
+
+%description
+Kernel naming as used in mga9+.
+Each kernel is named "kernel".
+So we can have multiple packages named "kernel" installed at the same time, with different versions
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/kernel-desktop4.spec b/t/data/SPECS/kernel-2/kernel-desktop4.spec
new file mode 100644
index 00000000..edbd9745
--- /dev/null
+++ b/t/data/SPECS/kernel-2/kernel-desktop4.spec
@@ -0,0 +1,20 @@
+Summary: x
+Name: kernel-desktop
+Version: 5.15.44
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Requires: kernel-desktop = %{version}-%{release}
+
+%description
+Kernel naming as used in mga9+.
+Each kernel is named "kernel".
+So we can have multiple packages named "kernel" installed at the same time, with different versions
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/kernel-desktop5.spec b/t/data/SPECS/kernel-2/kernel-desktop5.spec
new file mode 100644
index 00000000..e22152a9
--- /dev/null
+++ b/t/data/SPECS/kernel-2/kernel-desktop5.spec
@@ -0,0 +1,20 @@
+Summary: x
+Name: kernel-desktop
+Version: 5.15.45
+Release: 1
+License: x
+
+%package -n kernel-desktop-latest
+Summary: x
+Requires: kernel-desktop = %{version}-%{release}
+
+%description
+Kernel naming as used in mga9+.
+Each kernel is named "kernel".
+So we can have multiple packages named "kernel" installed at the same time, with different versions
+
+%description -n kernel-desktop-latest
+x
+
+%files
+%files -n kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/virtualbox-kernel-desktop1.spec b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop1.spec
new file mode 100644
index 00000000..34306fb7
--- /dev/null
+++ b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop1.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.41
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 1
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-1
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/virtualbox-kernel-desktop2.spec b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop2.spec
new file mode 100644
index 00000000..eba571ef
--- /dev/null
+++ b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop2.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.42
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 2
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-2
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/virtualbox-kernel-desktop3.spec b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop3.spec
new file mode 100644
index 00000000..76e56f0e
--- /dev/null
+++ b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop3.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.43
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 3
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-3
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/virtualbox-kernel-desktop4.spec b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop4.spec
new file mode 100644
index 00000000..a6a68765
--- /dev/null
+++ b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop4.spec
@@ -0,0 +1,19 @@
+%global kver 5.15.44
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 4
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-4
+
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/data/SPECS/kernel-2/virtualbox-kernel-desktop5.spec b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop5.spec
new file mode 100644
index 00000000..4e8b8d7b
--- /dev/null
+++ b/t/data/SPECS/kernel-2/virtualbox-kernel-desktop5.spec
@@ -0,0 +1,18 @@
+%global kver 5.15.45
+Summary: x
+Name: virtualbox-kernel-%{kver}-desktop-1
+Version: 6.1.36
+Release: 5
+License: x
+
+%package -n virtualbox-kernel-desktop-latest
+Summary: x
+Requires: virtualbox-kernel-%{kver}-desktop-1 = 6.1.36-5
+%description
+x
+
+%description -n virtualbox-kernel-desktop-latest
+x
+
+%files
+%files -n virtualbox-kernel-desktop-latest
diff --git a/t/gendistrib b/t/gendistrib
index 193c3a64..e0457505 100755
--- a/t/gendistrib
+++ b/t/gendistrib
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5.32.1
+#!/usr/bin/perl
(our $VERSION) = q(Id: gendistrib 20724 2006-11-30 13:13:27Z rafael ) =~ /(\d+)/;
diff --git a/t/genhdlist2 b/t/genhdlist2
index 8799086e..04c95b7d 100755
--- a/t/genhdlist2
+++ b/t/genhdlist2
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5.32.1
+#!/usr/bin/perl
our ($VERSION) = q(Id: genhdlist2 20460 2006-11-23 13:19:11Z pixel ) =~ /(\d+\.\d+)/;
diff --git a/t/superuser--orphans-kernels.t b/t/superuser--orphans-kernels.t
new file mode 100644
index 00000000..4fe25d43
--- /dev/null
+++ b/t/superuser--orphans-kernels.t
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+# kernel-desktop-latest request latest kernel-desktop-foobar
+#
+use strict;
+use lib '.', 't';
+use helper;
+use urpm::cfg;
+use urpm::orphans;
+use Test::More 'no_plan';
+
+need_root_and_prepare();
+
+my $arch = urpm::cfg::get_arch();
+my $name = 'kernel';
+my $dkms_name = 'virtualbox';
+urpmi_addmedia("$name-1 $::pwd/media/$name-1");
+urpmi_addmedia("$name-2 $::pwd/media/$name-2");
+
+# we want urpmi --auto-select to always check orphans (when not using --auto-orphans)
+set_urpmi_cfg_global_options({ 'nb-of-new-unrequested-pkgs-between-auto-select-orphans-check' => 0 });
+
+# old naming, each kernel NVR is N=kernel-desktop-5.6.2-1, V=1 R=1.mga8
+test_unorphan_kernels("$name-1", 'kernel-desktop-latest');
+# new naming, each kernel NVR is N=kernel-desktop, V=5.6.2 R=1.mga8
+test_unorphan_kernels("$name-2", 'kernel-desktop-latest', 'kernel-desktop');
+
+# FIXME: add virtualbox-kernel-XXX -> kernel-XXX
+sub test_unorphan_kernels {
+ my ($medium, $pkg, $o_pkg2) = @_;
+ my $base_kversion = '5.15.4';
+ my $dkms_version = '6.1.36';
+ #my $latest_dkms_dep = 'virtualbox-kernel-5.15.45-desktop-1'; # harcoded but no choice...
+ my $latest_dkms_dep = "virtualbox-kernel-${base_kversion}5-desktop-1"; # harcoded but no choice...
+ my ($latest_kpkg, $latest_dpkg);
+ print "# test_unorphan_kernels($pkg) ($base_kversion)\n";
+ foreach (1..5) {
+ $latest_kpkg = "$pkg-${base_kversion}$_-1";
+ urpmi("--media $medium --auto $latest_kpkg");
+ # Add some DKMS packages:
+ $latest_dpkg = "$dkms_name-$pkg-${dkms_version}-$_.$arch";
+ urpmi("--media $medium --auto $latest_dpkg");
+ }
+ #urpmi("--media $medium --auto $pkg");
+ urpme("--auto --auto-orphans");
+ $o_pkg2 ||= $latest_kpkg;
+ $o_pkg2 =~ s/-latest//;
+ check_installed_and_remove($pkg, 'virtualbox-kernel-desktop-latest', $o_pkg2, $latest_dkms_dep);
+}
+
diff --git a/urpm.pm b/urpm.pm
index d54a4b6b..76302f26 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -14,7 +14,7 @@ use urpm::md5sum;
# perl_checker: require urpm::media
# perl_checker: require urpm::parallel
-our $VERSION = 'v8.130';
+our $VERSION = 'v8.131';
our @ISA = qw(URPM Exporter);
our @EXPORT_OK = ('file_from_local_url', 'file_from_local_medium', 'is_local_medium');
diff --git a/urpm/orphans.pm b/urpm/orphans.pm
index 1ea0d60c..aea64fb4 100644
--- a/urpm/orphans.pm
+++ b/urpm/orphans.pm
@@ -1,7 +1,7 @@
package urpm::orphans;
use strict;
-use urpm::util qw(add2hash_ append_to_file cat_ output_safe partition put_in_hash uniq wc_l);
+use urpm::util qw(add2hash_ append_to_file cat_ member output_safe partition put_in_hash uniq wc_l);
use urpm::msg;
use urpm;
@@ -421,6 +421,27 @@ 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
+
+On mga9+:
+We've "kernel-desktop[== 5.15.45-1]", we want to find pkg providing that, eg the NVRA of the pkg named 'kernel-desktop' whose version matches.
+
+=cut
+
+sub _replace_kernel_by_its_provide {
+ my ($urpm, $pkg) = @_;
+ my ($req) = grep { /^kernel/ } $pkg->requires;
+ my @a = $urpm->find_candidate_packages($req);
+ $a[0];
+}
=item _kernel_callback ($pkg, $unreq_list)
@@ -430,7 +451,7 @@ _fast_ version w/o looking at all non kernel packages requires on
kernels (like "urpmi_find_leaves '^kernel'" would)
_all_unrequested_orphans blacklists nearly all kernels b/c of packages
-like 'ndiswrapper' or 'basesystem' that requires 'kernel'
+like 'ndiswrapper' or 'basesystem' that requires 'kernel' (on mga < 9)
rationale: other packages only require 'kernel' or a sub package we
do not care about (eg: kernel-devel, kernel-firmware, kernel-latest)
@@ -438,9 +459,12 @@ so it's useless to look at them
=cut
+# @req_by_latest_kernels tracks kernels needed by kernel*-latest
+# %requested_kernels tracks which pkgs requires which kernel pkg
+# %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;
@@ -461,9 +485,10 @@ 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 $kpkg = _replace_kernel_by_its_provide($urpm, $pkg);
+ push @req_by_latest_kernels, scalar $kpkg->fullname if $kpkg;
} else {
- $kernels{$shortname} = $pkg;
+ $kernels{$n} = $pkg;
}
}
@@ -494,23 +519,37 @@ sub _all_unrequested_orphans {
my (%l, %provides);
# 1- list explicit provides (not files) from installed packages:
+
+ my $need_expand = 0;
foreach my $pkg (@$unreq) {
- $l{$pkg->name} = $pkg;
+ $l{$pkg->fullname} = $pkg;
+ my $n = $pkg->name;
+ # Instead of hardcoding desktop/linus/server/... flavors, blacklist:
+ $need_expand++ if $n =~ /^kernel-(\w+)$/ && !member($1, qw(doc firmware source));
push @{$provides{$_}}, $pkg foreach $pkg->provides_nosense;
}
my $unreq_list = unrequested_list($urpm);
+ # we need to replace/augment eg "kernel-desktop" by the "kernel-desktop-V-R" for each installed kernel:
+ if ($need_expand) {
+ $kernels{$_->fullname} = $_ foreach grep { /^kernel/ } @$unreq;
+ }
+
my ($current_kernel_version, $current_kernel) = _get_current_kernel_package();
# 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};
+ # FIXME: hackish in order to fix orphaning kernels with virtualbox installed on mga9+
+ # TODO: check if something else that's not orphaned still provides it instead
+ next if $n eq 'kmod(vboxdrv.ko)';
+ my $pfn = $p->fullname;
+ if ($p != $pkg && $l{$pfn} && $p->provides_overlap($prop)) {
+ delete $l{$pfn};
push @$req, $p;
}
}
@@ -573,6 +612,8 @@ Returns the list of unrequested packages (aka orphans).
It is quite fast. the slow part is the creation of
$installed_packages_packed (using installed_packages_packed())
+Used by C<urpmq --auto_orphans>
+
=cut
#
diff --git a/urpmi.pm b/urpmi.pm
index add3a869..b26769cc 100644
--- a/urpmi.pm
+++ b/urpmi.pm
@@ -4,6 +4,6 @@ use strict;
# Dummy package for CPAN testers
-our $VERSION = '8.130';
+our $VERSION = '8.131';
1;