Blame SOURCES/0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch

2a0a3f
From 9ce65d8575494887a08506583d9d4f05df404fac Mon Sep 17 00:00:00 2001
2a0a3f
From: Jaroslav Rohel <jrohel@redhat.com>
2a0a3f
Date: Wed, 20 Oct 2021 09:20:03 +0200
2a0a3f
Subject: [PATCH] Fix: Python dnf API does not respect cacheonly (RhBug:1862970)
2a0a3f
2a0a3f
`Repo` object has always been constructed with default synchronization
2a0a3f
strategy. The configuration option `cacheonly` was ignored. DNF
2a0a3f
application set synchronization strategy later in the `Cli` object
2a0a3f
during processing demands.
2a0a3f
2a0a3f
The fix takes into account the `cacheonly` option during the construction
2a0a3f
of the `Repo` object. Synchronization strategy may still be overriden
2a0a3f
during demand processing.
2a0a3f
---
2a0a3f
 dnf/repo.py | 2 +-
2a0a3f
 1 file changed, 1 insertion(+), 1 deletion(-)
2a0a3f
2a0a3f
diff --git a/dnf/repo.py b/dnf/repo.py
2a0a3f
index bb42230..1822cf0 100644
2a0a3f
--- a/dnf/repo.py
2a0a3f
+++ b/dnf/repo.py
2a0a3f
@@ -434,7 +434,7 @@ class Repo(dnf.conf.RepoConf):
2a0a3f
         self._pkgdir = None
2a0a3f
         self._key_import = _NullKeyImport()
2a0a3f
         self.metadata = None  # :api
2a0a3f
-        self._repo.setSyncStrategy(self.DEFAULT_SYNC)
2a0a3f
+        self._repo.setSyncStrategy(SYNC_ONLY_CACHE if parent_conf and parent_conf.cacheonly else self.DEFAULT_SYNC)
2a0a3f
         if parent_conf:
2a0a3f
             self._repo.setSubstitutions(parent_conf.substitutions)
2a0a3f
         self._substitutions = dnf.conf.substitutions.Substitutions()
2a0a3f
--
2a0a3f
libgit2 1.1.0
2a0a3f