[packages] Add a DNF5 PM backend

I just made this up, checked that the `dnf5` command
in Fedora 39 exists and can run the command-lines
created by this PM backend. (I did install dnf5 into
that Fedora 39 system first)
This commit is contained in:
Adriaan de Groot 2024-02-20 13:54:45 +01:00
parent 54265f87b1
commit 8a5876410e
3 changed files with 31 additions and 0 deletions

View File

@ -279,6 +279,11 @@ class PMApt(PackageManager):
class PMDnf(PackageManager): class PMDnf(PackageManager):
"""
This is "legacy" DNF, called DNF-4 even though the
executable is dnf-3 in modern Fedora. Executable dnf
is a symlink to dnf-3 in systems that use it.
"""
backend = "dnf" backend = "dnf"
def install(self, pkgs, from_local=False): def install(self, pkgs, from_local=False):
@ -298,6 +303,30 @@ class PMDnf(PackageManager):
check_target_env_call(["dnf-3", "-y", "upgrade"]) check_target_env_call(["dnf-3", "-y", "upgrade"])
class PMDnf5(PackageManager):
"""
This is "modern" DNF, DNF-5 which is for Fedora 41 (presumably)
and later. Executable dnf is a symlink to dnf5 in systems that use it.
"""
backend = "dnf5"
def install(self, pkgs, from_local=False):
check_target_env_call(["dnf5", "-y", "install"] + pkgs)
def remove(self, pkgs):
# ignore the error code for now because dnf thinks removing a
# nonexistent package is an error
target_env_call(["dnf5", "--disablerepo=*", "-C", "-y",
"remove"] + pkgs)
def update_db(self):
# Doesn't need updates
pass
def update_system(self):
check_target_env_call(["dnf5", "-y", "upgrade"])
class PMDummy(PackageManager): class PMDummy(PackageManager):
backend = "dummy" backend = "dummy"

View File

@ -23,6 +23,7 @@
# - apk - Alpine Linux package manager # - apk - Alpine Linux package manager
# - apt - APT frontend for DEB and RPM # - apt - APT frontend for DEB and RPM
# - dnf - DNF, the new RPM frontend # - dnf - DNF, the new RPM frontend
# - dnf5 - DNF5, the newer new RPM frontend
# - entropy - Sabayon package manager (is being deprecated) # - entropy - Sabayon package manager (is being deprecated)
# - luet - Sabayon package manager (next-gen) # - luet - Sabayon package manager (next-gen)
# - packagekit - PackageKit CLI tool # - packagekit - PackageKit CLI tool

View File

@ -12,6 +12,7 @@ properties:
- apk - apk
- apt - apt
- dnf - dnf
- dnf5
- entropy - entropy
- luet - luet
- packagekit - packagekit