Skip to content

Commit

Permalink
Reset the dnf base when clearing cache
Browse files Browse the repository at this point in the history
To reset the repo sack, the whole base must be created anew, because it
is not possible to lead repositories multiple times in dnf5.
  • Loading branch information
pkratoch committed Nov 12, 2024
1 parent d4c82a7 commit a428b7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pyanaconda/modules/payloads/payload/dnf/dnf_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,7 @@ def clear_cache(self):
shutil.rmtree(DNF_CACHE_DIR, ignore_errors=True)
shutil.rmtree(DNF_PLUGINCONF_DIR, ignore_errors=True)

# FIXME: Reset sacks. Should we just drop the base?
# self._base.reset(sack=True, repos=True, goal=True)
self.reset_base()

log.debug("The DNF cache has been cleared.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,10 +995,10 @@ def test_read_system_repositories(self):
with pytest.raises(RuntimeError):
self.dnf_manager.read_system_repositories()

# FIXME: Unless we cleared the cache.
# self.dnf_manager.clear_cache()
# assert not self.dnf_manager._enabled_system_repositories
# self.dnf_manager.read_system_repositories()
# Unless we cleared the cache.
self.dnf_manager.clear_cache()
assert not self.dnf_manager._enabled_system_repositories
self.dnf_manager.read_system_repositories()

# Or reset the base.
self.dnf_manager.reset_base()
Expand Down

0 comments on commit a428b7f

Please sign in to comment.