Blame SOURCES/0002-repomanage-Allow-running-only-with-metadata.patch

237e18
From 716c5978a8036df22d6f5b430ba38c35d034f3ea Mon Sep 17 00:00:00 2001
237e18
From: Aleš Matěj <amatej@redhat.com>
237e18
Date: Tue, 8 Jun 2021 10:25:55 +0200
237e18
Subject: [PATCH] [repomanage] Allow running only with metadata
237e18
237e18
Requiring some packages to be present even if there are repodata was
237e18
arbitrary because they are never used.
237e18
---
237e18
 plugins/repomanage.py | 10 +++++-----
237e18
 1 file changed, 5 insertions(+), 5 deletions(-)
237e18
237e18
diff --git a/plugins/repomanage.py b/plugins/repomanage.py
237e18
index 445006d..989bd78 100644
237e18
--- a/plugins/repomanage.py
237e18
+++ b/plugins/repomanage.py
237e18
@@ -58,18 +58,13 @@ class RepoManageCommand(dnf.cli.Command):
237e18
         if self.opts.new and self.opts.old:
237e18
             raise dnf.exceptions.Error(_("Pass either --old or --new, not both!"))
237e18
 
237e18
-        rpm_list = []
237e18
-        rpm_list = self._get_file_list(self.opts.path, ".rpm")
237e18
         verfile = {}
237e18
         pkgdict = {}
237e18
         module_dict = {}  # {NameStream: {Version: [modules]}}
237e18
         all_modular_artifacts = set()
237e18
 
237e18
         keepnum = int(self.opts.keep) # the number of items to keep
237e18
 
237e18
-        if len(rpm_list) == 0:
237e18
-            raise dnf.exceptions.Error(_("No files to process"))
237e18
-
237e18
         try:
237e18
             repo_conf = self.base.repos.add_new_repo("repomanage_repo", self.base.conf, baseurl=[self.opts.path])
237e18
             # Always expire the repo, otherwise repomanage could use cached metadata and give identical results
237e18
@@ -88,6 +83,11 @@ class RepoManageCommand(dnf.cli.Command):
237e18
                         module_package.getVersionNum(), []).append(module_package)
237e18
 
237e18
         except dnf.exceptions.RepoError:
237e18
+            rpm_list = []
237e18
+            rpm_list = self._get_file_list(self.opts.path, ".rpm")
237e18
+            if len(rpm_list) == 0:
237e18
+                raise dnf.exceptions.Error(_("No files to process"))
237e18
+
237e18
             self.base.reset(sack=True, repos=True)
237e18
             self.base.fill_sack(load_system_repo=False, load_available_repos=False)
237e18
             try:
237e18
--
237e18
libgit2 1.0.1
237e18