Put things in cgi-bin directory
authorRich Salz <rsalz@openssl.org>
Mon, 13 Mar 2017 18:07:57 +0000 (14:07 -0400)
committerRich Salz <rsalz@openssl.org>
Mon, 13 Mar 2017 18:07:57 +0000 (14:07 -0400)
cgi-bin/authors.py [moved from authors.py with 98% similarity]
cgi-bin/lookup.py [moved from lookup.py with 98% similarity]
cgi-bin/receive-reply.py [moved from receive-reply.py with 97% similarity]
cgi-bin/reply.py [moved from reply.py with 97% similarity]
cgi-bin/search.py [moved from search.py with 98% similarity]
cgi-bin/send-email.py [moved from send-email.py with 98% similarity]
clacheck.py [deleted file]

similarity index 98%
rename from authors.py
rename to cgi-bin/authors.py
index 38dd77051659c8ab5bacae1a7c3a38017a455dc4..6178f0f840938ee458c80e6b0274fa82acf39f54 100755 (executable)
@@ -25,6 +25,7 @@ header = """Content-Type: text/html
   </head>
   <body>
     <h1>%s</h1>
+    <p><a href="/">Main page</a></p>
 
     <p>Names appear multiple times because of multiple email addresses.</p>
 """
similarity index 98%
rename from lookup.py
rename to cgi-bin/lookup.py
index 1641f4905d6cbb7430c4acc00c5741829d6a0f09..adb0ee55f0d4d6632f68024115ec76e970bb4df7 100755 (executable)
--- a/lookup.py
@@ -28,6 +28,8 @@ print """Content-Type: text/html
   <body>
     <h1>Search results</h1>
 
+    <p><a href="/">Main page</a></p>
+
     <p>"""
 
 def show_log(uid, email):
similarity index 97%
rename from receive-reply.py
rename to cgi-bin/receive-reply.py
index 5d2c5794f6930cbdcd3797a5ce8c1442158cb218..923dc3405cc9fb7d6c20b5751abe8eb4e582df7d 100755 (executable)
@@ -21,8 +21,8 @@ print """Content-Type: text/html
   </head>
   <body>
     <h1>Recieve Reply</h1>
-
-    """
+    <p><a href="/">Main page</a></p>
+    <p>"""
 
 trailer = """
     <p><a href="/">Main page</a></p>
similarity index 97%
rename from reply.py
rename to cgi-bin/reply.py
index 8d5d65963b3322d9053206969e5188c6f021e3c9..93625d92abbf5dfa65b2a5a423a368e53c92e4e4 100755 (executable)
--- a/reply.py
@@ -21,7 +21,7 @@ print """Content-Type: text/html
   </head>
   <body>
     <h1>Reply</h1>
-
+    <p><a href="/">Main page</a></p>
     """
 
 trailer = """
similarity index 98%
rename from search.py
rename to cgi-bin/search.py
index 46ab2f4650af1cac6c2721b9df1eba7a4849278b..10409a21632c1cb0c1f10e0a8b3f700ddf295b4e 100755 (executable)
--- a/search.py
@@ -27,7 +27,7 @@ print """Content-Type: text/html
   </head>
   <body>
     <h1>Author Search results</h1>
-
+    <p><a href="/">Main page</a></p>
     <p>"""
 
 def show_log(uid, email):
similarity index 98%
rename from send-email.py
rename to cgi-bin/send-email.py
index 841aeb6832a7a8d80be417cc8bead1f05bd02b70..19be8b2b9ad6d9cb4c87a3b7ae0a821a43e96a5d 100755 (executable)
@@ -21,7 +21,7 @@ print """Content-Type: text/html
   </head>
   <body>
     <h1>Send email</h1>
-
+    <p><a href="/">Main page</a></p>
     <p>"""
 
 trailer = """
diff --git a/clacheck.py b/clacheck.py
deleted file mode 100755 (executable)
index 5f4d40d..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-#! /usr/bin/env python
-"""GitHub web hook.  Take PullRequest messages, and check the authors
-for the CLA.
-"""
-
-import cgi, cgitb
-import json, urllib, os, re, sys, httplib
-
-cgitb.enable()
-
-env = os.environ
-textplain = "Content-type: text/plain\n\n"
-what = env.get('HTTP_X_GITHUB_EVENT', 'ping')
-From = re.compile("^From:.*<(.*)>")
-Trivial = re.compile("^\s*cla\s*:\s*trivial", re.IGNORECASE)
-URLpattern = re.compile("https?://([^/]*)/(.*)")
-SUCCESS = 'success'
-FAILURE = 'failure'
-CLAFILE = "/var/cache/openssl/checkouts/bureau/cladb.txt"
-
-null_actions = (
-        'assigned', 'unassigned', 'labeled', 'unlabeled', 'closed',
-        'review_requested', 'review_request_removed',
-        )
-
-statusbody = """
-{
-    "state": "%(state)s",
-    "target_url": "https://www.openssl.org/policies/cla.html",
-    "description": "%(description)s",
-    "context": "cla-check"
-}
-"""
-
-def url_split(url):
-    m = URLpattern.match(url)
-    return (m.group(1), '/' + m.group(2))
-
-def update_status(pr, state, description):
-    d = { 'state': state, 'description': description }
-    token = open('../ghpass.txt').read().strip()
-    headers = {
-            'Authorization': 'token ' + token,
-            'User-Agent': 'richsalz',
-            'Content-Type': 'application/json; charset=utf-8',
-            'Accept': 'application/json',
-            }
-    host,url = url_split(pr['_links']['statuses']['href'])
-    print textplain, "CLA check", state, description
-    conn = httplib.HTTPSConnection(host)
-    conn.request('POST', url, statusbody % d, headers)
-    conn.getresponse().read()
-    host,url = url_split(pr['issue_url'])
-    if state == SUCCESS:
-        url = url + '/labels/need-cla'
-        print 'Delete', url
-        conn.request('DELETE', url, None, headers)
-    elif state == FAILURE:
-        url = url + '/labels'
-        print 'Add need-cla', url
-        conn.set_debuglevel(99)
-        conn.request('POST', url, '[ "need-cla" ]', headers)
-    reply = conn.getresponse().read()
-    print "--\n", reply
-
-def have_cla(name):
-    """Is |name| in the cladb?"""
-    for line in open(CLAFILE):
-        line = line.strip()
-        if not line or line[0] == '#':
-            continue
-        n = line.split()
-        if len(n) and n[0] == name:
-            return 1
-    return 0
-
-def process():
-    if what != 'pull_request':
-        print textplain, "Request", what
-        return
-    data = json.loads(sys.stdin.read())
-    action = data.get('action', None)
-    if action is None or action in null_actions:
-        print textplain, "No-op action", action
-        return
-    pr = data.get('pull_request', None)
-    if pr is None:
-        print textplain, "PR data missing"
-        return
-    patch_url = pr.get('patch_url', None)
-    if patch_url is None:
-        print textplain, "patch_url missing"
-        return
-    missing = {}
-    trivial = 0
-    for line in urllib.urlopen(patch_url):
-        m = Trivial.match(line)
-        if m:
-            trivial = 1
-            continue
-        m = From.match(line)
-        if m and not have_cla(m.group(1)):
-            missing[m.group(1)] = 1
-    if trivial:
-        update_state(pr, SUCCESS, "Trivial")
-    elif len(missing) == 0:
-        update_status(pr, SUCCESS, 'CLA on file')
-    else:
-        update_status(pr, FAILURE, "CLA missing: " + str(missing.keys()))
-
-process()