You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2015/07/07 00:11:26 UTC

svn commit: r1689512 [1/9] - in /comdev/reporter.apache.org/tags/test/site: ./ css/ img/ js/ js/foundation/ js/vendor/

Author: sebb
Date: Mon Jul  6 22:11:25 2015
New Revision: 1689512

URL: http://svn.apache.org/r1689512
Log:
Test

Added:
    comdev/reporter.apache.org/tags/test/site/addrelease.html   (with props)
    comdev/reporter.apache.org/tags/test/site/addrelease.py   (with props)
    comdev/reporter.apache.org/tags/test/site/chi.py   (with props)
    comdev/reporter.apache.org/tags/test/site/css/foundation.css   (with props)
    comdev/reporter.apache.org/tags/test/site/css/foundation.min.css   (with props)
    comdev/reporter.apache.org/tags/test/site/css/normalize.css   (with props)
    comdev/reporter.apache.org/tags/test/site/deathnote.py   (with props)
    comdev/reporter.apache.org/tags/test/site/getjson.py   (with props)
    comdev/reporter.apache.org/tags/test/site/img/.gitkeep
    comdev/reporter.apache.org/tags/test/site/img/chi.png   (with props)
    comdev/reporter.apache.org/tags/test/site/img/equation.png   (with props)
    comdev/reporter.apache.org/tags/test/site/index.html   (with props)
    comdev/reporter.apache.org/tags/test/site/jiraversions.py   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation.min.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation/foundation.dropdown.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation/foundation.interchange.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation/foundation.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation/foundation.reveal.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation/foundation.tab.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation/foundation.tooltip.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/foundation/foundation.topbar.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/vendor/fastclick.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/vendor/jquery.cookie.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/vendor/jquery.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/vendor/modernizr.js   (with props)
    comdev/reporter.apache.org/tags/test/site/js/vendor/placeholder.js   (with props)
    comdev/reporter.apache.org/tags/test/site/render.js   (with props)
    comdev/reporter.apache.org/tags/test/site/reportingcycles.json

