ALBS-732: pungi: do not build anything if unsigned packages found

- Fix unittests
This commit is contained in:
soksanichenko 2022-11-07 23:51:13 +02:00
parent fe4c73e231
commit 5ef9ed889a

View File

@ -850,8 +850,6 @@ class KojiMockPackageSet(PackageSetBase):
self.extra_builds = extra_builds or []
self.extra_tasks = extra_tasks or []
self.reuse = None
self.sigkey_ordering = [sigkey.lower() for sigkey in sigkey_ordering] \
or [None]
def __getstate__(self):
result = self.__dict__.copy()
@ -971,6 +969,10 @@ class KojiMockPackageSet(PackageSetBase):
def _is_rpm_signed(self, rpm_path) -> bool:
ts = rpm.TransactionSet()
ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
sigkeys = [
sigkey.lower() for sigkey in self.sigkey_ordering
if sigkey is not None
]
with open(rpm_path, 'rb') as fd:
header = ts.hdrFromFdno(fd)
signature = header[rpm.RPMTAG_SIGGPG] or header[rpm.RPMTAG_SIGPGP]
@ -978,7 +980,7 @@ class KojiMockPackageSet(PackageSetBase):
return False
pgp_msg = pgpy.PGPMessage.from_blob(signature)
return any(
signature.signer.lower() in self.sigkey_ordering
signature.signer.lower() in sigkeys
for signature in pgp_msg.signatures
)