[Collab-qa-commits] r1312 - upload-history
filippo at alioth.debian.org
filippo at alioth.debian.org
Sat Oct 4 13:27:05 UTC 2008
Author: filippo
Date: 2008-10-04 13:27:05 +0000 (Sat, 04 Oct 2008)
New Revision: 1312
Modified:
upload-history/munge_ddc.py
Log:
use KEYRING_DIR as a directory for keyrings
Modified: upload-history/munge_ddc.py
===================================================================
--- upload-history/munge_ddc.py 2008-10-01 13:43:50 UTC (rev 1311)
+++ upload-history/munge_ddc.py 2008-10-04 13:27:05 UTC (rev 1312)
@@ -27,6 +27,7 @@
bugnumber_list_RE = re.compile("^([0-9]{3,} ?)+")
+# don't forget to include a slash to keyring path, otherwise gpg assumes it is in GNUPGHOME
def get_key_info_gpgv(msg, keyring=["./debian-keyring.gpg",
"./debian-maintainers.gpg",
"/usr/share/keyrings/debian-keyring.gpg",
@@ -62,6 +63,9 @@
if not out:
return ("N/A", "N/A")
+# XXX parse also VALIDSIG
+# [GNUPG:] VALIDSIG BAF13B92C79DE5C486779404FE9A8DD84054AB08 2007-12-22 1198286037 0 3 0 17 2 01 6583A11F1428FCDD65FCC7B5E0CD3CDC59B2D9A0
+# last field is the fingerprint
m = keyid_RE.search(out)
if m:
# see /usr/share/doc/gnupg/DETAILS.gz
@@ -93,6 +97,15 @@
return ret
+def build_keyring_list(dir):
+ """ Scan dir and return a list of every file ending with .gpg or .pgp """
+ keyrings = []
+ for root, dirs, files in os.walk(dir):
+ keyrings.extend([os.path.join(root, x) for x in files if x.endswith(".gpg") or x.endswith(".pgp")])
+
+ sys.stderr.write("using keyrings " + repr(keyrings))
+ return keyrings
+
# XXX factor this to work with plain .changes
def munge_ddc(mb_file, outfile=sys.stdout):
""" Scan given filename mb_file as a unix mailbox and extract upload informations """
@@ -143,7 +156,10 @@
c['NMU'] = ((nmu_version is not None) and (nmu_changes is not None))
- (c['Key'], c['Signed-By']) = get_key_info(body)
+ if os.environ.has_key("KEYRING_DIR"):
+ (c['Key'], c['Signed-By']) = get_key_info(body, keyring = build_keyring_list(os.environ['KEYRING_DIR']) )
+ else:
+ (c['Key'], c['Signed-By']) = get_key_info(body)
### Fields sanitization
More information about the Collab-qa-commits
mailing list