Added: comdev/reporter.apache.org/tags/test/site/addrelease.html
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/tags/test/site/addrelease.html?rev=1689512&view=auto
==============================================================================
--- comdev/reporter.apache.org/tags/test/site/addrelease.html (added)
+++ comdev/reporter.apache.org/tags/test/site/addrelease.html Mon Jul  6 22:11:25 2015
@@ -0,0 +1,77 @@
+<!doctype html>
+<html class="no-js" lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <link rel="stylesheet" href="css/foundation.css" />
+    <script src="js/vendor/modernizr.js"></script>
+   <script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
+   <script type="text/javascript" src="https://www.google.com/jsapi"></script>
+   <script src="render.js"></script>
+   <title>Apache Project Report Helper: Add a release</title>
+</head>
+<body onload='GetAsyncJSON("/releases/" + project + ".json?now=" + Math.random(), null, listReleaseData)'>
+
+<div id="contents" class="row-12" style="text-align: center; margin: 0 auto; width: 1000px; ">
+  <h2>Apache Project Report Helper: Add a release</h2>
+  <p>Please fill out the fields below to add a release to our report database. This is not a requirement, but a help to those that use the Apache Reporter System to gauge the project's development.</p>
+   <form action="addrelease.py" method="post" id="form" onsubmit="return validate(this)">
+    
+    <input type="hidden" name="date" value="" id="date"/>
+    <b>Project:</b></b><input type="text" name="project" value="" readonly="readonly" id="project"/><br/>
+    <b>Full version name:</b></b><input type="text" name="version" value="" placeholder="1.2.0" id="version"/><br/>
+    <b>Date of release (YYYY-MM-DD):</b></b><input type="text" name="xdate" value="" placeholder="YYYY-MM-DD" id="xdate"/><br/>
+    <input type="submit" value="Add release data"/><br>
+    <small>Need to remove a release? Enter the version of the release and 1970-01-01 as the date then!</small>
+   </form>
+</div>
+<div id="footer">
+   Copyright&copy; 2015, the Apache Software Foundation. Licensed under the Apache License v/2.0<br/>
+   For inquiries, contact <a href="mailto:dev@community.apache.org">dev@community.apache.org</a>.
+</div>
+    <script src="js/foundation.min.js"></script>
+    
+    <script>
+     var project = document.location.search.substr(1);
+     document.getElementById('project').value = project;
+     var date = new Date();
+     var xdate = document.getElementById('xdate');
+     var done = false;
+     xdate.value = date.getFullYear() + "-" + ((date.getMonth()+1) < 10? "0"+(date.getMonth()+1) : (date.getMonth()+1)) + "-" + ((date.getDay()+1) < 10? "0"+(date.getDay()+1) : (date.getDay()+1))
+     
+     function validate(form) {
+      var x = document.getElementById('xdate').value.split("-");
+      var y = new Date(x[0],parseInt(x[1])-1,parseInt(x[2]));
+      var nn = parseInt(y.getTime()/1000);
+      document.getElementById('date').value = nn;
+      if (isNaN(nn)) {
+        alert("Please fill out the release date using YYYY-MMM-DD!")
+        return false
+      }
+      return true
+     }
+     
+     function listReleaseData(json, a,b) {
+      if (done) {
+        return;
+      }
+      done = true
+      var obj = document.getElementById('contents')
+      var x = 0;
+      obj.innerHTML += "<h3>Already registered releases:</h3>"
+      for (version in json) {
+        if (new Date(json[version]*1000) > new Date(1999,1,1)) {
+          obj.innerHTML += "- " + version + ": " + new Date(json[version]*1000).toDateString() + "<br/>"
+          x++;
+        }
+        
+      }
+      if (x == 0) {
+        obj.innerHTML += "No releases registered yet"
+      }
+      document.getElementById('project').value = project;
+     }
+     
+    </script>
+</body>
+<html>

Propchange: comdev/reporter.apache.org/tags/test/site/addrelease.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: comdev/reporter.apache.org/tags/test/site/addrelease.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/tags/test/site/addrelease.py?rev=1689512&view=auto
==============================================================================
--- comdev/reporter.apache.org/tags/test/site/addrelease.py (added)
+++ comdev/reporter.apache.org/tags/test/site/addrelease.py Mon Jul  6 22:11:25 2015
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+import os, sys, re, json, subprocess, urllib, datetime, time
+import base64, urllib2, cgi
+
+form = cgi.FieldStorage();
+user = os.environ['HTTP_X_AUTHENTICATED_USER'] if 'HTTP_X_AUTHENTICATED_USER' in os.environ else "nobody"
+date = int(form['date'].value) if ('date' in form and len(form['date'].value) > 0) else None
+version = form['version'].value if ('version' in form and len(form['version'].value) > 0) else None
+project = form['project'].value if 'project' in form else None
+dojson = form['json'].value if 'json' in form else None
+    
+def getPMCs(uid):
+    groups = []
+    ldapdata = subprocess.check_output(['ldapsearch', '-x', '-LLL', '(|(memberUid=%s)(member=uid=%s,ou=people,dc=apache,dc=org))' % (uid, uid), 'cn'])
+    picked = {}
+    for match in re.finditer(r"dn: cn=([a-zA-Z0-9]+),ou=pmc,ou=committees,ou=groups,dc=apache,dc=org", ldapdata):
+        group = match.group(1)
+        if group != "incubator":
+            
+            groups.append(group)
+    return groups
+
+
+def isMember(uid):
+    members = []
+    ldapdata = subprocess.check_output(['ldapsearch', '-x', '-LLL', '-b', 'cn=member,ou=groups,dc=apache,dc=org'])
+    for match in re.finditer(r"memberUid: ([-a-z0-9_.]+)", ldapdata):
+        group = match.group(1)
+        members.append(group)
+    if uid in members:
+        return True
+    return False
+
+def getReleaseData(project):
+    try:
+        with open("/var/www/reporter.apache.org/data/releases/%s.json" % project, "r") as f:
+            x = json.loads(f.read())
+            f.close()
+        return x;
+    except:
+        return {}
+
+saved = False
+projects = getPMCs(user)
+if date and version and project:
+    if project in projects or isMember(user):
+        rdata = getReleaseData(project)
+        rdata[version] = date
+        with open("/var/www/reporter.apache.org/data/releases/%s.json" % project, "w") as f:
+            f.write(json.dumps(rdata))
+            f.close()
+            saved = True
+            if dojson:
+                print("Content-Type: application/json\r\n\r\n")
+                print(json.dumps({'versions': rdata}))
+            else:
+                print("Content-Type: text/html\r\n\r\n<h3>Data submitted!</h3>You may see the updated project data at: <a href='https://reporter.apache.org/?%s'>https://reporter.apache.org/?%s</a>." % (project, project))
+
+if not saved:
+    if dojson:
+        print("Content-Type: application/json\r\n\r\n{\"error\": \"Not saved\"}")
+    else:
+        print("Content-Type: text/plain\r\n\r\nCould not save. Make sure you have filled out all fields and have access to this projects data! For further inquiries, please contact dev@community.apache.org")
+    
\ No newline at end of file

