@@ -1,5 +1,5 @@
11#!/usr/bin/env nix-shell
2−#!nix-shell -i python -p pythonFull pythonPackages.requests pythonPackages.pyquery pythonPackages.click
2+#!nix-shell -i python3 -p 'python3.withPackages(ps: with ps; [ requests pyquery click ])'
33
44# To use, just execute this script with --help to display help.
55
@@ -16,7 +16,7 @@ maintainers_json = subprocess.check_output([
1616 'nix-instantiate', '-E', 'import ./maintainers/maintainer-list.nix {}', '--eval', '--json'
1717])
1818maintainers = json.loads(maintainers_json)
19−MAINTAINERS = {v: k for k, v in maintainers.iteritems()}
19+MAINTAINERS = {v: k for k, v in maintainers.items()}
2020
2121
2222def get_response_text(url):
@@ -45,6 +45,17 @@ def get_maintainers(attr_name):
4545 except:
4646 return []
4747
48+def print_build(table_row):
49+ a = pq(table_row)('a')[1]
50+ 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))))
55+ # TODO: print last three persons that touched this file
56+ # TODO: pinpoint the diff that broke this build, or maybe it's transient or maybe it never worked?
57+
58+ sys.stdout.flush()
4859
4960@click.command()
5061@click.option(
@@ -73,23 +84,17 @@ def cli(jobset):
7384
7485 # TODO: aborted evaluations
7586 # TODO: dependency failed without propagated builds
87+ print('\nFailures:')
7688 for tr in d('img[alt="Failed"]').parents('tr'):
77− a = pq(tr)('a')[1]
78− print("- [ ] [{}]({})".format(a.text, a.get('href')))
89+ print_build(tr)
7990
80− sys.stdout.flush()
81−
82− maintainers = get_maintainers(a.text)
83− if maintainers:
84− print(" - maintainers: {}".format(", ".join(map(lambda u: '@' + u, maintainers))))
85− # TODO: print last three persons that touched this file
86− # TODO: pinpoint the diff that broke this build, or maybe it's transient or maybe it never worked?
87−
88− sys.stdout.flush()
91+ print('\nDependency failures:')
92+ for tr in d('img[alt="Dependency failed"]').parents('tr'):
93+ print_build(tr)
8994
9095
9196if __name__ == "__main__":
9297 try:
9398 cli()
94− except:
99+ except Exception as e:
95100 import pdb;pdb.post_mortem()