Skip to content

Instantly share code, notes, and snippets.

@hroncok
Last active July 28, 2020 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hroncok/8277cbc9126ad95592e1096468259fa0 to your computer and use it in GitHub Desktop.
Save hroncok/8277cbc9126ad95592e1096468259fa0 to your computer and use it in GitHub Desktop.
Watch my FTBFSes
#!/usr/bin/env python3
# usage: $ watch -n 300 myfailures.py $(whoami)
import re
import sys
from urllib.request import urlopen
URL = 'https://kojipkgs.fedoraproject.org/mass-rebuild/f33-failures.html'
USER = sys.argv[1]
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment