Skip to content

Commit

Permalink
qvm-template: fix handling repos with just baseurl set
Browse files Browse the repository at this point in the history
pkg.repo._repo.getMirrors() returns only mirrors from metalink, if there
is none, the return is empty list. Fix this by falling back to
pkg.remote_location() that handles also baseurl.

Fixes QubesOS/qubes-issues#8299
  • Loading branch information
marmarek committed Jun 27, 2023
1 parent 8da85a7 commit 7a0c7d4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions package-managers/dnf-plugin-downloadurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,18 @@ def schemes_filter(url_list):
for pkg in pkgs:
# command line repo packages do not have .remote_location
if pkg.repoid != hawkey.CMDLINE_REPO_NAME:
mirrors = []
if self.opts.all_mirrors:
schemas = self.opts.urlprotocols
# pylint: disable=protected-access
for mirror in pkg.repo._repo.getMirrors():
mirrors = pkg.repo._repo.getMirrors()
for mirror in mirrors:
if schemas:
if urllib.parse.urlparse(mirror)[0] not in schemas:
continue
print(os.path.join(mirror, pkg.location.lstrip('/')))
else:
# either not self.opts.all_mirrors, or no metalink was set
if not mirrors:
url = pkg.remote_location(schemes=self.opts.urlprotocols)
if url:
print(url)
Expand Down

0 comments on commit 7a0c7d4

Please sign in to comment.