Author: danielsh
Date: Thu Dec 13 12:25:25 2012
New Revision: 1421244

URL: http://svn.apache.org/viewvc?rev=1421244&view=rev
Log:
Add a 'get-keys' subcommand.

* tools/dist/release.py
  (__future__.with_statement): Import.
  (KEYS): New global.
  (get_keys): New subcommand.
  (main): Hook get_keys() to argparse.

Modified:
    subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/release.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1421244&r1=1421243&r2=1421244&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Thu Dec 13 12:25:25 2012
@@ -34,6 +34,9 @@
 # It'd be kind of nice to use the Subversion python bindings in this script,
 # but people.apache.org doesn't currently have them installed
 
+# Futures (Python 2.5 compatibility)
+from __future__ import with_statement
+
 # Stuff we need
 import os
 import re
@@ -88,6 +91,7 @@ secure_repos = 'https://svn.apache.org/r
 dist_repos = 'https://dist.apache.org/repos/dist'
 dist_dev_url = dist_repos + '/dev/subversion'
 dist_release_url = dist_repos + '/release/subversion'
+KEYS = 'https://people.apache.org/keys/group/subversion-pmc.asc'
 extns = ['zip', 'tar.gz', 'tar.bz2']
 
 
@@ -740,6 +744,15 @@ def check_sigs(args):
         print("   %s" % fp[1])
 
 
+def get_keys(args):
+    'Import the LDAP-based KEYS file to gpg'
+    # We use a tempfile because urlopen() objects don't have a .fileno()
+    with tempfile.SpooledTemporaryFile() as fd:
+       fd.write(urllib2.urlopen(KEYS).read())
+       fd.flush()
+        fd.seek(0)
+       subprocess.check_call(['gpg', '--import'], stdin=fd)
+
 #----------------------------------------------------------------------
 # Main entry point for argument parsing and handling
 
@@ -874,6 +887,11 @@ def main():
                     help='''The full path to the directory containing
                             release artifacts.''')
 
+    # get-keys
+    subparser = subparsers.add_parser('get-keys',
+                    help='''Import committers' public keys to ~/.gpg/''')
+    subparser.set_defaults(func=get_keys)
+
     # A meta-target
     subparser = subparsers.add_parser('clean',
                     help='''The same as the '--clean' switch, but as a


Reply via email to