[openssl-commits] [tools] master update

Rich Salz rsalz at openssl.org
Tue Oct 24 19:26:36 UTC 2017


The branch master has been updated
       via  8bdaf7f34539129ef26e9aadaca98fb7ab50f267 (commit)
       via  ab822408ff71f781b77056e57d38124ba54fb689 (commit)
      from  582229603e58fa824befa40c12df3e187f4e1553 (commit)


- Log -----------------------------------------------------------------
commit 8bdaf7f34539129ef26e9aadaca98fb7ab50f267
Author: Rich Salz <rsalz at openssl.org>
Date:   Tue Oct 24 15:26:26 2017 -0400

    Add help option to finduser

commit ab822408ff71f781b77056e57d38124ba54fb689
Author: Rich Salz <rsalz at openssl.org>
Date:   Tue Oct 24 15:26:07 2017 -0400

    Add rmcommit script
    
    Removes a set of commits from a specified user.

-----------------------------------------------------------------------

Summary of changes:
 license/finduser | 10 ++++++----
 license/rmcommit | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 4 deletions(-)
 create mode 100755 license/rmcommit

diff --git a/license/finduser b/license/finduser
index 1b44299..481c04b 100755
--- a/license/finduser
+++ b/license/finduser
@@ -23,15 +23,17 @@ cursor = conn.cursor()
 
 single = 0
 full = 0
-opts, args = getopt.getopt(sys.argv[1:], "1f")
+try:
+    opts, args = getopt.getopt(sys.argv[1:], "1f")
+except:
+    print __doc__
+    raise SystemExit
+
 for o,a in opts:
     if o == '-1':
         single = 1
     elif o == '-f':
         full = 1
-    else:
-        print __doc__
-        raise SystemExit
 
 q = ('SELECT users.uid,email,reply,name,count(log.uid),comment FROM users'
         ' LEFT JOIN log ON log.uid = users.uid'
diff --git a/license/rmcommit b/license/rmcommit
new file mode 100755
index 0000000..f128c47
--- /dev/null
+++ b/license/rmcommit
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+"""Remove commits from a user.
+"""
+
+import mysql.connector, os, re, subprocess, sys
+import string, random
+dbconfig = {
+        'user': 'license',
+        'password': open('rwpass.txt').read().strip(),
+        'database': 'license'
+        }
+conn = mysql.connector.connect(**dbconfig)
+cursor = conn.cursor()
+
+# Get email identifier
+cursor.execute('SELECT uid FROM users WHERE email = %s', (sys.argv[1],))
+email = None
+for c in cursor:
+    email = c[0]
+if not email:
+    print sys.argv[1], "not found"
+    raise SystemExit
+
+for cids in sys.argv[2:]:
+    pat = cids + '%'
+    cursor.execute('SELECT cid FROM commits WHERE commit LIKE %s', (pat,))
+    cid = None
+    for c in cursor:
+        cid = c[0]
+    if cid:
+        cursor.execute('DELETE FROM log WHERE uid=%s AND cid LIKE %s',
+                (email, cid))
+        conn.commit()


More information about the openssl-commits mailing list