Bug#501182: carnivore: doesn't contain data about debian maintainers' keys
tag 501182 patch
thanks
Hi Lucas/QA Team,
On Sun, Oct 5, 2008 at 11:01, Lucas Nussbaum <lucas@lucas-nussbaum.net> wrote:
> Carnivore doesn't contain keys from debian maintainers (DM).
>
> Looking at the code, it shouldn't be too hard to add for someone with
> python skills.
I prepared a patch (here attached) to add DM keyring to carnivore data
(refactoring the keyring parse code in a proper function).
I uploaded the patch to ~morph@merkel, along with the previous and
current extract_data output; the difference seems good, but I'd like
to have the opinion (and the eventual ocmmit) of someone more
experienced of me in this stuff.
Kindly,
--
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
Index: extract_data
===================================================================
--- extract_data (revision 2023)
+++ extract_data (working copy)
@@ -99,45 +99,52 @@
can.append(target)
def getKeyrings():
+ """Extracts keys from various keyrings (DDs, DMs, emeritus and removed"""
for keyring, file in {'keyring': 'debian-keyring', \
'emeritus': 'emeritus-keyring', \
'removed': 'removed-keys' }.iteritems():
for type in [ 'gpg' , 'pgp' ]:
- contents = os.popen("gpg --no-default-keyring \
- --no-expensive-trust-checks \
- --keyring /org/qa.debian.org/data/keyrings/keyrings/%s.%s --list-keys \
- --with-colons --fingerprint" % (file, type))
- fpr = None
- entry = None
- lastpub = None
- for line in contents.readlines():
- items = line.split(':')
- uid = None
- if items[0] == 'pub':
- fpr = entry = None
- lastpub = items[9].strip()
- continue
- elif items[0] == 'fpr':
- fpr = "gpg:" + items[9].strip()
- extraInfo(fpr, "x:gpg:keyring:"+fpr[4:] + ":" + keyring)
- uid = lastpub
- elif items[0] == 'uid':
- uid = items[9].strip()
- else:
- continue
- # Do stuff with 'uid'
- weakRef("uid:"+uid, fpr)
- uid, email = parseUid(uid)
- if email:
- email = "email:" + email
- merge(fpr, email)
- extraInfo(fpr, "x:"+fpr+":"+email)
- if uid:
- addName(uid, fpr)
- extraInfo(fpr, "realname:"+uid)
- extraInfo(fpr, "x:"+fpr+":realname:"+uid)
- contents.close()
+ parseKeyring("/org/qa.debian.org/data/keyrings/keyrings/%s.%s" % (file, type), keyring)
+ # Add DM keyring
+ parseKeyring("/org/ftp.debian.org/keyrings/debian-maintainers.gpg", "dm")
+def parseKeyring(keyring_file, keyring):
+ """Parses the given keyring_file, adding its keys to keyring set (used below)"""
+ contents = os.popen("gpg --no-default-keyring \
+ --no-expensive-trust-checks \
+ --keyring %s --list-keys \
+ --with-colons --fingerprint" % keyring_file)
+ fpr = None
+ entry = None
+ lastpub = None
+ for line in contents.readlines():
+ items = line.split(':')
+ uid = None
+ if items[0] == 'pub':
+ fpr = entry = None
+ lastpub = items[9].strip()
+ continue
+ elif items[0] == 'fpr':
+ fpr = "gpg:" + items[9].strip()
+ extraInfo(fpr, "x:gpg:keyring:"+fpr[4:] + ":" + keyring)
+ uid = lastpub
+ elif items[0] == 'uid':
+ uid = items[9].strip()
+ else:
+ continue
+ # Do stuff with 'uid'
+ weakRef("uid:"+uid, fpr)
+ uid, email = parseUid(uid)
+ if email:
+ email = "email:" + email
+ merge(fpr, email)
+ extraInfo(fpr, "x:"+fpr+":"+email)
+ if uid:
+ addName(uid, fpr)
+ extraInfo(fpr, "realname:"+uid)
+ extraInfo(fpr, "x:"+fpr+":realname:"+uid)
+ contents.close()
+
def getLdap():
l = ldap.initialize("ldap://db.debian.org/")
result = l.search_s("dc=debian,dc=org", ldap.SCOPE_SUBTREE,
@@ -255,7 +262,7 @@
ldap, realname, email, package = [], [], [], []
extra, expl, warnings, mia = [], [], [], []
gecos = ""
- keyring = {'keyring': [], 'emeritus': [], 'removed': [], 'ldap': []}
+ keyring = {'keyring': [], 'emeritus': [], 'removed': [], 'ldap': [], 'dm':[]}
for item in sets.Set(v[1]+v[2]):
if item[:5] == "ldap:":
ldap.append(item[5:])
Reply to: