Drop SELECT for check existing signatures for package from add-rpm-sig

Fixes: https://pagure.io/koji/issue/2992
This commit is contained in:
Jana Cupova 2021-09-09 18:07:14 +02:00 committed by Tomas Kopecek
parent 440fb69a7a
commit b042786c72

View file

@ -7599,21 +7599,14 @@ def add_rpm_sig(an_rpm, sighdr):
sigkey = koji.get_sigpacket_key_id(sigkey)
sighash = md5_constructor(sighdr).hexdigest()
rpm_id = rinfo['id']
# - db entry
q = """SELECT sighash FROM rpmsigs WHERE rpm_id=%(rpm_id)i AND sigkey=%(sigkey)s"""
rows = _fetchMulti(q, locals())
nvra = "%(name)s-%(version)s-%(release)s.%(arch)s" % rinfo
sig_error = "Signature already exists for package %s, key %s" % (nvra, sigkey)
if rows:
# TODO[?] - if sighash is the same, handle more gracefully
raise koji.GenericError(sig_error)
koji.plugin.run_callbacks('preRPMSign', sigkey=sigkey, sighash=sighash, build=binfo, rpm=rinfo)
insert = InsertProcessor('rpmsigs')
insert.set(rpm_id=rpm_id, sigkey=sigkey, sighash=sighash)
try:
insert.execute()
except IntegrityError:
raise koji.GenericError(sig_error)
nvra = "%(name)s-%(version)s-%(release)s.%(arch)s" % rinfo
raise koji.GenericError("Signature already exists for package %s, key %s" % (nvra, sigkey))
# - write to fs
sigpath = "%s/%s" % (builddir, koji.pathinfo.sighdr(rinfo, sigkey))
koji.ensuredir(os.path.dirname(sigpath))