From 8fb951c944966ea4269e88766bf9b1f5f24a46ca Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Tue, 11 Mar 2025 16:35:29 +0100 Subject: [PATCH] reposync: Avoid multiple downloads of duplicate packages Upstream commit: 17e36ed Resolves: RHEL-64320 --- ...ultiple-downloads-of-duplicate-packa.patch | 40 +++++++++++++++++++ dnf-plugins-core.spec | 9 ++++- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 0022-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch diff --git a/0022-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch b/0022-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch new file mode 100644 index 0000000..c662219 --- /dev/null +++ b/0022-reposync-Avoid-multiple-downloads-of-duplicate-packa.patch @@ -0,0 +1,40 @@ +From 43d07e2b385b069b1f851e5a16f1b7d8bbed1195 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 + +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 + diff --git a/dnf-plugins-core.spec b/dnf-plugins-core.spec index b2c4b94..36ba22e 100644 --- a/dnf-plugins-core.spec +++ b/dnf-plugins-core.spec @@ -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 - 4.3.0-21 +- reposync: Avoid multiple downloads of duplicate packages (RHEL-64320) +- Fix bogus changelog entry date + * Mon Dec 16 2024 Jan Kolarik - 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 - 4.3.0-3 - Remove requirement of python3-distro -* Wed Dec 03 2022 Nicola Sella - 4.3.0-2 +* Sat Dec 03 2022 Nicola Sella - 4.3.0-2 - Move system-upgrade plugin to core (RhBug:2054235) - offline-upgrade: add support for security filters (RhBug:1939975)