Update purge_builds.py after bug 991230. (Also includes changes from bug 861733 that were never imported.). r=catlee

--HG--
branch : production
Merge heads

--HG--
branch : production