summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2014-12-13 13:33:09 -0600
committerPawel Hajdan, Jr <phajdan.jr@gentoo.org>2014-12-29 15:52:27 +0100
commit842f3d251d81ffc274fa01a1d9ba9b5794a2d714 (patch)
tree8754a07f108bb8715a2c83c4f0fdd25c485c33e2 /maintainer-timeout.py
parentFix issue in batch-stabilize leading to errors from Bugzilla (diff)
downloadarch-tools-842f3d251d81ffc274fa01a1d9ba9b5794a2d714.tar.gz
arch-tools-842f3d251d81ffc274fa01a1d9ba9b5794a2d714.tar.bz2
arch-tools-842f3d251d81ffc274fa01a1d9ba9b5794a2d714.zip
Port most tools to python 3
This commit ports the following tools to python 3. - common code - batch-stabilize - file-stabilization-bugs - maintainer-timeout - reverse-dependencies - stabilization-candidates This is a list of the changes: - Remove the dependency on pybugz; these tools now use xmlrpc.client directly. This is needed because the next release of pybugz does the same thing; we no longer have a bugzilla module since it was just a wrapper. Handle tokens correctly: - When we log into Bugzilla, we are given a token we must pass back to it with every command we issue. - Log out at the end of every session to expire the token. Fix the state file processing: - The pickle module handles binary files, not text files, so read and write the state file in binary mode. - Add fix_imports=True when reading the state file so a python-2 compatible state file can be read. - Do not set the URL for a stabilization request X-Gentoo-Bug: 532054 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=532054 X-Gentoo-Bug: 532368 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=532368
Diffstat (limited to 'maintainer-timeout.py')
-rwxr-xr-xmaintainer-timeout.py31
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)