Created
October 21, 2022 08:56
-
-
Save Habbie/55124df8e856715d1cad302a89f40f11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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