From fca17eb1c2bd647d4f057a17d4d4436e1935dad9 Mon Sep 17 00:00:00 2001 From: Pavla Kratochvilova Date: Mon, 23 Sep 2024 09:06:08 +0200 Subject: [PATCH] Set the destdir option --- .../modules/payloads/payload/dnf/dnf_manager.py | 16 +++++++++++----- .../payload/test_module_payload_dnf5_manager.py | 10 ++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py b/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py index 2d912f61762..4f92d42abf9 100644 --- a/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py +++ b/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py @@ -116,6 +116,14 @@ def cost(self): def cost(self, value): self._config.get_cost_option().set(value) + @property + def destdir(self): + return self._config.get_destdir_option().get_value() + + @destdir.setter + def destdir(self, value): + self._config.get_destdir_option().set(value) + @property def excludepkgs(self): return self._config.get_excludepkgs_option().get_value() @@ -855,9 +863,8 @@ def set_download_location(self, path): :param path: a path to the package directory """ - # FIXME: Reimplement the assignment. - # for repo in self._base.repos.iter_enabled(): - # repo.pkgdir = path + config = simplify_config(self._base.get_config()) + config.destdir = path self._download_location = path @@ -877,8 +884,7 @@ def download_packages(self, callback): destination = self.download_location for package in packages: - #downloader.add(package, destination) - downloader.add(package) + downloader.add(package, destination) downloader.set_fail_fast(True) downloader.set_resume(False) diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf5_manager.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf5_manager.py index a989edbf5e1..bbe3141a76f 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf5_manager.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf5_manager.py @@ -554,18 +554,12 @@ def _install_packages_failed(self, base, transaction, progress): """Simulate the failed installation of packages.""" progress.error("The p1 package couldn't be installed!") - @pytest.mark.skip("Not implemented") def test_set_download_location(self): """Test the set_download_location method.""" - r1 = self._add_repo("r1") - r2 = self._add_repo("r2") - r3 = self._add_repo("r3") - self.dnf_manager.set_download_location("/my/download/location") - assert r1.pkgdir == "/my/download/location" - assert r2.pkgdir == "/my/download/location" - assert r3.pkgdir == "/my/download/location" + config = simplify_config(self.dnf_manager._base.get_config()) + assert config.destdir == "/my/download/location" def test_download_location(self): """Test the download_location property."""