ALBS-732 #10

Merged
soksanichenko merged 6 commits from ALBS-732-a9 into a9 2022-11-11 21:39:50 +00:00
Showing only changes of commit 5ef9ed889a - Show all commits

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
)