Commit 382e33e2 authored by David Spencer's avatar David Spencer

maintainer-status: Popup slackbuild lists, track recent maintainers.

parent 5dc652f5
......@@ -10,7 +10,8 @@
#
# Don't run this too often, because it hammers the Repology API for
# maybe twenty minutes. Repology results may be empty or incomplete due
# to redaction of email addresses.
# to redaction of email addresses. For production use, once per public
# update would be normal.
#
# Requires: python3, and the following (all built with python3 support)
# python-requests
......@@ -18,6 +19,7 @@
# idna
# python-certifi
# Jinja2
# MarkupSafe
#
#-----------------------------------------------------------------------
......@@ -89,6 +91,8 @@ stats_new=0
stats_old=0
stats_maint=0
stats_active=0
stats_recent=0
#-----------------------------------------------------------------------
# (1) Make a list of current maintainers & emails from the .info files.
......@@ -144,6 +148,7 @@ for infofile in glob.glob(repopath+"/*/*/*.info"):
email=email.replace("(removeNOandSPAM)","")
email=email.replace("SPAM","")
email=email.replace(" at ","@")
email=email.replace("<at>","@")
email=email.replace("_at_","@")
email=email.replace("-at-","@")
email=email.replace("{at}","@")
......@@ -156,6 +161,7 @@ for infofile in glob.glob(repopath+"/*/*/*.info"):
email=email.replace("{@}","@")
email=email.replace("_@_","@")
email=email.replace(" dot ",".")
email=email.replace("<dot>",".")
email=email.replace("[dot]",".")
email=email.replace("[DOT]",".")
email=email.replace("DOT",".")
......@@ -256,22 +262,30 @@ for rawline in gitlog.stdout.splitlines():
report_title="SBo maintainer status"
report_datetime=datetime.datetime.now().strftime("%Y-%m-%d %T")
# Magic date when 14.2 was released -- flag maintainers who have made
# no contributions in the current cycle
epoch142="2016-06-30"
# Date since which a maintainer is "recent"
recentdays=180
recentdate=(datetime.datetime.now()-datetime.timedelta(days=recentdays)).strftime("%Y-%m-%d")
# Date before which a maintainer is "inactive" (hardcoded release date of 14.2)
inactivedate="2016-06-30"
# Maintainer number to identify the modal popup of slackbuilds
mnum=0
for mname, mdeets in maintainerinfo.items():
mdeets["tdmaintainer"]=mname
mdeets["mnum"]=mnum ; mnum+=1
mdeets["tdslackbuilds"]="{:d}".format(len(mdeets["slackbuilds"]))
#### modal popup of slackbuilds goes here
mdeets["era"]="pre142"
mdeets["status"]="inactive"
if "latest" in mdeets:
mdeets["tdlatest"]="<a class=\"c\" target=\"_blank\" href=\"https://git.slackbuilds.org/slackbuilds/commit/?id={:s}\">{:s}</a>".format(mdeets["latest"]["commit"],mdeets["latest"]["date"])
if mdeets["latest"]["date"] >= epoch142:
mdeets["era"]="post142"
if mdeets["latest"]["date"] >= inactivedate:
mdeets["status"]="active"
stats_active+=1
if mdeets["latest"]["date"] >= recentdate:
mdeets["status"]="recent"
stats_recent+=1
else:
mdeets["tdlatest"]="Never"
......@@ -294,11 +308,6 @@ for mname, mdeets in maintainerinfo.items():
mdeets["tdoutofdatepct"]="-"
import pickle
pickle.dump(maintainerinfo,open("save2.p","wb"))
#-----------------------------------------------------------------------
# (3) Render the template and print the results.
......@@ -313,7 +322,8 @@ print(
stats_new=stats_new,
stats_old=stats_old,
stats_maint=stats_maint,
stats_active=stats_active
stats_active=stats_active,
stats_recent=stats_recent
)
)
......
......@@ -7,15 +7,52 @@
<title>{{ report_title }}</title>
<style>
table {border:1px solid;border-collapse:collapse}
.pre142 {background-color:#ffccee}
.inactive {background-color:#ffdddd}
.active {background-color:#ffffff}
.recent {background-color:#ddffdd}
.e {font-size:small}
.t {font-size:small; height: 320px; overflow-y:auto}
.m {text-align:left; padding:0.5rem; border:1px solid}
.l {text-align:center; padding:0.5rem; border:1px solid}
.s {text-align:center; padding:0.5rem; border:1px solid}
.n {text-align:right; padding:0.5rem; border:1px solid}
.n {text-align:center; padding:0.5rem; border:1px solid}
.np {text-align:right; padding:0.5rem; border:1px solid}
.o {text-align:right; padding:0.5rem; border:1px solid}
.o {text-align:center; padding:0.5rem; border:1px solid}
.op {text-align:right; padding:0.5rem; border:1px solid}
.modal {
position: fixed;
top: 0; right: 0; bottom: 0; left: 0;
background: rgba(0,0,0,0.8);
z-index: 9;
opacity:0;
pointer-events: none;
}
.modal:target { opacity:1; pointer-events:auto }
.modal > div {
width: 400px; height: 400px;
position: relative;
margin: 10% auto;
padding: 5px 5px 5px 5px;
background: #ffffff;
background: -moz-linear-gradient(#ffffff, #999999);
background: -webkit-linear-gradient(#ffffff, #999999);
background: -o-linear-gradient(#ffffff, #999999);
}
.close {
background: #606060;
color: #ffffff;
position: absolute;
line-height: 24px;
width: 24px;
right: 0; top: 0;
text-align: center;
text-decoration: none;
-webkit-box-shadow: 1px 1px 3px #000000;
-moz-box-shadow: 1px 1px 3px #000000;
box-shadow: 1px 1px 3px #000000;
}
.close:hover { background: #ff4444; }
</style>
<!-- sortable.js from https://www.kryogenix.org/code/browser/sorttable/ -->
<script src="sorttable.js"></script>
......@@ -26,19 +63,19 @@
<h1>{{ report_title }}</h1>
<h2>Summary</h2>
<p>Report generated: {{ report_datetime }}
<br>SlackBuilds: {{ "{:d}".format(stats_sb) }}
<br>&nbsp;&nbsp;newest: {{ "{:d} ({:.1f}%)".format(stats_new,stats_new*100/stats_sb) }}
<br>&nbsp;&nbsp;out of date: {{ "{:d} ({:.1f}%)".format(stats_old,stats_old*100/stats_sb) }}
<br>Maintainers: {{ stats_maint }}
<br>&nbsp;&nbsp;active: {{ "{:d} ({:.1f}%)".format(stats_active,stats_active*100/stats_maint) }}
<p>Report generated: {{ report_datetime }}</p>
<p>SlackBuilds
<br>&nbsp;&nbsp;&nbsp;total: {{ "{:d}".format(stats_sb) }}
<br>&nbsp;&nbsp;&nbsp;newest: {{ "{:d} ({:.1f}%)".format(stats_new,stats_new*100/stats_sb) }}
<br>&nbsp;&nbsp;&nbsp;out of date: {{ "{:d} ({:.1f}%)".format(stats_old,stats_old*100/stats_sb) }}
</p>
<p>Maintainers
<br>&nbsp;&nbsp;&nbsp;total: {{ stats_maint }}
<br>&nbsp;&nbsp;&nbsp;active: {{ "{:d} ({:.1f}%)".format(stats_active,stats_active*100/stats_maint) }} since 14.2
<br>&nbsp;&nbsp;&nbsp;recent: {{ "{:d} ({:.1f}%)".format(stats_recent,stats_recent*100/stats_maint) }} last 180 days
</p>
<h2>Maintainer details</h2>
<table class="sortable">
<thead>
......@@ -54,11 +91,11 @@
</thead>
<tbody>
{% for mname, mdeets in maintainerinfo.items() %}
<tr id="{{ mname }}" class="{{ mdeets['era'] }}" >
{% for mname, mdeets in maintainerinfo|dictsort(true) %}
<tr id="m{{ mdeets['mnum'] }}" class="{{ mdeets['status'] }}">
<td class="m">{{ mdeets["tdmaintainer"] }}</td>
<td class="l">{{ mdeets["tdlatest"] }}</td>
<td class="s">{{ mdeets["tdslackbuilds"] }}</td>
<td class="s"><a href="#sb{{ mdeets["mnum"] }}">{{ mdeets["tdslackbuilds"] }}</a></td>
<td class="n">{{ mdeets["tdnewest"] }}</td>
<td class="np">{{ mdeets["tdnewestpct"] }}</td>
<td class="o">{{ mdeets["tdoutofdate"] }}</td>
......@@ -69,6 +106,15 @@
</table>
{% for mname, mdeets in maintainerinfo.items() %}
<div id="sb{{ mdeets['mnum'] }}" class="modal">
<div>
<a href="#close" title="Close" class="close">&otimes;</a>
<p>{{ mname }}</p>
<p class="t">{{ mdeets["slackbuilds"]|sort|join("<br>") }}</p>
</div>
</div>
{% endfor %}
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment