From 238d1db03976b3e8fc3c3620834333fbc0dbf13f Mon Sep 17 00:00:00 2001 From: Mike Bonnet Date: Oct 20 2016 20:48:07 +0000 Subject: provide more information to the pre/postRPMSign callback The existing pre/postRPMSign callback was following the format of the Task/BuildStateChange callbacks. This isn't necessary for a one-time operation. This change removes the attribute/old/new arguments, and replaces them with sigkey, sighash, build, and rpm arguments. This is more clear, and should make writing handlers for this callback simpler. --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 6f3988d..2750e6c 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -6100,10 +6100,7 @@ def add_rpm_sig(an_rpm, sighdr): #TODO[?] - if sighash is the same, handle more gracefully nvra = "%(name)s-%(version)s-%(release)s.%(arch)s" % rinfo raise koji.GenericError, "Signature already exists for package %s, key %s" % (nvra, sigkey) - callback_info = copy.copy(rinfo) - callback_info['sigkey'] = sigkey - callback_info['sighash'] = sighash - koji.plugin.run_callbacks('preRPMSign', attribute='sighash', old=None, new=sighash, info=callback_info) + koji.plugin.run_callbacks('preRPMSign', sigkey=sigkey, sighash=sighash, build=binfo, rpm=rinfo) insert = """INSERT INTO rpmsigs(rpm_id, sigkey, sighash) VALUES (%(rpm_id)s, %(sigkey)s, %(sighash)s)""" _dml(insert, locals()) @@ -6113,7 +6110,7 @@ def add_rpm_sig(an_rpm, sighdr): fo = file(sigpath, 'wb') fo.write(sighdr) fo.close() - koji.plugin.run_callbacks('postRPMSign', attribute='sighash', old=None, new=sighash, info=callback_info) + koji.plugin.run_callbacks('postRPMSign', sigkey=sigkey, sighash=sighash, build=binfo, rpm=rinfo) def _scan_sighdr(sighdr, fn): """Splices sighdr with other headers from fn and queries (no payload)"""