/usr/src/linux-source-3.13.0/debian/scripts/misc/git-ubuntu-log is in linux-source-3.13.0 3.13.0-106.153.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | #!/usr/bin/python3
import os
import sys
import codecs
import urllib.request
import json
import textwrap
sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach())
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
entries = []
def add_entry(entry):
if entry and 'ignore' not in entry:
if 'bugs' not in entry and 'cves' in entry:
for cve in entry['cves']:
if cve not in bugs:
bugs.append(cve)
entries.append(entry)
# Suck up the git log output and extract the information we need.
bugs = []
entry = None
subject_wait = False
for line in sys.stdin:
if line.startswith('commit '):
add_entry(entry)
entry = {}
subject_wait = True
elif line.startswith('Author: '):
bits = line.strip().split(maxsplit=1)
entry['author'] = bits[1]
elif subject_wait and line.startswith(' '):
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])
# Accumulate bug numbers.
if bits[-1] not in bugs:
bugs.append(bits[-1])
elif line.startswith(' CVE-'):
entry.setdefault('cves', []).append(line.strip())
elif line.startswith(' Ignore:'):
entry['ignore'] = True
add_entry(entry)
entries.reverse()
# Go through the entries and clear out authors for upstream commits.
for entry in entries:
if entry['subject'].startswith('UBUNTU:'):
entry['subject'] = entry['subject'][7:].strip()
else:
del entry['author']
# Lump everything without a bug at the bottom.
bugs.append('__packaging__')
bugs.append('__mainline__')
emit_nl = False
for bug in bugs:
if bug == '__packaging__':
title = 'Miscellaneous Ubuntu changes'
elif bug == '__mainline__':
title = 'Miscellaneous upstream changes'
elif bug.startswith('CVE-'):
title = bug
else:
bug_info = None
try:
#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:
data = response.read()
bug_info = json.loads(data.decode('utf-8'))
title = bug_info['title']
if 'description' in bug_info:
for line in bug_info['description'].split('\n'):
if line.startswith('Kernel-Description:'):
title = line.split(' ', 1)[1]
except urllib.error.HTTPError:
title = 'INVALID or PRIVATE BUG'
title += ' (LP###' + bug + ')'
emit_title = True
for entry in entries:
if (bug == '__packaging__' and 'bugs' not in entry and 'cves' not in entry and 'author' in entry) or \
(bug == '__mainline__' and 'bugs' not in entry and 'cves' not in entry and 'author' not in entry) or \
('bugs' in entry and bug in entry['bugs']) or \
('cves' in entry and bug in entry['cves']):
if emit_title:
if emit_nl:
print('')
emit_nl = True
title_lines = textwrap.wrap(title, 76)
print(' * ' + title_lines[0].replace('LP###', 'LP: #'))
for line in title_lines[1:]:
line = line.replace('LP###', 'LP: #')
print(' ' + line)
emit_title = False
title_lines = textwrap.wrap(entry['subject'], 76)
print(' - ' + title_lines[0])
for line in title_lines[1:]:
line = line.replace('LP###', 'LP: #')
print(' ' + line)
|