Handle missing debian-keyring more gracefully

This commit is contained in:
Stefano Rivera 2011-01-15 13:46:40 +02:00
parent d7c0cad962
commit b62377b374
3 changed files with 26 additions and 12 deletions

4
debian/control vendored
View File

@ -56,7 +56,9 @@ Recommends: bzr,
python-magic, python-magic,
python-soappy, python-soappy,
reportbug (>= 3.39ubuntu1) reportbug (>= 3.39ubuntu1)
Suggests: python-simplejson | python (>= 2.7), qemu-kvm-extras-static Suggests: debian-keyring,
python-simplejson | python (>= 2.7),
qemu-kvm-extras-static
Breaks: ${python:Breaks} Breaks: ${python:Breaks}
Description: useful tools for Ubuntu developers Description: useful tools for Ubuntu developers
This is a collection of useful tools that Ubuntu developers use to make their This is a collection of useful tools that Ubuntu developers use to make their

1
debian/copyright vendored
View File

@ -27,6 +27,7 @@ Copyright: 2007, Albert Damen <albrt@gmx.net>
2010, Evan Broder <evan@ebroder.net> 2010, Evan Broder <evan@ebroder.net>
2006-2007, Luke Yelavich <themuso@ubuntu.com> 2006-2007, Luke Yelavich <themuso@ubuntu.com>
2009-2010, Michael Bienia <geser@ubuntu.com> 2009-2010, Michael Bienia <geser@ubuntu.com>
2010-2011, Stefano Rivera <stefanor@ubuntu.com>
2008, Stephan Hermann <sh@sourcecode.de> 2008, Stephan Hermann <sh@sourcecode.de>
2007, Steve Kowalik <stevenk@ubuntu.com> 2007, Steve Kowalik <stevenk@ubuntu.com>
License: GPL-2 License: GPL-2

View File

@ -228,18 +228,29 @@ class SourcePackage(object):
assert self.version.debian_revision == version.debian_revision assert self.version.debian_revision == version.debian_revision
self.version = version self.version = version
gpg_info = self.dsc.get_gpg_info() valid = False
if gpg_info.valid(): message = None
message = 'Valid signature' gpg_info = None
else: try:
message = 'Signature on %s could not be verified' % self.dsc_name gpg_info = self.dsc.get_gpg_info()
if 'GOODSIG' in gpg_info: valid = gpg_info.valid()
message = 'Good signature by %s (0x%s)' % (gpg_info['GOODSIG'][1], except IOError:
gpg_info['GOODSIG'][0]) message = ('Signature on %s could not be verified, install '
elif 'VALIDSIG' in gpg_info: 'debian-keyring' % self.dsc_name)
message = 'Valid signature by 0x%s' % gpg_info['VALIDSIG'][0] if message is None:
if valid:
message = 'Valid signature'
else:
message = ('Signature on %s could not be verified'
% self.dsc_name)
if gpg_info is not None:
if 'GOODSIG' in gpg_info:
message = ('Good signature by %s (0x%s)'
% (gpg_info['GOODSIG'][1], gpg_info['GOODSIG'][0]))
elif 'VALIDSIG' in gpg_info:
message = 'Valid signature by 0x%s' % gpg_info['VALIDSIG'][0]
if verify_signature: if verify_signature:
if gpg_info.valid(): if valid:
Logger.normal(message) Logger.normal(message)
else: else:
Logger.error(message) Logger.error(message)