Backport patch to fix compat with latest dnf5

This commit is contained in:
Maxwell G 2023-07-03 17:23:00 +00:00
parent da750bb373
commit b7db1fa79b
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8
2 changed files with 56 additions and 0 deletions

View File

@ -22,6 +22,9 @@ Source0: https://github.com/ansible/ansible/archive/v%{uversion}/%{name}-%{uvers
Source1: build_manpages.py Source1: build_manpages.py
Patch: https://github.com/ansible/ansible/commit/734f38b2594692707d1fd3cbcfc8dc8a677f4ee3.patch#/GALAXY_COLLECTIONS_PATH_WARNINGS.patch Patch: https://github.com/ansible/ansible/commit/734f38b2594692707d1fd3cbcfc8dc8a677f4ee3.patch#/GALAXY_COLLECTIONS_PATH_WARNINGS.patch
# Fix compat with latest python3-libdnf5
# dnf5: enable now implemented cacheonly functionality (#81141)
Patch: https://github.com/ansible/ansible/commit/0cc50e067346c357c5177677fba41993950ff044.patch#/dnf5-enable-cacheonly-functionality.patch
# These patches are only applied on Rawhide to enable support for Python 3.12 # These patches are only applied on Rawhide to enable support for Python 3.12
# See https://bugzilla.redhat.com/2196539 # See https://bugzilla.redhat.com/2196539
# #

View File

@ -0,0 +1,53 @@
From 0cc50e067346c357c5177677fba41993950ff044 Mon Sep 17 00:00:00 2001
From: Martin Krizek <martin.krizek@gmail.com>
Date: Wed, 28 Jun 2023 16:05:59 +0200
Subject: [PATCH] dnf5: enable now implemented cacheonly functionality (#81141)
Note that this also fixes a traceback caused by backwards incompatible
change in dnf5 where cacheonly was changed from bool to string:
https://github.com/rpm-software-management/dnf5/pull/665/files#diff-ab65249ff7fccadfb2864b6826f6559f7f16fad43fd3bf2da0b4fe8db790d59aR179
---
changelogs/fragments/dnf5-cacheonly.yml | 2 ++
lib/ansible/modules/dnf5.py | 3 +--
test/integration/targets/dnf/tasks/main.yml | 1 -
3 files changed, 3 insertions(+), 3 deletions(-)
create mode 100644 changelogs/fragments/dnf5-cacheonly.yml
diff --git a/changelogs/fragments/dnf5-cacheonly.yml b/changelogs/fragments/dnf5-cacheonly.yml
new file mode 100644
index 00000000000000..b7e2d753fb23dc
--- /dev/null
+++ b/changelogs/fragments/dnf5-cacheonly.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - dnf5 - enable now implemented ``cacheonly`` functionality
diff --git a/lib/ansible/modules/dnf5.py b/lib/ansible/modules/dnf5.py
index 362a9a3d804f52..f1653881bea3e3 100644
--- a/lib/ansible/modules/dnf5.py
+++ b/lib/ansible/modules/dnf5.py
@@ -215,7 +215,6 @@
default: "no"
cacheonly:
description:
- - This is currently no-op as dnf5 does not implement the feature.
- Tells dnf to run entirely from system cache; does not download or update metadata.
type: bool
default: "no"
@@ -512,7 +511,7 @@ def run(self):
conf.clean_requirements_on_remove = self.autoremove
conf.installroot = self.installroot
conf.use_host_config = True # needed for installroot
- conf.cacheonly = self.cacheonly
+ conf.cacheonly = "all" if self.cacheonly else "none"
if self.download_dir:
conf.destdir = self.download_dir
diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml
index b84e3389bcf1ca..059bf747c9a31e 100644
--- a/test/integration/targets/dnf/tasks/main.yml
+++ b/test/integration/targets/dnf/tasks/main.yml
@@ -74,4 +74,3 @@
when:
- (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
(ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>='))
- - not dnf5|default('false')