dnf-plugins-core/SOURCES/0022-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch

41 lines
1.3 KiB
Diff

From 43d07e2b385b069b1f851e5a16f1b7d8bbed1195 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
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
Upstream commit: 17e36ed
---
plugins/reposync.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/plugins/reposync.py b/plugins/reposync.py
index ab513e7..19f5440 100644
--- a/plugins/reposync.py
+++ b/plugins/reposync.py
@@ -292,7 +292,15 @@ class RepoSyncCommand(dnf.cli.Command):
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
--
2.48.1