Author: hwright
Date: Wed Nov 17 19:00:24 2010
New Revision: 1036166

URL: http://svn.apache.org/viewvc?rev=1036166&view=rev
Log:
Improve signature collection script by adding configuration and actually
collecting the valid sigs.

* tools/dist/collect_sigs.py
  (): Import the configuration options.
  (save_valid_sig): New.
  (process_sig): Save the valid signatures.
  (main): Use the config options.

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

Modified: subversion/trunk/tools/dist/collect_sigs.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/collect_sigs.py?rev=1036166&r1=1036165&r2=1036166&view=diff
==============================================================================
--- subversion/trunk/tools/dist/collect_sigs.py (original)
+++ subversion/trunk/tools/dist/collect_sigs.py Wed Nov 17 19:00:24 2010
@@ -6,7 +6,15 @@ cgitb.enable()
 
 import sys, os, string, subprocess, re
 
-version = '1.6.13'
+try:
+  sys.path.append(os.path.dirname(sys.argv[0]))
+  import config
+except:
+  print 'Content-type: text/plain'
+  print
+  print 'Cannot find config file'
+  sys.exit(1)
+
 r = re.compile('\[GNUPG\:\] GOODSIG (\w*) (.*)')
 
 shell_content = '''
@@ -51,6 +59,11 @@ File: <select name="filename">
   return c % options
 
 
+def save_valid_sig(filename, signature):
+  f = open(os.path.join(config.sigdir, filename + '.asc'), 'a')
+  f.write(signature)
+
+
 def verify_sig(signature, filename):
   args = ['gpg', '--logger-fd', '1', '--no-tty',
           '--status-fd', '2', '--verify', '-', filename]
@@ -101,6 +114,8 @@ def process_sig(signature, filename):
   (verified, result) = verify_sig(signature, filename)
 
   if verified:
+    save_valid_sig(filename, signature)
+
     return c_verified % (filename, result[0], result[1])
   else:
     return c_unverified % (filename, result)
@@ -118,7 +133,7 @@ def main():
 
   # These are "global" values, not specific to our action.
   mapping = {
-      'version' : version,
+      'version' : config.version,
       'content' : content,
     }
 


Reply via email to