blob: 24f8463596cb773fe13af5a7483e562822344191 (
plain)
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
|
#!/usr/bin/env python
# Copyright 2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import portage.versions
import requests
import sys
from tatt.tattConfig import tattConfig as tattConfig
def main():
tattconfig = tattConfig()
session = requests.Session()
session.params.update({'Bugzilla_api_key': tattconfig['bugzilla-key']})
bug_url = tattconfig['bugzilla-url']
bug_id = str(@@BUG@@)
params = {'id': bug_id}
response = session.get(tattconfig['bugzilla-url'] + '/rest/bug', params=params).json()
if 'message' in response:
print(response['message'])
sys.exit(1)
response = response['bugs'][0]
has_my_arch = False
has_other_arches = False
for cc in response['cc']:
body, domain = cc.split('@', 1)
if domain == 'gentoo.org':
if body == '@@ARCH@@':
has_my_arch = True
elif body in portage.archlist:
has_other_arches = True
# We don't close bugs which still have other arches for obvious reasons,
# and security bugs because stabilization is not the last step for them.
params['cc'] = {}
if has_my_arch:
params['cc']['remove'] = ['@@ARCH@@@gentoo.org']
params['comment'] = {}
if has_other_arches or 'Security' in response['product']:
params['comment']['body'] = '@@ARCH@@ stable'
else:
params['comment']['body'] = '@@ARCH@@ stable, closing'
params['status'] = 'RESOLVED'
params['resolution'] = 'FIXED'
session.put(tattconfig['bugzilla-url'] + '/rest/bug/' + bug_id, json=params)
if __name__ == '__main__':
main()
|