@@ -11,13 +11,15 @@ import click
1111import requests
1212from pyquery import PyQuery as pq
1313
14+def map_dict (f, d):
15+ for k,v in d.items():
16+ d[k] = f(v)
1417
1518maintainers_json = subprocess.check_output([
16− 'nix-instantiate', '-E', 'import ./maintainers/maintainer-list.nix {}', '--eval', '--json'
19+ 'nix-instantiate', '-A', 'lib.maintainers', '--eval', '--strict', '--json'
1720])
1821maintainers = json.loads(maintainers_json)
19−MAINTAINERS = {v: k for k, v in maintainers.items()}
20−
22+MAINTAINERS = map_dict(lambda v: v.get('github', None), maintainers)
2123
2224def get_response_text(url):
2325 return pq(requests.get(url).text) # IO
@@ -38,30 +40,39 @@ def get_maintainers(attr_name):
3840 '-A',
3941 '.'.join(nixname[1:]) + '.meta',
4042 EVAL_FILE[nixname[0]],
43+ '--arg',
44+ 'nixpkgs',
45+ './.',
4146 '--json'])
4247 meta = json.loads(meta_json)
43− if meta.get('maintainers'):
44− return [MAINTAINERS[name] for name in meta['maintainers'] if MAINTAINERS.get(name)]
48+ return meta.get('maintainers', [])
4549 except:
4650 return []
4751
52+def filter_github_users(maintainers):
53+ github_only = []
54+ for i in maintainers:
55+ if i.get('github'):
56+ github_only.append(i)
57+ return github_only
58+
4859def print_build(table_row):
4960 a = pq(table_row)('a')[1]
5061 print("- [ ] [{}]({})".format(a.text, a.get('href')), flush=True)
51−
52− maintainers = get_maintainers(a.text)
53− if maintainers:
54− print(" - maintainers: {}".format(", ".join(map(lambda u: '@' + u, maintainers))))
62+
63+ job_maintainers = filter_github_users(get_maintainers(a.text))
64+ if job_maintainers:
65+ print(" - maintainers: {}".format(" ".join(map(lambda u: '@' + u.get('github'), job_maintainers))))
5566 # TODO: print last three persons that touched this file
5667 # TODO: pinpoint the diff that broke this build, or maybe it's transient or maybe it never worked?
57−
68+
5869 sys.stdout.flush()
5970
6071@click.command()
6172@click.option(
6273 '--jobset',
63− default="nixos/release-17.09",
64− help='Hydra project like nixos/release-17.09')
74+ default="nixos/release-19.09",
75+ help='Hydra project like nixos/release-19.09')
6576def cli(jobset):
6677 """
6778 Given a Hydra project, inspect latest evaluation
@@ -93,6 +104,7 @@ def cli(jobset):
93104 print_build(tr)
94105
95106
107+
96108if __name__ == "__main__":
97109 try:
98110 cli()