summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'file-stabilization-bugs.py')
-rwxr-xr-xfile-stabilization-bugs.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/file-stabilization-bugs.py b/file-stabilization-bugs.py
index 1c5bbe9..f9b170c 100755
--- a/file-stabilization-bugs.py
+++ b/file-stabilization-bugs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# Copyright 2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
@@ -11,16 +11,14 @@ import re
import shutil
import subprocess
import sys
-import urllib
-import xmlrpclib
+import xmlrpc.client
-from bugz.bugzilla import BugzillaProxy
from common import login
import portage.versions
from portage.xml.metadata import MetaDataXML
def save_state(done_cpvs):
- with open('file-stabilization-bugs.state', 'w') as state_file:
+ with open('file-stabilization-bugs.state', 'wb') as state_file:
pickle.dump(done_cpvs, state_file)
if __name__ == "__main__":
@@ -40,13 +38,13 @@ if __name__ == "__main__":
done_cpvs = []
if os.path.exists('file-stabilization-bugs.state'):
- with open('file-stabilization-bugs.state', 'r') as state_file:
- done_cpvs = pickle.load(state_file)
+ with open('file-stabilization-bugs.state', 'rb') as state_file:
+ done_cpvs = pickle.load(state_file, fix_imports=True)
url = 'https://bugs.gentoo.org/xmlrpc.cgi'
- print 'You will be prompted for your Gentoo Bugzilla username and password (%s).' % url
- bugzilla = BugzillaProxy(url)
- login(bugzilla)
+ print('You will be prompted for your Gentoo Bugzilla username and password (%s).' % url)
+ bugzilla = xmlrpc.client.ServerProxy(url)
+ user, login_data = login(bugzilla)
with open(options.input_filename, "r") as input_file:
for line in input_file:
@@ -58,7 +56,7 @@ if __name__ == "__main__":
cpv = line
if cpv in done_cpvs:
- print 'Skipping %s because it\'s marked as done' % cpv
+ print('Skipping %s because it\'s marked as done' % cpv)
continue
cp = portage.versions.pkgsplit(cpv)[0]
@@ -75,37 +73,41 @@ if __name__ == "__main__":
description = ('Is it OK to stabilize =%s ?\n' % cpv +
'If so, please CC all arches which have stable keywords\n' +
'for older versions of this package.')
- url = 'http://packages.gentoo.org/package/%s?arches=linux' % urllib.quote(cp)
params = {}
+ params['Bugzilla_token'] = login_data['token']
params['product'] = 'Gentoo Linux'
params['version'] = 'unspecified'
params['component'] = 'Keywording and Stabilization'
params['summary'] = '%s: stabilization request' % cpv
params['description'] = description
- params['url'] = url
params['assigned_to'] = maintainer
params['cc'] = other_maintainers
params['severity'] = 'enhancement'
try:
bug_id = bugzilla.Bug.create(params)['id']
- print 'Submitted bug #%d for %s. ;-)' % (bug_id, cpv)
+ print('Submitted bug #%d for %s. ;-)' % (bug_id, cpv))
done_cpvs += cpv
save_state(done_cpvs)
try:
params = {}
+ params['Bugzilla_token'] = login_data['token']
params['ids'] = [bug_id]
params['keywords'] = {'set': 'STABLEREQ'}
bugzilla.Bug.update(params)
- except xmlrpclib.Fault, f:
+ except xmlrpc.client.Fault as f:
exit_code = 1
- print f
- print 'Failed to add STABLEREQ keyword for %s. :-/' % cpv
- except xmlrpclib.Fault, f:
+ print(f)
+ print('Failed to add STABLEREQ keyword for %s. :-/' % cpv)
+ except xmlrpc.client.Fault as f:
exit_code = 1
- print f
- print 'Failed to submit bug for %s. :-(' % cpv
+ print(f)
+ print('Failed to submit bug for %s. :-(' % cpv)
if exit_code == 0 and os.path.exists('file-stabilization-bugs.state'):
os.remove('file-stabilization-bugs.state')
+ params = {}
+ params['Bugzilla_token'] = login_data['token']
+ bugzilla.User.logout(params)
+
sys.exit(exit_code)