reposync: Avoid multiple downloads of duplicate packages

Upstream commit: 17e36ed
Resolves: RHEL-64320
This commit is contained in:
Marek Blaha 2025-03-11 16:35:29 +01:00
parent 027e70a437
commit 8fb951c944
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,40 @@
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

View File

@ -34,7 +34,7 @@
Name: dnf-plugins-core
Version: 4.3.0
Release: 20%{?dist}
Release: 21%{?dist}
Summary: Core Plugins for DNF
License: GPLv2+
URL: https://github.com/rpm-software-management/dnf-plugins-core
@ -57,6 +57,7 @@ Patch18: 0018-system-upgrade-change-http-to-https-in-unit-file.patch
Patch19: 0019-reposync-Respect-norepopath-with-metadata-path.patch
Patch20: 0020-needs-restarting-Get-boot-time-from-systemd-UnitsLoa.patch
Patch21: 0021-dnf-copr-enable-on-Asahi-Fedora-Linux-Remix-guesses.patch
Patch22: 0022-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch
BuildArch: noarch
BuildRequires: cmake
@ -804,6 +805,10 @@ ln -sf %{_mandir}/man1/%{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/
%endif
%changelog
* Tue Mar 11 2025 Marek Blaha <mblaha@redhat.com> - 4.3.0-21
- reposync: Avoid multiple downloads of duplicate packages (RHEL-64320)
- Fix bogus changelog entry date
* Mon Dec 16 2024 Jan Kolarik <jkolarik@redhat.com> - 4.3.0-20
- Add forgotten changelog
@ -865,7 +870,7 @@ ln -sf %{_mandir}/man1/%{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/
* Thu Jan 05 2023 Nicola Sella <nsella@redhat.com> - 4.3.0-3
- Remove requirement of python3-distro
* Wed Dec 03 2022 Nicola Sella <nsella@redhat.com> - 4.3.0-2
* Sat Dec 03 2022 Nicola Sella <nsella@redhat.com> - 4.3.0-2
- Move system-upgrade plugin to core (RhBug:2054235)
- offline-upgrade: add support for security filters (RhBug:1939975)