From 39b04e98fd7c862c9e070a46b79772fa47dc3371 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Wed, 6 Oct 2021 09:56:05 +0200
Subject: [PATCH] Add fail_fast parameter to download_payloads methods

Unlike in the rpm transaction, reposync needs to switch the fail_fast
off to download as much packages from repository as possible.
---
 dnf/base.py | 6 +++---
 dnf/repo.py | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dnf/base.py b/dnf/base.py
index e1aa2bd..f2b9c55 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -1059,7 +1059,7 @@ class Base(object):
         timer()
         self._trans_success = True
 
-    def _download_remote_payloads(self, payloads, drpm, progress, callback_total):
+    def _download_remote_payloads(self, payloads, drpm, progress, callback_total, fail_fast=True):
         lock = dnf.lock.build_download_lock(self.conf.cachedir, self.conf.exit_on_lock)
         with lock:
             beg_download = time.time()
@@ -1071,7 +1071,7 @@ class Base(object):
                 progress.start(len(payloads), est_remote_size, total_drpms=total_drpm)
             else:
                 progress.start(len(payloads), est_remote_size)
-            errors = dnf.repo._download_payloads(payloads, drpm)
+            errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
 
             if errors._irrecoverable:
                 raise dnf.exceptions.DownloadError(errors._irrecoverable)
@@ -1097,7 +1097,7 @@ class Base(object):
                 est_remote_size = sum(pload.download_size
                                       for pload in payloads)
                 progress.start(len(payloads), est_remote_size)
-                errors = dnf.repo._download_payloads(payloads, drpm)
+                errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
 
                 if errors._irrecoverable:
                     raise dnf.exceptions.DownloadError(errors._irrecoverable)
diff --git a/dnf/repo.py b/dnf/repo.py
index 7550897..db3ac6a 100644
--- a/dnf/repo.py
+++ b/dnf/repo.py
@@ -84,7 +84,7 @@ def _pkg2payload(pkg, progress, *factories):
     raise ValueError(_('no matching payload factory for %s') % pkg)
 
 
-def _download_payloads(payloads, drpm):
+def _download_payloads(payloads, drpm, fail_fast=True):
     # download packages
     def _download_sort_key(payload):
         return not hasattr(payload, 'delta')
@@ -94,7 +94,7 @@ def _download_payloads(payloads, drpm):
                for pload in sorted(payloads, key=_download_sort_key)]
     errs = _DownloadErrors()
     try:
-        libdnf.repo.PackageTarget.downloadPackages(libdnf.repo.VectorPPackageTarget(targets), True)
+        libdnf.repo.PackageTarget.downloadPackages(libdnf.repo.VectorPPackageTarget(targets), fail_fast)
     except RuntimeError as e:
         errs._fatal = str(e)
     drpm.wait()
-- 
2.20.1

