Skip to content

Instantly share code, notes, and snippets.

@Habbie
Created October 21, 2022 08:56
Show Gist options
  • Select an option

  • Save Habbie/55124df8e856715d1cad302a89f40f11 to your computer and use it in GitHub Desktop.

Select an option

Save Habbie/55124df8e856715d1cad302a89f40f11 to your computer and use it in GitHub Desktop.
#!/usr/bin/python2
import yaml
import requests
import sys
import re
def getTitleForBugs(bugs):
ret = []
title_regex = re.compile(r'<title>(.*) - Debian Bug report logs</title>')
for bug in bugs:
bug_r = requests.get('https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s' % bug)
lines = bug_r.text.split('\n')
for line in lines:
match = title_regex.search(line)
if match:
ret.append(match.group(1))
break
return ret
r = requests.get('https://udd.debian.org/cgi-bin/autoremovals.yaml.cgi')
data = yaml.load(r.text, Loader=yaml.SafeLoader)
msg = ''
exit = 0
if 'pdns' in data.keys():
exit = 1
msg += "PowerDNS slated for removal from Debian on %s " % data['pdns']['removal_date']
if data['pdns']['dependencies_only']:
msg += "because there are bugged dependencies.\n\n"
else:
msg += "because of a bug in PowerDNS!\n\n"
bugs = getTitleForBugs(data['pdns'].get('bugs_dependencies', []))
if len(bugs):
msg += "This is caused by the following dependency bug%s:\n " % ('s' if len(bugs) > 1 else '')
msg += '\n '.join(bugs)
bugs = getTitleForBugs(data['pdns']['bugs'])
if len(bugs):
msg += "This is caused by the following bug%s in PowerDNS:\n " % ('s' if len(bugs) > 1 else '')
msg += '\n '.join(bugs)
else:
msg += "PowerDNS is not slated for removal from Debian (yay!)"
print msg
sys.exit(exit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment