Skip to content

Instantly share code, notes, and snippets.

@encukou
Forked from hroncok/myfailures.py
Created July 25, 2019 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save encukou/a5a5a3d7bb52cfad3f28b7ef31e71089 to your computer and use it in GitHub Desktop.
Save encukou/a5a5a3d7bb52cfad3f28b7ef31e71089 to your computer and use it in GitHub Desktop.
Watch my FTBFSes
#! /usr/bin/env -S bash -c 'watch -n 300 I=$(whoami) python3.8 myfailures.py'
import re
import sys
import os
from urllib.request import urlopen
URL = 'https://kojipkgs.fedoraproject.org/mass-rebuild/f31-failures.html'
#USER = sys.argv[1]
USER = os.environ['I']
USER_RE = re.compile(fr'<dt>{USER} \(\d+\):</dt>')
FAIL_RE = re.compile(r'<dd><a href="(?P<link>[^"]+)">(?P<pkg>[^<]+)</a></dd>')
with urlopen(URL) as response:
text = response.read().decode('utf-8')
mine = False
for line in text.splitlines():
if mine:
if match := FAIL_RE.match(line):
pkg = match.group('pkg')
link = match.group('link')
print(f'{pkg:20}{link}')
else:
break
elif USER_RE.match(line):
mine = True
print('---')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment