Skip to content

Commit 1743ef0

Browse files
committed
Don't fail when package is provided by multiple repos
This is fuzzy, but let's pick the first available repo and produce warning in such case. Better ideas are welcome!
1 parent 4d59f99 commit 1743ef0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

dnf-plugins/diff.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,15 @@ def _download_packages(self, to_download):
9797
subj = dnf.subject.Subject(pkg_spec)
9898

9999
q = subj.get_best_query(self.base.sack).available().latest()
100-
if not list(q):
100+
sources = list(q)
101+
if not sources:
101102
logger.warning(_("package {0} not available in repos, trying local cache".format(pkg_spec)))
102-
else:
103-
pkg_list.extend(list(q))
103+
continue
104+
105+
if len(sources) > 1:
106+
logger.warning(_("package %s is in multiple repositories"), pkg_spec)
107+
108+
pkg_list.extend(sources[:1])
104109

105110
self.base.download_packages(pkg_list)
106111

0 commit comments

Comments
 (0)