]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - debian/scripts/misc/git-ubuntu-log
4bf738f8fed1ac3bfdad076637190634bb7b4ddf
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
:
19 for bug
in entry
.get('bugs', []):
21 for cve
in entry
.get('cves', []):
26 if entry
.get('subject', "").startswith('UBUNTU'):
27 combo
= '__packaging__'
29 combo
= '__mainline__'
31 if entry
.get('subject', "") == 'UBUNTU: link-to-tracker: update tracking bug':
32 # Construct a key with '__trackingbug__' on the first position
33 # and the tracking bug number afterwards
34 combo
.insert(0, '__trackingbug__')
35 # Tracking bug goes at the top
44 # Suck up the git log output and extract the information we need.
48 for line
in sys
.stdin
:
49 if line
.startswith('commit '):
54 elif line
.startswith('Author: '):
55 bits
= line
.strip().split(maxsplit
=1)
56 entry
['author'] = bits
[1]
58 elif subject_wait
and line
.startswith(' '):
60 entry
['subject'] = line
.strip()
62 elif line
.startswith(' BugLink: ') and 'launchpad.net' in line
:
63 bits
= line
.strip().split(maxsplit
=1)
64 bits
= bits
[1].split('/')
65 entry
.setdefault('bugs', []).append(bits
[-1])
67 elif line
.startswith(' CVE-'):
68 entry
.setdefault('cves', []).append(line
.strip())
70 elif line
.startswith(' Ignore:'):
71 entry
['ignore'] = True
77 # Go through the entries and clear out authors for upstream commits.
79 if entry
['subject'].startswith('UBUNTU:'):
80 entry
['subject'] = entry
['subject'][7:].strip()
84 # Lump everything without a bug at the bottom.
85 keys
.append('__packaging__')
86 keys
.append('__mainline__')
90 if key
== '__packaging__':
91 title_set
= [ 'Miscellaneous Ubuntu changes' ]
92 elif key
== '__mainline__':
93 title_set
= [ 'Miscellaneous upstream changes' ]
97 if bug
.startswith('CVE-'):
99 elif bug
== '__trackingbug__':
100 # Look for the tracking bug number on the second
101 # position of the key
107 #urllib.request.urlcleanup()
108 request
= urllib
.request
.Request('https://api.launchpad.net/devel/bugs/' + bug
)
109 request
.add_header('Cache-Control', 'max-age=0')
110 with urllib
.request
.urlopen(request
) as response
:
111 data
= response
.read()
112 bug_info
= json
.loads(data
.decode('utf-8'))
114 title
= bug_info
['title']
115 if 'description' in bug_info
:
116 for line
in bug_info
['description'].split('\n'):
117 if line
.startswith('Kernel-Description:'):
118 title
= line
.split(' ', 1)[1]
120 except urllib
.error
.HTTPError
:
121 title
= 'INVALID or PRIVATE BUG'
123 title
+= ' (LP###' + bug
+ ')'
124 title_set
.append(title
)
128 for entry
in entries
:
129 if entry
['key'] != key
:
137 title_lines
= textwrap
.wrap('#// '.join(title_set
), 76)
138 print(' * ' + title_lines
[0].replace('LP###', 'LP: #').replace('#//', ' //'))
139 for line
in title_lines
[1:]:
140 line
= line
.replace('LP###', 'LP: #').replace('#//', ' //')
145 if key
[0] != '__trackingbug__':
146 title_lines
= textwrap
.wrap(entry
['subject'], 76)
147 print(' - ' + title_lines
[0])
148 for line
in title_lines
[1:]:
149 line
= line
.replace('LP###', 'LP: #')