Skip to content

Commit

Permalink
reposync: Avoid multiple downloads of duplicate packages
Browse files Browse the repository at this point in the history
Download each package only once if it would have been saved to the same
location. This can occur if the repository metadata contains duplicate
entries for the same package.

Resolves: https://issues.redhat.com/browse/RHEL-64320
  • Loading branch information
m-blaha committed Nov 4, 2024
1 parent bc50a84 commit 20fce57
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/reposync.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,15 @@ def get_pkglist(self, repo):
query.filterm(arch='src')
elif self.opts.arches:
query.filterm(arch=self.opts.arches)
return query
# skip packages that would have been downloaded to the same location
pkglist = []
seen_paths = set()
for pkg in query:
download_path = self.pkg_download_path(pkg)
if download_path not in seen_paths:
pkglist.append(pkg)
seen_paths.add(download_path)
return pkglist

def download_packages(self, pkglist):
base = self.base
Expand Down

0 comments on commit 20fce57

Please sign in to comment.