/usr/lib/python2.7/dist-packages/fedmsg_meta_fedora_infrastructure/summershum.py is in python-fedmsg-meta-fedora-infrastructure 0.2.18-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # This file is part of fedmsg.
# Copyright (C) 2014 Red Hat, Inc.
#
# fedmsg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# fedmsg is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with fedmsg; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# Authors: Ralph Bean <rbean@redhat.com>
#
from fedmsg_meta_fedora_infrastructure import BaseProcessor
from fasshim import gravatar_url
class SummerShumProcessor(BaseProcessor):
__name__ = "summershum"
__description__ = "a backend tool that extracts hashes of source files"
__link__ = "https://github.com/fedora-infra/summershum"
__docs__ = "https://github.com/fedora-infra/summershum"
__obj__ = "Source File Hashes"
__icon__ = "https://raw2.github.com/" + \
"fedora-infra/summershum/develop/summershum.png"
def subtitle(self, msg, **config):
if msg['topic'].endswith('fail'):
tmpl = self._('yikes! summershum failed to process {filename} '
'for {name}')
elif msg['topic'].endswith('complete'):
tmpl = self._('summershum ingested {filename} '
'for {name}')
elif msg['topic'].endswith('start'):
tmpl = self._('summershum started working on {filename} '
'for {name}')
else:
tmpl = self._('(unhandled)')
return tmpl.format(**msg['msg']['original'])
def secondary_icon(self, msg, **config):
return gravatar_url(msg['msg']['original']['agent'])
def usernames(self, msg, **config):
return set([msg['msg']['original']['agent']])
def packages(self, msg, **config):
return set([msg['msg']['original']['name']])
def objects(self, msg, **config):
original = msg['msg']['original']
return set(['/'.join([
'digests',
original['name'],
original['filename'],
original['md5sum'],
])])
def link(self, msg, **config):
o = msg['msg']['original']
prefix = "http://pkgs.fedoraproject.org/lookaside/pkgs"
name = o['name']
md5sum = o['md5sum']
filename = o['filename']
tmpl = "{prefix}/{name}/{filename}/{md5sum}/{filename}"
return tmpl.format(prefix=prefix, name=name,
md5sum=md5sum, filename=filename)
|