Skip to content

Commit fca17eb

Browse files
committed
Set the destdir option
1 parent 54457f7 commit fca17eb

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

pyanaconda/modules/payloads/payload/dnf/dnf_manager.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ def cost(self):
116116
def cost(self, value):
117117
self._config.get_cost_option().set(value)
118118

119+
@property
120+
def destdir(self):
121+
return self._config.get_destdir_option().get_value()
122+
123+
@destdir.setter
124+
def destdir(self, value):
125+
self._config.get_destdir_option().set(value)
126+
119127
@property
120128
def excludepkgs(self):
121129
return self._config.get_excludepkgs_option().get_value()
@@ -855,9 +863,8 @@ def set_download_location(self, path):
855863
856864
:param path: a path to the package directory
857865
"""
858-
# FIXME: Reimplement the assignment.
859-
# for repo in self._base.repos.iter_enabled():
860-
# repo.pkgdir = path
866+
config = simplify_config(self._base.get_config())
867+
config.destdir = path
861868

862869
self._download_location = path
863870

@@ -877,8 +884,7 @@ def download_packages(self, callback):
877884
destination = self.download_location
878885

879886
for package in packages:
880-
#downloader.add(package, destination)
881-
downloader.add(package)
887+
downloader.add(package, destination)
882888

883889
downloader.set_fail_fast(True)
884890
downloader.set_resume(False)

tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf5_manager.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -554,18 +554,12 @@ def _install_packages_failed(self, base, transaction, progress):
554554
"""Simulate the failed installation of packages."""
555555
progress.error("The p1 package couldn't be installed!")
556556

557-
@pytest.mark.skip("Not implemented")
558557
def test_set_download_location(self):
559558
"""Test the set_download_location method."""
560-
r1 = self._add_repo("r1")
561-
r2 = self._add_repo("r2")
562-
r3 = self._add_repo("r3")
563-
564559
self.dnf_manager.set_download_location("/my/download/location")
565560

566-
assert r1.pkgdir == "/my/download/location"
567-
assert r2.pkgdir == "/my/download/location"
568-
assert r3.pkgdir == "/my/download/location"
561+
config = simplify_config(self.dnf_manager._base.get_config())
562+
assert config.destdir == "/my/download/location"
569563

570564
def test_download_location(self):
571565
"""Test the download_location property."""

0 commit comments

Comments
 (0)