libdnf/SOURCES/0032-Add-more-specific-error-handling-for-loading-repomd-.patch
2022-05-14 12:12:29 +00:00

47 lines
1.7 KiB
Diff

From b636af779fcdab326eef7bbb74912254c2fa2b0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Thu, 17 Mar 2022 10:34:24 +0100
Subject: [PATCH 32/34] Add more specific error handling for loading repomd and
primary
---
libdnf/dnf-sack.cpp | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index 61f4807c..8e11b8f8 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -780,13 +780,24 @@ load_yum_repo(DnfSack *sack, HyRepo hrepo, GError **error)
fp_primary = solv_xfopen(primary.c_str(), "r");
assert(fp_primary);
- g_debug("fetching %s", name);
- if (repo_add_repomdxml(repo, fp_repomd, 0) || \
- repo_add_rpmmd(repo, fp_primary, 0, 0)) {
+ g_debug("Loading repomd: %s", fn_repomd);
+ if (repo_add_repomdxml(repo, fp_repomd, 0)) {
g_set_error (error,
DNF_ERROR,
DNF_ERROR_INTERNAL_ERROR,
- _("repo_add_repomdxml/rpmmd() has failed."));
+ _("Loading repomd has failed: %s"),
+ pool_errstr(repo->pool));
+ retval = FALSE;
+ goto out;
+ }
+
+ g_debug("Loading primary: %s", primary.c_str());
+ if (repo_add_rpmmd(repo, fp_primary, 0, 0)) {
+ g_set_error (error,
+ DNF_ERROR,
+ DNF_ERROR_INTERNAL_ERROR,
+ _("Loading primary has failed: %s"),
+ pool_errstr(repo->pool));
retval = FALSE;
goto out;
}
--
2.31.1