Blob Blame History Raw
From ca3d7f06c8f4c1c901dc853ac33c06976b46c61e 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 b0a378c..c258a5a 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -1151,7 +1151,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()
@@ -1163,7 +1163,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())
@@ -1189,7 +1189,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 b454e98..bb42230 100644
--- a/dnf/repo.py
+++ b/dnf/repo.py
@@ -84,17 +84,17 @@ 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')
 
     drpm.err.clear()
     targets = [pload._librepo_target()
                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()
--
libgit2 1.0.1