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-soappy,
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}
Description: useful tools for Ubuntu developers
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>
2006-2007, Luke Yelavich <themuso@ubuntu.com>
2009-2010, Michael Bienia <geser@ubuntu.com>
2010-2011, Stefano Rivera <stefanor@ubuntu.com>
2008, Stephan Hermann <sh@sourcecode.de>
2007, Steve Kowalik <stevenk@ubuntu.com>
License: GPL-2

View File

@ -228,18 +228,29 @@ class SourcePackage(object):
assert self.version.debian_revision == version.debian_revision
self.version = version
gpg_info = self.dsc.get_gpg_info()
if gpg_info.valid():
message = 'Valid signature'
else:
message = 'Signature on %s could not be verified' % self.dsc_name
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]
valid = False
message = None
gpg_info = None
try:
gpg_info = self.dsc.get_gpg_info()
valid = gpg_info.valid()
except IOError:
message = ('Signature on %s could not be verified, install '
'debian-keyring' % self.dsc_name)
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 gpg_info.valid():
if valid:
Logger.normal(message)
else:
Logger.error(message)