From a8d676b5a52070cdd5f5f032ad21a17c57d0a5bf Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Oct 12 2020 13:07:43 +0000 Subject: lib: detect non-installed rpm lib Fixed: https://pagure.io/koji/issue/2536 --- diff --git a/koji/__init__.py b/koji/__init__.py index 673a6f2..3b302b8 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -1855,6 +1855,9 @@ def check_rpm_file(rpmfile): def _check_rpm_file(fo): """Check that the open file appears to be an rpm""" # TODO: trap exception and raise something with more infomation + if rpm is None: + logging.warning("python-rpm is not installed, file will not be checked") + return ts = rpm.TransactionSet() # for basic validity we can ignore sigs as there needn't be public keys installed ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)