Propchange: comdev/reporter.apache.org/tags/test/site/addrelease.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: comdev/reporter.apache.org/tags/test/site/addrelease.py
------------------------------------------------------------------------------
    svn:executable = *

Added: comdev/reporter.apache.org/tags/test/site/chi.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/tags/test/site/chi.py?rev=1689512&view=auto
==============================================================================
--- comdev/reporter.apache.org/tags/test/site/chi.py (added)
+++ comdev/reporter.apache.org/tags/test/site/chi.py Mon Jul  6 22:11:25 2015
@@ -0,0 +1,330 @@
+#!/usr/bin/env python
+import os, sys, re, json, subprocess, urllib, time
+import base64, urllib2, cgi
+
+form = cgi.FieldStorage();
+oproject = form['only'].value if ('only' in form and len(form['only'].value) > 0) else None
+
+
+jmap = {
+    'trafficserver': ['TS'],
+    'cordova': ['CB'],
+    'corinthia': ['COR']
+}
+
+pmap = {
+    'community': 'comdev',
+    'ws': 'webservices',
+    'hc': 'httpcomponents'
+}
+
+ldapmap = {
+    'webservices': 'ws',
+}
+
+jirapass = ""
+with open("/var/www/reporter.apache.org/data/jirapass.txt", "r") as f:
+    jirapass = f.read().strip()
+    f.close()
+
+def isMember(uid):
+    members = []
+    ldapdata = subprocess.check_output(['ldapsearch', '-x', '-LLL', '-b', 'cn=member,ou=groups,dc=apache,dc=org'])
+    for match in re.finditer(r"memberUid: ([-a-z0-9_.]+)", ldapdata):
+        group = match.group(1)
+        members.append(group)
+    if uid in members:
+        return True
+    return False
+
+
+def getProjectData(project):
+    try:
+        y = []
+        with open("/var/www/projects.apache.org/site/json/projects/%s.json" % project, "r") as f:
+            x = json.loads(f.read())
+            f.close()
+            with open("/var/www/projects.apache.org/site/json/foundation/pmcs.json", "r") as f:
+                p = json.loads(f.read())
+                f.close()
+                for xproject in p:
+                    y.append(xproject)
+                    if xproject == project:
+                        x['name'] = p[project]['name']
+            with open("/var/www/projects.apache.org/site/json/foundation/chairs.json", "r") as f:
+                c = json.loads(f.read())
+                f.close()
+                for xproject in c:
+                    if xproject.lower() == x['name'].lower():
+                        x['chair'] = c[xproject]
+
+        return x, y;
+    except:
+        x = {}
+        y = []
+        with open("/var/www/projects.apache.org/site/json/foundation/pmcs.json", "r") as f:
+            p = json.loads(f.read())
+            f.close()
+            for xproject in p:
+                y.append(xproject)
+                if xproject == project:
+                    x['name'] = p[project]['name']
+
+        with open("/var/www/projects.apache.org/site/json/foundation/chairs.json", "r") as f:
+            c = json.loads(f.read())
+            f.close()
+            for xproject in c:
+                if 'name' in x and xproject == x['name']:
+                    x['chair'] = c[xproject]
+        return x,y
+
+def getReleaseData(project):
+    try:
+        with open("/var/www/reporter.apache.org/data/releases/%s.json" % project, "r") as f:
+            x = json.loads(f.read())
+            f.close()
+        return x;
+    except:
+        return {}
+
+
+
+pchanges = {}
+cchanges = {}
+
+with open("/var/www/reporter.apache.org/data/pmcs.json", "r") as f:
+    pchanges = json.loads(f.read())
+    f.close()
+
+with open("/var/www/reporter.apache.org/data/projects.json", "r") as f:
+    cchanges = json.loads(f.read())
+    f.close()
+
+
+user = os.environ['HTTP_X_AUTHENTICATED_USER'] if 'HTTP_X_AUTHENTICATED_USER' in os.environ else ""
+m = re.match(r"^([-a-zA-Z0-9_.]+)$", user)
+groups = []
+
+afterQuarter = time.time() - (3*31*86400)
+afterHalf = time.time() - (6*31*86400)
+afterFull = time.time() - (12*31*86400)
+cdata = {}
+if m:
+    uid = m.group(1)
+    if uid:
+        mlstats = {}
+        with open("/var/www/reporter.apache.org/data/mailinglists.json", "r") as f:
+            ml = json.loads(f.read())
+            f.close()
+            for entry in ml:
+                tlp = entry.split(".")[0]
+                if tlp in pmap:
+                    tlp = pmap[tlp]
+                if True:
+                    mlstats[tlp] = mlstats[tlp] if tlp in mlstats else {}
+                    mlstats[tlp][entry] = ml[entry]
+        emails = {}
+        with open("/var/www/reporter.apache.org/data/maildata_extended.json", "r") as f:
+            mld = json.loads(f.read())
+            f.close()
+            for entry in mld:
+                tlp = entry.split("-")[0]
+                if tlp in pmap:
+                    tlp = pmap[tlp]
+                if True:
+                    emails[tlp] = emails[tlp] if tlp in emails else {}
+                    emails[tlp][entry] = mld[entry]
+        jdata = {}
+        ddata = {}
+        rdata = {}
+        allpmcs = []
+        keys = {}
+        count = {}
+        foo, allpmcs = getProjectData('httpd')
+        npmcs = {}
+        ncoms = {}
+        names = {}
+        
+        for group in allpmcs:
+            jiras = []
+            count[group] = [0,0]
+            xgroup = group
+            if group in ldapmap:
+                xgroup = ldapmap[group]
+            if xgroup in pchanges:
+                count[group][0] = len(pchanges[xgroup])
+            if xgroup in cchanges:
+                count[group][1] = len(cchanges[xgroup])
+            ddata, bleh = getProjectData(group)
+            names[group] = ddata['name'] if 'name' in ddata else group
+            rdata[group] = getReleaseData(group) 
+            cdata[group] = cdata[xgroup] if xgroup in cdata else {'pmc': {}, 'committer': {}}
+            
+            for pmc in pchanges:
+                if pmc == xgroup:
+                    for member in pchanges[pmc]:
+                        if pchanges[pmc][member][1] > 0:
+                            cdata[group]['pmc'][member] = pchanges[pmc][member]
+                            npmcs[group] = npmcs[group] if (group in npmcs and npmcs[group] > pchanges[pmc][member][1]) else pchanges[pmc][member][1]
+            for pmc in cchanges:
+                if pmc == xgroup:
+                    for member in cchanges[pmc]:
+                        if cchanges[pmc][member][1] > 0:
+                            cdata[group]['committer'][member] = cchanges[pmc][member]
+                            ncoms[group] = ncoms[group] if (group in ncoms and ncoms[group] > cchanges[pmc][member][1]) else cchanges[pmc][member][1]
+        
+        notes = []
+        status = [0,0,0,0,0,0]
+        for group in allpmcs:
+            if group == "xmlbeans":
+                continue
+            x = 0
+            y = 0
+            score = 0
+            note = []
+            if group in emails:
+                for entry in emails[group]:
+                    x += emails[group][entry]['quarterly'][0]
+                    y += emails[group][entry]['quarterly'][1]
+            if x == 0:
+                score += 2.5
+                note.append("No email sent to ANY ML in the past quarter (-2.50&#27683;)")
+            elif x < 4:
+                score += 2.25
+                note.append("Less than one email per month to all MLs combined in the past quarter (-2.25&#27683;)")
+            elif x < 14:
+                score += 1.75
+                note.append("Less than one email per week to all MLs combined in the past quarter (-1.75&#27683;)")
+            elif x < 45:
+                score += 1.5
+                note.append("Less than one email per 2 days to all MLs combined in the past quarter (-1.50&#27683;)")
+            elif x < 92:
+                score += 1
+                note.append("Less than one email per day to all MLs combined in the past quarter (-1.00&#27683;)")
+            elif x < 184:
+                score += 0.5
+                note.append("Less than two emails per day to all MLs combined in the past quarter (-0.50&#27683;)")
+            elif x < 368:
+                score -= 0.5
+                note.append("More than 2 emails per day to all MLs combined in the past quarter (+0.50&#27683;)")
+            elif x >= 368:
+                score -= 1
+                note.append("More than 4 emails per day to all MLs combined in the past quarter (+1.00&#27683;)")
+            if (x+y) < 7:
+                score += 2
+                note.append("Less than one email per month sent to all MLs combined in the last six months (-2.00&#27683;)")
+            elif y < 14 and x < 14:
+                score += 1.75
+                note.append("Less than one email per week to all MLs combined in the past six months (-1.75&#27683;)")
+            elif y < 45 and x < 45:
+                score += 1.5
+                note.append("Less than one email per 2 days to all MLs combined in the past six months (-1.50&#27683;)")
+            elif y < 90 and x < 90:
+                score += 1
+                note.append("Less than one email per day to all MLs combined in the past six months (-1.00&#27683;)")
+            if group in rdata:
+                tooold = True if len(rdata[group]) > 0 else False
+                tooold2 = True if len(rdata[group]) > 0 else False
+                for version in rdata[group]:
+                    if rdata[group][version] > afterFull:
+                        tooold = False
+                    if rdata[group][version] > (time.time() - (31536000*2)):
+                        tooold2 = False
+                if tooold2:
+                    score += 1.5
+                    note.append("No releases in the last 2+ years (-1.50&#27683;)")
+                elif tooold:
+                    score += 1
+                    note.append("No releases in the last year (-1.00&#27683;)")
+                
+                if len(rdata[group]) == 0:
+                    score += 0.5
+                    note.append("No release data available! (-0.50&#27683;)")
+            if group in npmcs:
+                if npmcs[group] < afterFull:
+                    score += 1
+                    note.append("No new PMC members invited for more than a year (-1.00&#27683;)")
+                elif npmcs[group] < afterHalf:
+                    score += 0.5
+                    note.append("No new PMC members invited for more than six months (-0.50&#27683;)")
+                else:
+                    score -= 0.5
+                    note.append("New PMC member(s) invited within the last six months (+0.50&#27683;)")
+            elif group != "bookkeeper":
+                score += 2
+                note.append("No new PMC members invited for more than 2 years (-2.00&#27683;)")
+                
+            if group in ncoms:
+                if ncoms[group] < afterFull:
+                    score += 1
+                    note.append("No new committers invited for more than a year (-1.00&#27683;)")
+                elif ncoms[group] < afterHalf:
+                    score += 0.5
+                    note.append("No new committers invited for more than six months (-0.50&#27683;)")
+                elif ncoms[group] < afterQuarter:
+                    score -= 0.5
+                    note.append("New committer(s) invited within the last six months (+0.50&#27683;)")
+                else:
+                    score -= 0.75
+                    note.append("New committer(s) invited within the last three months (+0.75&#27683;)")
+            elif group != "bookkeeper":
+                score += 2
+                note.append("No new committers invited for more than 2 years (-2.00&#27683;)")
+                
+            s = int(score/1.80)
+            if s > 4:
+                s = 4
+            s = s + 1
+            if s < 0:
+                s = 0
+            notes.append ({
+                'pmc': names[group] if (group in names) else group,
+                'score': score,
+                'notes': note,
+                'group': group,
+                'cscore': s
+            })
+        with open("/var/www/reporter.apache.org/data/health.json", "w") as f:
+            f.write(json.dumps(notes))
+            f.close()
+            
+        print ("Content-Type: text/html\r\n\r\n<h1><img src='/img/chi.png' style='vertical-align: middle;'/> Community Health Issues</h1><p>This is a quantitative guideline only. There may be niche cases where the summaries below to not apply. <br/>Scores range from -10.00 (worst possible score) to +10.00 (best possible score), harmonized by <img src='/img/equation.png' style='vertical-align: middle;'/></p>")
+        values = ["Super Healthy", "Healthy", "Mostly Okay", "Unhealthy", "Action required!", "URGENT ACTION REQUIRED!"]
+        xvalues = ["Super Healthy", "Healthy", "Mostly Okay", "Unhealthy", "Action required!", "URGENT ACTION REQUIRED!"]
+        colors = ["#000070", "#007000", "#407000", "#70500", "#700000", "#A00000"]
+        for entry in sorted(notes, key=lambda x: x['score'], reverse=True):
+            s = int(entry['score']/1.80)
+            if s > 4:
+                s = 4
+            s = s + 1
+            if s < 0:
+                s = 0
+            status[s] += 1;
+        
+        y = 0
+        for s in status:
+            xvalues[y] = "%s (%u)" % (values[y], s)
+            y += 1
+        print('<img src="https://chart.googleapis.com/chart?cht=p&amp;chs=640x260&amp;chd=t:%s&amp;chl=%s&amp;chco=0000A0|00A000|A0D000|F0D000|F08500|A00000"/><br/><br/>' % ( ",".join(str(x) for x in status), "|".join(xvalues)))
+              
+        for entry in sorted(notes, key=lambda x: x['score'], reverse=True):
+            s = int(entry['score']/1.80)
+            if s > 4:
+                s = 4
+            s = s + 1
+            if s < 0:
+                s = 0
+            status[s] += 1;
+            print("<font color='%s'>" % colors[s])
+            print "<b id='%s'>%s%s: %s%s</b><br/>\n" % (entry['group'], "<u>" if s >= 4 else "", entry['pmc'], values[s],"</u>" if s >= 4 else "",  )
+            print "<blockquote><b>Health score:</b> %0.2f<br>" % (6.33+((-1 * entry['score'])* (20/12.25)))
+            for l in entry['notes']:
+                print("<b>Score note: </b>%s<br/>" % l)
+            print("</blockquote></font><hr/>\n")
+            
+    else:
+        print ("Content-Type: text/html\r\n\r\n")
+        print("Unknown or invalid member id presented")
+else:
+    print ("Content-Type: text/html\r\n\r\n")
+    print("Unknown or invalid user id presented")

Propchange: comdev/reporter.apache.org/tags/test/site/chi.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: comdev/reporter.apache.org/tags/test/site/chi.py
------------------------------------------------------------------------------
    svn:executable = *