#!/usr/bin/python3
-import os
import sys
import codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
entries = []
+
+
def add_entry(entry):
if entry and 'ignore' not in entry:
combo = []
entry['key'] = combo
entries.append(entry)
+
# Suck up the git log output and extract the information we need.
keys = []
entry = None
subject_wait = False
entry['subject'] = line.strip()
- elif line.startswith(' BugLink: ') and 'launchpad.net' in line:
- bits = line.strip().split(maxsplit=1)
- bits = bits[1].split('/')
- entry.setdefault('bugs', []).append(bits[-1])
+ elif line.startswith(' BugLink: '):
+ bits = line.strip().split(maxsplit=2)
+ if len(bits) > 2:
+ # There is text after the URL, so use that (after stripping the
+ # enclosing characters)
+ entry.setdefault('bugs', []).append(bits[2][1:-1])
+ elif 'launchpad.net' in bits[1]:
+ # Extract the bug number from the launchpad URL
+ bits = bits[1].split('/')
+ entry.setdefault('bugs', []).append(bits[-1])
elif line.startswith(' CVE-'):
entry.setdefault('cves', []).append(line.strip())
emit_nl = False
for key in keys:
if key == '__packaging__':
- title_set = [ 'Miscellaneous Ubuntu changes' ]
+ title_set = ['Miscellaneous Ubuntu changes']
elif key == '__mainline__':
- title_set = [ 'Miscellaneous upstream changes' ]
+ title_set = ['Miscellaneous upstream changes']
else:
title_set = []
for bug in key:
# Look for the tracking bug number on the second
# position of the key
continue
- else:
+ elif bug.isdigit():
+ # Assume that it is an LP bug number if 'bug' contains only digits
bug_info = None
try:
- #urllib.request.urlcleanup()
+ # urllib.request.urlcleanup()
request = urllib.request.Request('https://api.launchpad.net/devel/bugs/' + bug)
request.add_header('Cache-Control', 'max-age=0')
with urllib.request.urlopen(request) as response:
title += ' (LP###' + bug + ')'
title_set.append(title)
-
+ else:
+ # Finally treat 'bug' itself as the title
+ title_set.append(bug)
emit_title = True
for entry in entries: