Skip to content

Commit

Permalink
Set the destdir option
Browse files Browse the repository at this point in the history
  • Loading branch information
pkratoch committed Sep 24, 2024
1 parent 54457f7 commit fca17eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 11 additions & 5 deletions pyanaconda/modules/payloads/payload/dnf/dnf_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit fca17eb

Please sign in to comment.