diff --git a/meta_package_manager/managers/dnf.py b/meta_package_manager/managers/dnf.py index 8f5dc32f6..77357797d 100644 --- a/meta_package_manager/managers/dnf.py +++ b/meta_package_manager/managers/dnf.py @@ -40,7 +40,7 @@ class DNF(PackageManager): requirement = "4.0.0" - cli_names = ("dnf",) + cli_names = ("dnf4",) """ .. code-block:: shell-session @@ -65,12 +65,15 @@ def installed(self) -> Iterator[Package]: audit-libs 2.2.53-1.el8 audit_libs_dummary x86_64 (...) """ - qf = ["%{name}", "%{version}", "%{summary}", "%{arch}"] + qf = ["%{name}", "%{version}", "%{summary}", "%{arch}\n"] output = self.run_cli( "repoquery", "--userinstalled", "--qf", DNF.DELIMITER.join(qf) ) for line_package in output.splitlines(): + # remove empty new line + if not line_package: + continue package_id, installed_version, summary, arch = line_package.split( DNF.DELIMITER ) @@ -94,10 +97,13 @@ def outdated(self) -> Iterator[Package]: audit-libs 2.2.53-1.el8 2.6.53-1.el8 audit_libs_dummary x86_64 (...) """ - qf = ["%{name}", "%{version}", "%{evr}", "%{summary}", "%{arch}"] + qf = ["%{name}", "%{version}", "%{evr}", "%{summary}", "%{arch}\n"] output = self.run_cli("repoquery", "--upgrades", "--qf", DNF.DELIMITER.join(qf)) for line_package in output.splitlines(): + # remove empty new line + if not line_package: + continue package_id, installed_version, last_version, summary, arch = ( line_package.split(DNF.DELIMITER) ) @@ -213,6 +219,13 @@ def remove(self, package_id: str) -> str: return self.run_cli("--assumeyes", "autoremove", package_id, sudo=True) +class DNF5(DNF): + homepage_url = "https://github.com/rpm-software-management/dnf5" + requirement = "5.0.0" + cli_names = ("dnf5",) + pre_args = () + + class YUM(DNF): """Yum is dnf is yum.""" diff --git a/meta_package_manager/pool.py b/meta_package_manager/pool.py index d43f96614..7c104d741 100644 --- a/meta_package_manager/pool.py +++ b/meta_package_manager/pool.py @@ -31,7 +31,7 @@ from .managers.cargo import Cargo from .managers.chocolatey import Choco from .managers.composer import Composer -from .managers.dnf import DNF, YUM +from .managers.dnf import DNF, DNF5, YUM from .managers.emerge import Emerge from .managers.flatpak import Flatpak from .managers.gem import Gem @@ -65,6 +65,7 @@ Choco, Composer, DNF, + DNF5, Emerge, Flatpak, Gem,