]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - debian/scripts/misc/git-ubuntu-log
12 sys
.stdin
= codecs
.getreader("utf-8")(sys
.stdin
.detach())
13 sys
.stdout
= codecs
.getwriter("utf-8")(sys
.stdout
.detach())
17 if entry
and 'ignore' not in entry
:
18 if 'bugs' not in entry
and 'cves' in entry
:
19 for cve
in entry
['cves']:
24 # Suck up the git log output and extract the information we need.
28 for line
in sys
.stdin
:
29 if line
.startswith('commit '):
34 elif line
.startswith('Author: '):
35 bits
= line
.strip().split(maxsplit
=1)
36 entry
['author'] = bits
[1]
38 elif subject_wait
and line
.startswith(' '):
40 entry
['subject'] = line
.strip()
42 elif line
.startswith(' BugLink: ') and 'launchpad.net' in line
:
43 bits
= line
.strip().split(maxsplit
=1)
44 bits
= bits
[1].split('/')
45 entry
.setdefault('bugs', []).append(bits
[-1])
47 # Accumulate bug numbers.
48 if bits
[-1] not in bugs
:
51 elif line
.startswith(' CVE-'):
52 entry
.setdefault('cves', []).append(line
.strip())
54 elif line
.startswith(' Ignore:'):
55 entry
['ignore'] = True
61 # Go through the entries and clear out authors for upstream commits.
63 if entry
['subject'].startswith('UBUNTU:'):
64 entry
['subject'] = entry
['subject'][7:].strip()
68 # Lump everything without a bug at the bottom.
69 bugs
.append('__packaging__')
70 bugs
.append('__mainline__')
74 if bug
== '__packaging__':
75 title
= 'Miscellaneous Ubuntu changes'
76 elif bug
== '__mainline__':
77 title
= 'Miscellaneous upstream changes'
78 elif bug
.startswith('CVE-'):
84 #urllib.request.urlcleanup()
85 request
= urllib
.request
.Request('https://api.launchpad.net/devel/bugs/' + bug
)
86 request
.add_header('Cache-Control', 'max-age=0')
87 with urllib
.request
.urlopen(request
) as response
:
88 data
= response
.read()
89 bug_info
= json
.loads(data
.decode('utf-8'))
91 title
= bug_info
['title']
92 if 'description' in bug_info
:
93 for line
in bug_info
['description'].split('\n'):
94 if line
.startswith('Kernel-Description:'):
95 title
= line
.split(' ', 1)[1]
97 except urllib
.error
.HTTPError
:
98 title
= 'INVALID or PRIVATE BUG'
100 title
+= ' (LP###' + bug
+ ')'
103 for entry
in entries
:
104 if (bug
== '__packaging__' and 'bugs' not in entry
and 'cves' not in entry
and 'author' in entry
) or \
105 (bug
== '__mainline__' and 'bugs' not in entry
and 'cves' not in entry
and 'author' not in entry
) or \
106 ('bugs' in entry
and bug
in entry
['bugs']) or \
107 ('cves' in entry
and bug
in entry
['cves']):
113 title_lines
= textwrap
.wrap(title
, 76)
114 print(' * ' + title_lines
[0].replace('LP###', 'LP: #'))
115 for line
in title_lines
[1:]:
116 line
= line
.replace('LP###', 'LP: #')
120 title_lines
= textwrap
.wrap(entry
['subject'], 76)
121 print(' - ' + title_lines
[0])
122 for line
in title_lines
[1:]:
123 line
= line
.replace('LP###', 'LP: #')