rpm-software-management / dnf5

Next-generation RPM package management system
Other
258 stars 87 forks source link

Bugs in dnf versionlock makes it unusable #1895

Open scaronni opened 2 days ago

scaronni commented 2 days ago

The plugin versionlock does not work properly. Taking into account the differences compared to the DNF4 plugin, it still does not behave correctly.

At Nvidia we're trying to get away from packages with the branch name in the actual package name and would like to switch to standard tools for doing branch locking. It works fine in DNF4, it does not in DNF5.

First issue: automatic filtering. Test is done on the same repository.

DNF4:

# dnf versionlock add \*nvidia\*565\*
Last metadata expiration check: 2:08:07 ago on Sun 24 Nov 2024 09:19:13 AM CET.
Adding versionlock on: nvidia-persistenced-3:565.57.01-1.fc40.*
Adding versionlock on: nvidia-driver-3:565.57.01-4.fc40.*
Adding versionlock on: nvidia-settings-3:565.57.01-1.fc40.*
Adding versionlock on: compat-nvidia-repo-3:565.57.01-2.fc40.*
Adding versionlock on: akmod-nvidia-3:565.57.01-1.fc40.*
Adding versionlock on: nvidia-driver-cuda-3:565.57.01-4.fc40.*
Adding versionlock on: nvidia-xconfig-3:565.57.01-1.fc40.*
Adding versionlock on: nvidia-kmod-common-3:565.57.01-2.fc40.*
Adding versionlock on: nvidia-libXNVCtrl-devel-3:565.57.01-1.fc40.*
Adding versionlock on: kmod-nvidia-3:565.57.01-1.fc40.*
Adding versionlock on: xorg-x11-nvidia-3:565.57.01-4.fc40.*
Adding versionlock on: libnvidia-fbc-3:565.57.01-4.fc40.*
Adding versionlock on: nvidia-libXNVCtrl-3:565.57.01-1.fc40.*
Adding versionlock on: libnvidia-cfg-3:565.57.01-4.fc40.*
Adding versionlock on: dkms-nvidia-3:565.57.01-1.fc40.*
Adding versionlock on: nvidia-driver-libs-3:565.57.01-4.fc40.*
Adding versionlock on: libnvidia-ml-3:565.57.01-4.fc40.*
Adding versionlock on: nvidia-driver-cuda-libs-3:565.57.01-4.fc40.*
Adding versionlock on: nvidia-modprobe-3:565.57.01-1.fc40.*

Then I can edit the versionlock.list file very simply by moving wildcards back and forth (ex. to keep stuff on the 565 branch).

DNF5:

# dnf versionlock add \*nvidia\*565\*
Updating and loading repositories:
Repositories loaded.
Adding versionlock on "dkms-nvidia = 3:565.57.01-1.fc41".
Adding versionlock on "libnvidia-cfg = 3:565.57.01-4.fc41".
Adding versionlock on "nvidia-kmod-common = 3:565.57.01-2.fc41".

On DNF5 it's not picking all the packages, I can't figure out what is the logic that is being applied for the wildcard selection, it seems pretty random.

Second issue: editing the file. According to the man page, the /etc/dnf/versionlock.toml accepts various keys in the key field:

# keep package bash on version 0:5.2.15-5.fc39
[[packages]]
name = "bash"               # name of the package
comment = "description"     # optional description of the entry
[[packages.conditions]]     # conditions for the package "bash"
key = "evr"                 # epoch, version, evr, and arch keys are supported
comparator = "="            # <, <=, =, >=, >, and != operators are supported
value = "0:5.2.15-5.fc39"   # pattern to match

But actually none of those is supported, so I can't say for example pick anything which has the 565 version:

# cat /etc/dnf/versionlock.toml 
version = "1.0"

[[packages]]
name = "nvidia-driver"

[[packages.conditions]]
key = "version"
comparator = ">="
value = "565"
[[packages.conditions]]
key = "version"
comparator = "<"
value = "570"
# dnf versionlock list
Package name: nvidia-driver
version >= 565 # invalid condition key "version"
version < 570 # invalid condition key "version"
scaronni commented 2 days ago

For the second case, I can make it work like this, but it requires also the epoch and is not like the man page describes:

version = "1.0"

[[packages]]
name = "nvidia-driver"

[[packages.conditions]]
key = "evr"
comparator = ">="
value = "3:565"
[[packages.conditions]]
key = "evr"
comparator = "<"
value = "3:570"