Display keyring version and hash
So that the user can easily check it is legit through another channel.
This commit is contained in:
parent
9da69d34bd
commit
307ccbc36c
1 changed files with 9 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import hashlib
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
|
|
@ -192,6 +193,7 @@ class Repository(object):
|
||||||
else:
|
else:
|
||||||
print 'First time saving the keyring, blindly accepted.'
|
print 'First time saving the keyring, blindly accepted.'
|
||||||
keyring.save(keyring_data, self.key_update)
|
keyring.save(keyring_data, self.key_update)
|
||||||
|
print keyring
|
||||||
|
|
||||||
def parse_index(self, fp):
|
def parse_index(self, fp):
|
||||||
"""
|
"""
|
||||||
|
|
@ -685,3 +687,10 @@ class Keyring(object):
|
||||||
print >>sys.stderr, out, err
|
print >>sys.stderr, out, err
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
if self.exists():
|
||||||
|
with open(self.vpath, 'r') as f:
|
||||||
|
h = hashlib.sha1(f.read()).hexdigest()
|
||||||
|
return 'Keyring version %s, checksum %s' % (self.version, h)
|
||||||
|
return 'NO KEYRING'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue