From c32645103037dd4a2b6f31598d31880e947466a7 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 13 Apr 2023 15:17:41 +0200 Subject: Revert bogus change Rationale: commit f823ad67ca12e41ea022f4269b34fcc1fc094db3 included wrong changes --- t/gendistrib | 2 +- t/genhdlist2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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+)/; -- cgit v1.2.1 From fd7041b779aace703abe9f31f88d86b89ebb5439 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 01:59:53 +0200 Subject: Add kernel testsuite for old style kernels Aka the jernel 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". --- MANIFEST | 6 ++++++ t/data/SPECS/kernel-1/kernel-desktop1.spec | 22 ++++++++++++++++++++ t/data/SPECS/kernel-1/kernel-desktop2.spec | 22 ++++++++++++++++++++ t/data/SPECS/kernel-1/kernel-desktop3.spec | 22 ++++++++++++++++++++ t/data/SPECS/kernel-1/kernel-desktop4.spec | 22 ++++++++++++++++++++ t/data/SPECS/kernel-1/kernel-desktop5.spec | 22 ++++++++++++++++++++ t/superuser--orphans-kernels.t | 32 ++++++++++++++++++++++++++++++ 7 files changed, 148 insertions(+) create mode 100644 t/data/SPECS/kernel-1/kernel-desktop1.spec create mode 100644 t/data/SPECS/kernel-1/kernel-desktop2.spec create mode 100644 t/data/SPECS/kernel-1/kernel-desktop3.spec create mode 100644 t/data/SPECS/kernel-1/kernel-desktop4.spec create mode 100644 t/data/SPECS/kernel-1/kernel-desktop5.spec create mode 100644 t/superuser--orphans-kernels.t diff --git a/MANIFEST b/MANIFEST index 1a132e0a..cec11a08 100644 --- a/MANIFEST +++ b/MANIFEST @@ -196,6 +196,11 @@ 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/multi-line-macro.spec t/data/SPECS/multi-line-macro2.spec t/data/SPECS/obsolete-and-conflict/a.spec @@ -437,6 +442,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/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/superuser--orphans-kernels.t b/t/superuser--orphans-kernels.t new file mode 100644 index 00000000..2b6e00dd --- /dev/null +++ b/t/superuser--orphans-kernels.t @@ -0,0 +1,32 @@ +#!/usr/bin/perl + +# kernel-desktop-latest request latest kernel-desktop-foobar +# +use strict; +use lib '.', 't'; +use helper; +use urpm::orphans; +use Test::More 'no_plan'; + +need_root_and_prepare(); + +my $name = 'kernel'; +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'); + +sub test_unorphan_kernels { + my ($medium, $pkg) = @_; + my $base_kversion = '5.15.4'; + print "# test_unorphan_kernels($pkg) ($base_kversion)\n"; + urpmi("--media $medium --auto $pkg-${base_kversion}$_-1") foreach 1..4; + urpmi("--media $medium --auto $pkg"); + urpme("--auto --auto-orphans"); + check_installed_and_remove($pkg, "kernel-desktop-${base_kversion}5-1.mga8"); +} + -- cgit v1.2.1 From 2dcdca7737e9875dc2b63661cfa793eba00065fe Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 09:43:43 +0200 Subject: Document that only urpmq uses get_orphans() --- urpm/orphans.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/urpm/orphans.pm b/urpm/orphans.pm index 1ea0d60c..e1d900a6 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -573,6 +573,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 + =cut # -- cgit v1.2.1 From 208ed9c362e919b57097f94e534cd7312ba56846 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 10:00:42 +0200 Subject: (_kernel_callback) Describe it more --- urpm/orphans.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/urpm/orphans.pm b/urpm/orphans.pm index e1d900a6..f27bc610 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -430,7 +430,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,6 +438,9 @@ 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) = @_; -- cgit v1.2.1 From d48431a762f74f6a68f8cf956f154a878ea5368d Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 09:47:53 +0200 Subject: 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" --- urpm/orphans.pm | 17 ++++++++++------- 1 file 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; } } -- cgit v1.2.1 From d0f58d7b1e214f7738fee6e28da372abf785df4d Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 09:55:20 +0200 Subject: (_replace_kernel_by_its_provide) split it out Rationale: so that we can document kernel management --- urpm/orphans.pm | 21 +++++++++++++++++++-- 1 file 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; -- cgit v1.2.1 From 0c9b00f27371e64c6ad862b583c5117099dc1f12 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 10:33:44 +0200 Subject: (_replace_kernel_by_its_provide) Adjust for new kernel naming --- urpm/orphans.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/urpm/orphans.pm b/urpm/orphans.pm index 60bfb4a1..a5d5cc5c 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -431,12 +431,15 @@ 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->packages_providing($pkg->requires); + my @a = $urpm->find_candidate_packages($req); $a[0]; } -- cgit v1.2.1 From acee538d3fb370ebfb63ac0a1348ce5a44d692d7 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 17:44:59 +0200 Subject: (_all_unrequested_orphans) handle mga9 kernels Now kernel names are unversionned and we've multiple packages with the same "kernel" name which make orphans handling to derail --- Changes | 4 ++++ urpm/orphans.pm | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index cb79c68e..7b7f3aab 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +- 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/urpm/orphans.pm b/urpm/orphans.pm index a5d5cc5c..11bd555e 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; @@ -519,12 +519,22 @@ 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->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: -- cgit v1.2.1 From 80a65c5144fa92b82af4da74aea5b5bb7115ac61 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 27 Jul 2022 02:02:58 +0200 Subject: Add kernel testsuite for new style kernels 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 It now works with previous commit. --- MANIFEST | 5 +++++ t/data/SPECS/kernel-2/kernel-desktop1.spec | 20 ++++++++++++++++++++ t/data/SPECS/kernel-2/kernel-desktop2.spec | 20 ++++++++++++++++++++ t/data/SPECS/kernel-2/kernel-desktop3.spec | 20 ++++++++++++++++++++ t/data/SPECS/kernel-2/kernel-desktop4.spec | 20 ++++++++++++++++++++ t/data/SPECS/kernel-2/kernel-desktop5.spec | 20 ++++++++++++++++++++ t/superuser--orphans-kernels.t | 7 +++++-- 7 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 t/data/SPECS/kernel-2/kernel-desktop1.spec create mode 100644 t/data/SPECS/kernel-2/kernel-desktop2.spec create mode 100644 t/data/SPECS/kernel-2/kernel-desktop3.spec create mode 100644 t/data/SPECS/kernel-2/kernel-desktop4.spec create mode 100644 t/data/SPECS/kernel-2/kernel-desktop5.spec diff --git a/MANIFEST b/MANIFEST index cec11a08..4625799e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -201,6 +201,11 @@ 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 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/superuser--orphans-kernels.t b/t/superuser--orphans-kernels.t index 2b6e00dd..f101f1f5 100644 --- a/t/superuser--orphans-kernels.t +++ b/t/superuser--orphans-kernels.t @@ -19,14 +19,17 @@ set_urpmi_cfg_global_options({ 'nb-of-new-unrequested-pkgs-between-auto-select-o # 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'); sub test_unorphan_kernels { - my ($medium, $pkg) = @_; + my ($medium, $pkg, $o_pkg2) = @_; my $base_kversion = '5.15.4'; + $o_pkg2 ||= "kernel-desktop-${base_kversion}5-1.mga8"; print "# test_unorphan_kernels($pkg) ($base_kversion)\n"; urpmi("--media $medium --auto $pkg-${base_kversion}$_-1") foreach 1..4; urpmi("--media $medium --auto $pkg"); urpme("--auto --auto-orphans"); - check_installed_and_remove($pkg, "kernel-desktop-${base_kversion}5-1.mga8"); + check_installed_and_remove($pkg, $o_pkg2); } -- cgit v1.2.1 From 23529316b2e516296ed3d06e51c7ae7b65df859a Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 28 Jul 2022 14:45:03 +0200 Subject: Explain how to run parts of tests --- t/README | 9 +++++++++ 1 file changed, 9 insertions(+) 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: ======= -- cgit v1.2.1 From 4410c36726f236e4f561020c10491d7c08ce0149 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sun, 28 Aug 2022 17:55:22 +0200 Subject: Add some fake dkms packages --- .../SPECS/kernel-1/virtualbox-kernel-desktop1.spec | 19 ++++++++++++++++++ .../SPECS/kernel-1/virtualbox-kernel-desktop2.spec | 19 ++++++++++++++++++ .../SPECS/kernel-1/virtualbox-kernel-desktop3.spec | 19 ++++++++++++++++++ .../SPECS/kernel-1/virtualbox-kernel-desktop4.spec | 19 ++++++++++++++++++ .../SPECS/kernel-1/virtualbox-kernel-desktop5.spec | 18 +++++++++++++++++ .../SPECS/kernel-2/virtualbox-kernel-desktop1.spec | 19 ++++++++++++++++++ .../SPECS/kernel-2/virtualbox-kernel-desktop2.spec | 19 ++++++++++++++++++ .../SPECS/kernel-2/virtualbox-kernel-desktop3.spec | 19 ++++++++++++++++++ .../SPECS/kernel-2/virtualbox-kernel-desktop4.spec | 19 ++++++++++++++++++ .../SPECS/kernel-2/virtualbox-kernel-desktop5.spec | 18 +++++++++++++++++ t/superuser--orphans-kernels.t | 23 ++++++++++++++++++---- 11 files changed, 207 insertions(+), 4 deletions(-) create mode 100644 t/data/SPECS/kernel-1/virtualbox-kernel-desktop1.spec create mode 100644 t/data/SPECS/kernel-1/virtualbox-kernel-desktop2.spec create mode 100644 t/data/SPECS/kernel-1/virtualbox-kernel-desktop3.spec create mode 100644 t/data/SPECS/kernel-1/virtualbox-kernel-desktop4.spec create mode 100644 t/data/SPECS/kernel-1/virtualbox-kernel-desktop5.spec create mode 100644 t/data/SPECS/kernel-2/virtualbox-kernel-desktop1.spec create mode 100644 t/data/SPECS/kernel-2/virtualbox-kernel-desktop2.spec create mode 100644 t/data/SPECS/kernel-2/virtualbox-kernel-desktop3.spec create mode 100644 t/data/SPECS/kernel-2/virtualbox-kernel-desktop4.spec create mode 100644 t/data/SPECS/kernel-2/virtualbox-kernel-desktop5.spec 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/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/superuser--orphans-kernels.t b/t/superuser--orphans-kernels.t index f101f1f5..4fe25d43 100644 --- a/t/superuser--orphans-kernels.t +++ b/t/superuser--orphans-kernels.t @@ -5,12 +5,15 @@ 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"); @@ -22,14 +25,26 @@ 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'; - $o_pkg2 ||= "kernel-desktop-${base_kversion}5-1.mga8"; + 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"; - urpmi("--media $medium --auto $pkg-${base_kversion}$_-1") foreach 1..4; - urpmi("--media $medium --auto $pkg"); + 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"); - check_installed_and_remove($pkg, $o_pkg2); + $o_pkg2 ||= $latest_kpkg; + $o_pkg2 =~ s/-latest//; + check_installed_and_remove($pkg, 'virtualbox-kernel-desktop-latest', $o_pkg2, $latest_dkms_dep); } -- cgit v1.2.1 From 7d0ced8cbb1a311f20ce65a1e3e9b23130d93d81 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 10 Dec 2022 13:46:22 +0100 Subject: Workaround removing real life kernels Rationale: testsuite didn't covered the "kmod(vboxdrv.ko)" provides. So we were skipping eg virtualbox-kernel-6.0.9-desktop-1.mga9 because it provided "kmod(vboxdrv.ko)[== 7.0.4]" which was needed because virtualbox-7.0.4-1.mga9.x86_64 requires "kmod(vboxdrv.ko)" We need a better fix as in check if a (non orphaned) pkg still provides the property instead. --- urpm/orphans.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/urpm/orphans.pm b/urpm/orphans.pm index 11bd555e..aea64fb4 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -544,6 +544,9 @@ sub _all_unrequested_orphans { foreach my $prop ($pkg->requires, $pkg->recommends_nosense) { my $n = URPM::property2name($prop); foreach my $p (@{$provides{$n} || []}) { + # 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}; -- cgit v1.2.1 From 7321a3e402dee08caccfa24ffb70f0ee6fa3db65 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 13 Apr 2023 22:14:41 +0200 Subject: 8.131 --- Changes | 2 ++ urpm.pm | 2 +- urpmi.pm | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 7b7f3aab..008ea018 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +Version 8.131 - 13 April 2023 + - urpmi: o Fix --auto-orphans vs new kernel naming (having multuple "kernel" pkgs with different versions) 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/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; -- cgit v1.2.1