Skip to content

Commit

Permalink
Don't fail when package is provided by multiple repos
Browse files Browse the repository at this point in the history
This is fuzzy, but let's pick the first available repo and produce
warning in such case.  Better ideas are welcome!
  • Loading branch information
praiskup committed Jul 31, 2019
1 parent 4d59f99 commit 1743ef0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dnf-plugins/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ def _download_packages(self, to_download):
subj = dnf.subject.Subject(pkg_spec)

q = subj.get_best_query(self.base.sack).available().latest()
if not list(q):
sources = list(q)
if not sources:
logger.warning(_("package {0} not available in repos, trying local cache".format(pkg_spec)))
else:
pkg_list.extend(list(q))
continue

if len(sources) > 1:
logger.warning(_("package %s is in multiple repositories"), pkg_spec)

pkg_list.extend(sources[:1])

self.base.download_packages(pkg_list)

Expand Down

0 comments on commit 1743ef0

Please sign in to comment.