diff --git a/backport-Allow-local-downloads-to-same-downloaddir.patch b/backport-Allow-local-downloads-to-same-downloaddir.patch new file mode 100644 index 0000000..d681c08 --- /dev/null +++ b/backport-Allow-local-downloads-to-same-downloaddir.patch @@ -0,0 +1,33 @@ +From dee3952a8c19d733b7c5b1d854b1ccde947d770d Mon Sep 17 00:00:00 2001 +From: Nic <138107617+nicbadiu@users.noreply.github.com> +Date: Fri, 28 Jun 2024 12:56:34 +0300 +Subject: [PATCH] Allow local downloads to same `downloaddir` + +Currently when `dnf download --downloaddir ` sources`` from `` it triggers a `shutil.SameFileError` exception and aborts the entire download process. + +This goes against the current flow which marks locally present RPMs that match a remote RPM as `[SKIPPED] .rpm: Already downloaded`. + +This change allows downloads of locally sourced packages to the same file, treating it as a no-op. +--- + dnf/base.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/dnf/base.py b/dnf/base.py +index dac3cefd..c1affc8c 100644 +--- a/dnf/base.py ++++ b/dnf/base.py +@@ -1320,7 +1320,10 @@ class Base(object): + pkg.location.lstrip("/")) + else: + location = os.path.join(pkg.repo.pkgdir, pkg.location.lstrip("/")) +- shutil.copy(location, self.conf.destdir) ++ try: ++ shutil.copy(location, self.conf.destdir) ++ except shutil.SameFileError: ++ pass + + def add_remote_rpms(self, path_list, strict=True, progress=None): + # :api +-- +2.27.0 + diff --git a/dnf.spec b/dnf.spec index 9c60ffe..9b1120d 100644 --- a/dnf.spec +++ b/dnf.spec @@ -3,7 +3,7 @@ Name: dnf Version: 4.16.2 -Release: 6 +Release: 7 Summary: A software package manager that manages packages on Linux distributions. License: GPL-2.0-or-later AND GPL-1.0-only URL: https://github.com/rpm-software-management/dnf @@ -31,6 +31,7 @@ Patch6005: backport-Add-all-candidates-for-reinstall-to-solver.patch Patch6006: backport-Limit-queries-to-nevra-forms-when-provided-by-command.patch Patch6007: backport-doc-Remove-provide-of-spec-definition-for-repoquery-command.patch Patch6008: backport-Update-the-man-page-entry-for-the-countme-option.patch +Patch6009: backport-Allow-local-downloads-to-same-downloaddir.patch BuildArch: noarch BuildRequires: cmake gettext systemd bash-completion python3-sphinx @@ -258,6 +259,9 @@ popd %{_mandir}/man8/%{name}-automatic.8* %changelog +* Mon Sep 9 2024 zhangzikang - 4.16.2-7 +- Allow local downloads to same downloaddir + * Wed Aug 14 2024 Funda Wang - 4.16.2-6 - Drop wrong obsolete tag