reposync: Avoid multiple downloads of duplicate packages

Upstream commit: 17e36ed
Resolves: RHEL-82849
This commit is contained in:
Marek Blaha 2025-03-20 09:21:48 +01:00
parent f51fac7f6e
commit 649615584f
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From c54f4f151db68f88b411f7d3b625955190a4a232 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
Resolves: https://issues.redhat.com/browse/RHEL-82849
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 63d8e98..2e23a7e 100644
--- a/plugins/reposync.py
+++ b/plugins/reposync.py
@@ -305,7 +305,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

View File

@ -42,7 +42,7 @@
Name: dnf-plugins-core
Version: 4.7.0
Release: 8%{?dist}
Release: 9%{?dist}
Summary: Core Plugins for DNF
License: GPL-2.0-or-later
URL: https://github.com/rpm-software-management/dnf-plugins-core
@ -56,6 +56,8 @@ Patch6: 0006-needs-restarting-Add-exclude-services.patch
Patch7: 0007-needs-restarting-Add-exclude-services-to-man-page.patch
Patch8: 0008-needs-restarting-Get-boot-time-from-systemd-UnitsLoa.patch
Patch9: 0009-doc-needs-restarting-uses-UnitsLoadStartTimestamp-bo.patch
Patch10: 0010-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch
BuildArch: noarch
BuildRequires: cmake
BuildRequires: gettext
@ -886,6 +888,9 @@ ln -sf %{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/man1/repotrack.1
%endif
%changelog
* Thu Mar 20 2025 Marek Blaha <mblaha@redhat.com> - 4.7.0-9
- reposync: Avoid multiple downloads of duplicate packages (RHEL-82849)
* Thu Jan 23 2025 Evan Goode <egoode@redhat.com> - 4.7.0-8
- needs-restarting: Get boot time from systemd UnitsLoadStartTimestamp
(RHEL-35577)