From 846a903d2ba3a470b5fc1655bdf480c8c6847358 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Oct 13 2020 10:00:22 +0000 Subject: PR#2537: lib: detect non-installed rpm lib Merges #2537 https://pagure.io/koji/pull-request/2537 Fixes: #2536 https://pagure.io/koji/issue/2536 download_rpm should be replaced with simple download, when rpm is not installed --- 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)