]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - debian/scripts/misc/git-ubuntu-log
02c346194280c60a7b3d08d4dbf4b0cbe16bd7a8
11 sys
.stdin
= codecs
.getreader("utf-8")(sys
.stdin
.detach())
12 sys
.stdout
= codecs
.getwriter("utf-8")(sys
.stdout
.detach())
18 if entry
and 'ignore' not in entry
:
20 for bug
in entry
.get('bugs', []):
22 for cve
in entry
.get('cves', []):
27 if entry
.get('subject', "").startswith('UBUNTU'):
28 combo
= '__packaging__'
30 combo
= '__mainline__'
32 if entry
.get('subject', "") == 'UBUNTU: link-to-tracker: update tracking bug':
33 # Construct a key with '__trackingbug__' on the first position
34 # and the tracking bug number afterwards
35 combo
.insert(0, '__trackingbug__')
36 # Tracking bug goes at the top
46 # Suck up the git log output and extract the information we need.
50 for line
in sys
.stdin
:
51 if line
.startswith('commit '):
56 elif line
.startswith('Author: '):
57 bits
= line
.strip().split(maxsplit
=1)
58 entry
['author'] = bits
[1]
60 elif subject_wait
and line
.startswith(' '):
62 entry
['subject'] = line
.strip()
64 elif line
.startswith(' BugLink: '):
65 bits
= line
.strip().split(maxsplit
=2)
67 # There is text after the URL, so use that (after stripping the
68 # enclosing characters)
69 entry
.setdefault('bugs', []).append(bits
[2][1:-1])
70 elif 'launchpad.net' in bits
[1]:
71 # Extract the bug number from the launchpad URL
72 bits
= bits
[1].split('/')
73 entry
.setdefault('bugs', []).append(bits
[-1])
75 elif line
.startswith(' CVE-'):
76 entry
.setdefault('cves', []).append(line
.strip())
78 elif line
.startswith(' Ignore:'):
79 entry
['ignore'] = True
85 # Go through the entries and clear out authors for upstream commits.
87 if entry
['subject'].startswith('UBUNTU:'):
88 entry
['subject'] = entry
['subject'][7:].strip()
92 # Lump everything without a bug at the bottom.
93 keys
.append('__packaging__')
94 keys
.append('__mainline__')
98 if key
== '__packaging__':
99 title_set
= ['Miscellaneous Ubuntu changes']
100 elif key
== '__mainline__':
101 title_set
= ['Miscellaneous upstream changes']
105 if bug
.startswith('CVE-'):
106 title_set
.append(bug
)
107 elif bug
== '__trackingbug__':
108 # Look for the tracking bug number on the second
109 # position of the key
112 # Assume that it is an LP bug number if 'bug' contains only digits
116 # urllib.request.urlcleanup()
117 request
= urllib
.request
.Request('https://api.launchpad.net/devel/bugs/' + bug
)
118 request
.add_header('Cache-Control', 'max-age=0')
119 with urllib
.request
.urlopen(request
) as response
:
120 data
= response
.read()
121 bug_info
= json
.loads(data
.decode('utf-8'))
123 title
= bug_info
['title']
124 if 'description' in bug_info
:
125 for line
in bug_info
['description'].split('\n'):
126 if line
.startswith('Kernel-Description:'):
127 title
= line
.split(' ', 1)[1]
129 except urllib
.error
.HTTPError
:
130 title
= 'INVALID or PRIVATE BUG'
132 title
+= ' (LP###' + bug
+ ')'
133 title_set
.append(title
)
135 # Finally treat 'bug' itself as the title
136 title_set
.append(bug
)
139 for entry
in entries
:
140 if entry
['key'] != key
:
148 title_lines
= textwrap
.wrap('#// '.join(title_set
), 76)
149 print(' * ' + title_lines
[0].replace('LP###', 'LP: #').replace('#//', ' //'))
150 for line
in title_lines
[1:]:
151 line
= line
.replace('LP###', 'LP: #').replace('#//', ' //')
156 if key
[0] != '__trackingbug__':
157 title_lines
= textwrap
.wrap(entry
['subject'], 76)
158 print(' - ' + title_lines
[0])
159 for line
in title_lines
[1:]:
160 line
= line
.replace('LP###', 'LP: #')