Blob Blame History Raw
From 3ebfeae20c74de0ca4b26b22135e1996265ea4ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
Date: Wed, 5 Apr 2023 11:41:23 +0200
Subject: [PATCH 2/6] Ignore missing spec file in pre-push hook
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

For modules or containers there will be no spec file, and there is
nothing to block the push on.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
---
 pyrpkg/__init__.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
index ecb99c9..d3a7a1c 100644
--- a/pyrpkg/__init__.py
+++ b/pyrpkg/__init__.py
@@ -4471,7 +4471,12 @@ class Commands(object):
             # Assume, that specfile names are same in the active branch
             # and in the pushed branch (git checkout f37 && git push origin rawhide)
             # in this case 'f37' is active branch and 'rawhide' is pushed branch.
-            specfile_path_absolute = os.path.join(self.layout.specdir, self.spec)
+            try:
+                specfile_path_absolute = os.path.join(self.layout.specdir, self.spec)
+            except rpkgError:
+                # No specfile found, nothing to check
+                return
+
             # convert to relative path
             specfile_path = os.path.relpath(specfile_path_absolute, start=self.path)
             cmd = ['spectool', '-l', os.path.join(clone_dir, specfile_path)]
-- 
2.39.2