From 20fce57b8a3ed04a5f4cd2310f8914e5ea046a4c Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Mon, 4 Nov 2024 10:35:08 +0100 Subject: [PATCH] reposync: Avoid multiple downloads of duplicate packages 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 --- plugins/reposync.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/reposync.py b/plugins/reposync.py index bd1477d3..385df017 100644 --- a/plugins/reposync.py +++ b/plugins/reposync.py @@ -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