buildbot: move a bunch of code to buildbot_html.py and remove some unused code