diff options
Diffstat (limited to 'maintainer-timeout.py')
-rwxr-xr-x | maintainer-timeout.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/maintainer-timeout.py b/maintainer-timeout.py index 76c7e59..54b4044 100755 --- a/maintainer-timeout.py +++ b/maintainer-timeout.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # Copyright 2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -6,11 +6,11 @@ import datetime import optparse import os.path import sys +import xmlrpc.client -from bugz.bugzilla import BugzillaProxy import portage.versions -from common import Bug, chunks, login, detect_cpvs +from common import login, detect_cpvs def keyword_to_email(keyword): @@ -27,12 +27,20 @@ if __name__ == "__main__": parser.error("unrecognized command-line args") url = 'https://bugs.gentoo.org/xmlrpc.cgi' - print 'You will be prompted for your Gentoo Bugzilla username and password (%s).' % url - bugzilla = BugzillaProxy(url) + print('You will be prompted for your Gentoo Bugzilla username and password (%s).' % url) + bugzilla = xmlrpc.client.ServerProxy(url) user, login_data = login(bugzilla) - bugs = bugzilla.Bug.search({'reporter': user, 'summary': ['stabilize', 'stabilization', 'stable'], 'resolution': ''})['bugs'] - comments = bugzilla.Bug.comments({'ids': [bug['id'] for bug in bugs]}) + params = {} + params['Bugzilla_token'] = login_data['token'] + params['reporter'] = user + params['summary'] = ['stabilize', 'stabilization', 'stable'] + params['resolution'] = '' + bugs = bugzilla.Bug.search(params)['bugs'] + params = {} + params['Bugzilla_token'] = login_data['token'] + params['ids'] = [bug['id'] for bug in bugs] + comments = bugzilla.Bug.comments(params) for bug in bugs: # Skip bugs where stabilization seems to be already in progress. arch_found = False @@ -68,6 +76,7 @@ if __name__ == "__main__": target_keywords.add(keyword) params = {} + params['Bugzilla_token'] = login_data['token'] params['ids'] = [bug['id']] params['cc'] = {} params['cc']['add'] = list(set(keyword_to_email(k) for k in target_keywords)) @@ -75,7 +84,11 @@ if __name__ == "__main__": params['comment']['body'] = 'Maintainer timeout (%d days). Arches please go ahead.' % options.days bugzilla.Bug.update(params) - print 'Updated bug #%s (%s). Target KEYWORDS: %s ;-)' % ( + print('Updated bug #%s (%s). Target KEYWORDS: %s ;-)' % ( bug['id'], bug['summary'], - ', '.join(list(target_keywords))) + ', '.join(list(target_keywords)))) + + params = {} + params['Bugzilla_token'] = login_data['token'] + bugzilla.User.logout(params) |