Skip to content

Commit

Permalink
Produce a report to help identify long-inactive maintainers
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-turney committed May 28, 2024
1 parent 6d0234c commit b586495
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 3 deletions.
9 changes: 9 additions & 0 deletions calm/maintainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# - an email address (in HOME/!email (or !mail), as we don't want to publish
# it, and want to allow the maintainer to change it)
# - the timestamp when 'ignoring' warnings were last emitted
# - the timestamp of their last ssh connection
#

import logging
Expand Down Expand Up @@ -84,6 +85,7 @@ def __init__(self, name, email=None, pkgs=None):
self.email = email
self.pkgs = pkgs
self.quiet = False
self.has_homedir = os.path.isdir(self.homedir())

# the mtime of this file records the timestamp
reminder_file = os.path.join(self.homedir(), '!reminder-timestamp')
Expand All @@ -94,6 +96,13 @@ def __init__(self, name, email=None, pkgs=None):
self.reminders_issued = False
self.reminders_timestamp_checked = False

# the mtime of this file records the last ssh session
last_seen_file = os.path.join(self.homedir(), '.last-seen')
if os.path.isfile(last_seen_file):
self.last_seen = os.path.getmtime(last_seen_file)
else:
self.last_seen = 0 # meaning 'unknown'

def __repr__(self):
return "maintainers.Maintainer('%s', %s, %s)" % (self.name, self.email, self.pkgs)

Expand Down
5 changes: 4 additions & 1 deletion calm/pkg2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ def ensure_dir_exists(args, path):
# format a unix epoch time (UTC)
#
def tsformat(ts):
return time.strftime('%Y-%m-%d %H:%M', time.gmtime(ts))
if ts == 0:
return 'Unknown'
else:
return time.strftime('%Y-%m-%d %H:%M', time.gmtime(ts))


#
Expand Down
70 changes: 69 additions & 1 deletion calm/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def write_report(args, title, body, fn, reportlist, not_empty=True):


def linkify(pn, po):
return '<a href="/packages/summary/{0}.html">{1}</a>'.format(pn, po.orig_name)
return '<a href="/packages/summary/{0}.html">{1}</a>'.format(po.name, po.orig_name)


#
Expand Down Expand Up @@ -281,6 +281,72 @@ def unstable(args, packages, reportlist):
write_report(args, 'Packages marked as unstable', body, 'unstable.html', reportlist)


# produce a report on maintainer (in)activity
#
def maintainer_activity(args, packages, reportlist):
activity_list = []

arch = 'x86_64'
# XXX: look into how we can make this 'src', after x86 is dropped

ml = maintainers.maintainer_list(args)
for m in ml.values():
if m.name == 'ORPHANED':
continue

a = types.SimpleNamespace()
a.name = m.name
a.last_seen = m.last_seen

count = 0
mtime = 0
pkgs = []
for p in m.pkgs:
if not p.is_orphaned():
count += 1

pn = p.data + '-src'
# do something reasonable for sourceless packages
if pn not in packages[arch]:
pn = p.data

po = packages[arch].get(pn, None)
if po:
pkgs.append(pn)

for v in po.versions():
if po.tar(v).mtime > mtime:
mtime = po.tar(v).mtime

# ignore if all their packages are orphaned
# (key should be already disabled in this case)
if count == 0:
continue

a.count = count
a.pkgs = pkgs
a.last_package = mtime

activity_list.append(a)

body = io.StringIO()
print('<p>Maintainer activity.</p>', file=body)

print('<table class="grid sortable">', file=body)
print('<tr><th>Maintainer</th><th># packages</th><th>Last ssh</th><th>Latest package</th></tr>', file=body)

for a in sorted(activity_list, key=lambda i: (i.last_seen, i.last_package)):
def pkg_details(pkgs):
return '<details><summary>%d</summary>%s</details>' % (len(pkgs), ', '.join(linkify(p, packages[arch][p]) for p in pkgs))

print('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' %
(a.name, pkg_details(a.pkgs), pkg2html.tsformat(a.last_seen), pkg2html.tsformat(a.last_package)), file=body)

print('</table>', file=body)

write_report(args, 'Maintainer activity', body, 'maintainer_activity.html', reportlist, not_empty=False)


# produce a report of packages which need rebuilding for the latest major
# version version provides
#
Expand Down Expand Up @@ -463,6 +529,8 @@ def do_reports(args, packages):
provides_rebuild(args, packages, 'ruby_rebuilds.html', 'ruby', reportlist)
python_rebuild(args, packages, 'python_rebuilds.html', reportlist)

maintainer_activity(args, packages, reportlist)

fn = os.path.join(args.htdocs, 'reports_list.inc')
with utils.open_amifc(fn) as f:
print('<ul>', file=f)
Expand Down
7 changes: 6 additions & 1 deletion test/testdata/process_arch/htdocs.expected
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{'.': ['calm.db', 'packages.inc', 'reports_list.inc', 'src_packages.inc'],
'reports': ['deprecated_so.html', 'perl_rebuilds.html', 'ruby_rebuilds.html', 'unmaintained.html', 'unstable.html'],
'reports': ['deprecated_so.html',
'maintainer_activity.html',
'perl_rebuilds.html',
'ruby_rebuilds.html',
'unmaintained.html',
'unstable.html'],
'summary': ['arc-src.html',
'arc.html',
'base-cygwin.html',
Expand Down

0 comments on commit b586495

Please sign in to comment.