]> git.scottworley.com Git - nix-currently-building/blame - nix_currently_building.py
Remove blocksize-multiple check
[nix-currently-building] / nix_currently_building.py
CommitLineData
879c383c
SW
1import os
2import subprocess
3import time
4
5
24d5e0c8 6MIN_AGE = time.time() - 86400 * 1
879c383c
SW
7
8
9def removesuffix(s, suf): # Until python 3.9
10 return s[:len(s) - len(suf)] if s.endswith(suf) else s
11
12
13def truncated(log):
14 return subprocess.run(['bunzip2', '--test', log], stderr=subprocess.DEVNULL).returncode == 2
15
16
17def main():
18 for d, _, files in os.walk(os.environ.get('NIX_LOG_DIR', '/nix/var/log/nix')):
19 for f in files:
20 path = os.path.join(d, f)
21 st = os.stat(path)
24d5e0c8 22 if st.st_mtime > MIN_AGE and truncated(path):
879c383c
SW
23 print(d[-2:] + removesuffix(f, '.bz2'))
24
25
26if __name__ == '__main__':
27 main()