[PATCH] Add new {pre,post}RPMSign plugin callbacks.

Mike Bonnet mikeb at redhat.com
Wed Dec 10 16:31:31 UTC 2014


On 12/10/14 8:17 AM, Ralph Bean wrote:
> Following up on this as there's been no comment.  Should I send
> patches like this somewhere else?  Post them in a bug tracker
> somewhere?

This looks reasonable, I'll see about getting it merged upstream.

Thanks for the patch!

> Cheers-
>   -Ralph
>
> On Wed, Nov 12, 2014 at 10:23:34PM -0500, Ralph Bean wrote:
>> I'd like to use these in Fedora Infrastructure for the fedmsg plugin so
>> we can see when rawhide rpms get signed by sigul.
>> ---
>>   hub/kojihub.py | 6 ++++++
>>   koji/plugin.py | 2 ++
>>   2 files changed, 8 insertions(+)
>>
>> diff --git a/hub/kojihub.py b/hub/kojihub.py
>> index 3c7d5c1..1f8c0e2 100644
>> --- a/hub/kojihub.py
>> +++ b/hub/kojihub.py
>> @@ -24,6 +24,7 @@
>>   import base64
>>   import calendar
>>   import cgi
>> +import copy
>>   import koji
>>   import koji.auth
>>   import koji.db
>> @@ -5152,6 +5153,10 @@ 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)
>>       insert = """INSERT INTO rpmsigs(rpm_id, sigkey, sighash)
>>       VALUES (%(rpm_id)s, %(sigkey)s, %(sighash)s)"""
>>       _dml(insert, locals())
>> @@ -5161,6 +5166,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)
>>
>>   def _scan_sighdr(sighdr, fn):
>>       """Splices sighdr with other headers from fn and queries (no payload)"""
>> diff --git a/koji/plugin.py b/koji/plugin.py
>> index ed51a5c..975b297 100644
>> --- a/koji/plugin.py
>> +++ b/koji/plugin.py
>> @@ -35,6 +35,8 @@ callbacks = {
>>       'postBuildStateChange':   [],
>>       'preImport':              [],
>>       'postImport':             [],
>> +    'preRPMSign':             [],
>> +    'postRPMSign':            [],
>>       'preTag':                 [],
>>       'postTag':                [],
>>       'preUntag':               [],
>> --
>> 1.9.3
>>
>>
>>
>> --
>> buildsys mailing list
>> buildsys at lists.fedoraproject.org
>> https://admin.fedoraproject.org/mailman/listinfo/buildsys



More information about the buildsys mailing list