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

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