This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/comdev-people.git
The following commit(s) were added to refs/heads/main by this push: new 94049c2 Extract key ids as well 94049c2 is described below commit 94049c237dcf68e31c14f3155162c4443ad629e8 Author: Sebb <s...@apache.org> AuthorDate: Mon Jul 7 23:30:31 2025 +0100 Extract key ids as well --- tools/pgp.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/pgp.py b/tools/pgp.py index a325d11..414d33b 100644 --- a/tools/pgp.py +++ b/tools/pgp.py @@ -93,12 +93,12 @@ def readJSON(file): # get the current set of keys in the database dbkeys={} # fingerprint entries from pgp database dbkeyct = 0 -ok, fps = pgpfunc('--fingerprint') # fetch all the fingerprints +ok, fps = pgpfunc('--fingerprint', '--keyid-format', 'long') # fetch all the fingerprints if ok: # scan the output looking for fps lines = fps.split("\n")[2:] # Drop the header for keyblock in split_before(lines, lambda l: l.startswith('pub')): - fp = keyblock[1].replace(' ', '') + fp = keyblock[1].replace(' ', '').replace('Keyfingerprint=', '') dbkeys[fp] = [ l for l in keyblock if len(l) > 0] dbkeyct += 1 @@ -160,7 +160,8 @@ for uid, entry in people['people'].items(): if ok: log.write("User: %s key %s - fetched from remote\n" % (uid, skey)) newkeys = newkeys +1 - ok, data = pgpfunc('--fingerprint', skey) + # Options must agree with main fingerprint export at start + ok, data = pgpfunc('--fingerprint', '--keyid-format', 'long', skey) data = data.strip() # strip to match cached data # LATER? dbkeys[skey.upper()] = data.split("\n") # update the fps cache else: @@ -176,7 +177,8 @@ for uid, entry in people['people'].items(): badkeys[uid][key] = "invalid key (%s)" % badkey.group(1) else: # Note: Python multi-line search with ^ and $ is noticeably slower - foundkey = re.search("\n [0-9a-fA-F ]+\n", data) + # Allow for --keyid-format which adds prefix to fingerprint + foundkey = re.search("\n (Key fingerprint = )?[0-9a-fA-F ]+\n", data) if foundkey: ok, body = pgpfunc('--export', '--armor', skey) if ok: