richardphibel / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone

Blame SOURCES/0032-Add-more-specific-error-handling-for-loading-repomd-.patch

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