|
|
149d5d |
From ca3d7f06c8f4c1c901dc853ac33c06976b46c61e Mon Sep 17 00:00:00 2001
|
|
|
149d5d |
From: Marek Blaha <mblaha@redhat.com>
|
|
|
149d5d |
Date: Wed, 6 Oct 2021 09:56:05 +0200
|
|
|
149d5d |
Subject: [PATCH] Add fail_fast parameter to download_payloads methods
|
|
|
149d5d |
|
|
|
149d5d |
Unlike in the rpm transaction, reposync needs to switch the fail_fast
|
|
|
149d5d |
off to download as much packages from repository as possible.
|
|
|
149d5d |
---
|
|
|
149d5d |
dnf/base.py | 6 +++---
|
|
|
149d5d |
dnf/repo.py | 4 ++--
|
|
|
149d5d |
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
149d5d |
|
|
|
149d5d |
diff --git a/dnf/base.py b/dnf/base.py
|
|
|
70e049 |
index b0a378c2..c258a5a7 100644
|
|
|
149d5d |
--- a/dnf/base.py
|
|
|
149d5d |
+++ b/dnf/base.py
|
|
|
149d5d |
@@ -1151,7 +1151,7 @@ class Base(object):
|
|
|
149d5d |
timer()
|
|
|
149d5d |
self._trans_success = True
|
|
|
149d5d |
|
|
|
149d5d |
- def _download_remote_payloads(self, payloads, drpm, progress, callback_total):
|
|
|
149d5d |
+ def _download_remote_payloads(self, payloads, drpm, progress, callback_total, fail_fast=True):
|
|
|
149d5d |
lock = dnf.lock.build_download_lock(self.conf.cachedir, self.conf.exit_on_lock)
|
|
|
149d5d |
with lock:
|
|
|
149d5d |
beg_download = time.time()
|
|
|
149d5d |
@@ -1163,7 +1163,7 @@ class Base(object):
|
|
|
149d5d |
progress.start(len(payloads), est_remote_size, total_drpms=total_drpm)
|
|
|
149d5d |
else:
|
|
|
149d5d |
progress.start(len(payloads), est_remote_size)
|
|
|
149d5d |
- errors = dnf.repo._download_payloads(payloads, drpm)
|
|
|
149d5d |
+ errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
|
|
|
149d5d |
|
|
|
149d5d |
if errors._irrecoverable():
|
|
|
149d5d |
raise dnf.exceptions.DownloadError(errors._irrecoverable())
|
|
|
149d5d |
@@ -1189,7 +1189,7 @@ class Base(object):
|
|
|
149d5d |
est_remote_size = sum(pload.download_size
|
|
|
149d5d |
for pload in payloads)
|
|
|
149d5d |
progress.start(len(payloads), est_remote_size)
|
|
|
149d5d |
- errors = dnf.repo._download_payloads(payloads, drpm)
|
|
|
149d5d |
+ errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
|
|
|
149d5d |
|
|
|
149d5d |
if errors._irrecoverable():
|
|
|
149d5d |
raise dnf.exceptions.DownloadError(errors._irrecoverable())
|
|
|
149d5d |
diff --git a/dnf/repo.py b/dnf/repo.py
|
|
|
70e049 |
index b454e981..bb422309 100644
|
|
|
149d5d |
--- a/dnf/repo.py
|
|
|
149d5d |
+++ b/dnf/repo.py
|
|
|
70e049 |
@@ -84,7 +84,7 @@ def _pkg2payload(pkg, progress, *factories):
|
|
|
149d5d |
raise ValueError(_('no matching payload factory for %s') % pkg)
|
|
|
149d5d |
|
|
|
149d5d |
|
|
|
149d5d |
-def _download_payloads(payloads, drpm):
|
|
|
149d5d |
+def _download_payloads(payloads, drpm, fail_fast=True):
|
|
|
149d5d |
# download packages
|
|
|
149d5d |
def _download_sort_key(payload):
|
|
|
149d5d |
return not hasattr(payload, 'delta')
|
|
|
70e049 |
@@ -94,7 +94,7 @@ def _download_payloads(payloads, drpm):
|
|
|
149d5d |
for pload in sorted(payloads, key=_download_sort_key)]
|
|
|
149d5d |
errs = _DownloadErrors()
|
|
|
149d5d |
try:
|
|
|
149d5d |
- libdnf.repo.PackageTarget.downloadPackages(libdnf.repo.VectorPPackageTarget(targets), True)
|
|
|
149d5d |
+ libdnf.repo.PackageTarget.downloadPackages(libdnf.repo.VectorPPackageTarget(targets), fail_fast)
|
|
|
149d5d |
except RuntimeError as e:
|
|
|
149d5d |
errs._fatal = str(e)
|
|
|
149d5d |
drpm.wait()
|
|
|
70e049 |
--
|
|
|
70e049 |
2.35.1
|
|
|
149d5d |
|