From b619bbaa42d55cb7eb424cecd9b3f0d4a8318917 Mon Sep 17 00:00:00 2001 From: "Pawel Hajdan, Jr" Date: Mon, 4 Jun 2012 11:17:52 +0200 Subject: Improve stabilization-candidates (misc updates) --- stabilization-candidates.py | 52 ++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/stabilization-candidates.py b/stabilization-candidates.py index 7989a84..77a9a74 100755 --- a/stabilization-candidates.py +++ b/stabilization-candidates.py @@ -8,6 +8,7 @@ import os.path import random import re import subprocess +import xmlrpclib import urllib from bugz.bugzilla import BugzillaProxy @@ -91,16 +92,20 @@ if __name__ == "__main__": best_candidate = candidates[0] pv = portage.versions.catsplit(best_candidate)[1] - with open(os.path.join(options.repo, cp, 'ChangeLog')) as changelog_file: - regex = '\*%s \((.*)\)' % re.escape(pv) - match = re.search(regex, changelog_file.read()) - if not match: - print 'error parsing ChangeLog' - continue - changelog_date = datetime.datetime.strptime(match.group(1), '%d %b %Y') - if now - changelog_date < datetime.timedelta(days=options.days): - print 'not old enough' - continue + try: + with open(os.path.join(options.repo, cp, 'ChangeLog')) as changelog_file: + regex = '\*%s \((.*)\)' % re.escape(pv) + match = re.search(regex, changelog_file.read()) + if not match: + print 'error parsing ChangeLog' + continue + changelog_date = datetime.datetime.strptime(match.group(1), '%d %b %Y') + if now - changelog_date < datetime.timedelta(days=options.days): + print 'not old enough' + continue + except IOError, e: + print e + continue keywords = portage.db["/"]["porttree"].dbapi.aux_get(best_candidate, ['KEYWORDS'])[0] missing_arch = False @@ -113,18 +118,15 @@ if __name__ == "__main__": continue # Do not risk trying to stabilize a package with known bugs. - params = {} - params['summary'] = [cp]; - bugs = bugzilla.Bug.search(params) - if len(bugs['bugs']): + bugs = [x for x in bugzilla.Bug.search({'summary': cp})['bugs'] if x['is_open'] and x['severity'] not in ['enhancement', 'QA']] + if bugs: print 'has bugs' continue # Protection against filing a stabilization bug twice. - params['summary'] = [best_candidate] - bugs = bugzilla.Bug.search(params) - if len(bugs['bugs']): - print 'version has closed bugs' + bugs = bugzilla.Bug.search({'summary': best_candidate})['bugs'] + if bugs: + print 'version has bugs' continue cvs_path = os.path.join(options.repo, cp) @@ -164,8 +166,10 @@ if __name__ == "__main__": if options.file_bugs: description = ('Is it OK to stabilize =%s ?\n\n' % best_candidate + - 'If so, please CC arches and add STABLEREQ keyword.\n\n' + - 'Stabilization of this package has been repoman-checked on the following arches: %s' % ', '.join(options.arch)) + 'If so, please CC all arches which have stable keywords\n\n' + + 'for older versions of this package and add STABLEREQ keyword\n\n' + + 'to the bug.') + params = {} params['product'] = 'Gentoo Linux' params['version'] = 'unspecified' params['component'] = 'Keywording and Stabilization' @@ -175,7 +179,11 @@ if __name__ == "__main__": params['assigned_to'] = maintainer params['cc'] = other_maintainers params['severity'] = 'enhancement' - bug_id = bugzilla.Bug.create(params)['id'] - print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate) + try: + bug_id = bugzilla.Bug.create(params)['id'] + print 'Submitted bug #%d for %s. ;-)' % (bug_id, best_candidate) + except xmlrpclib.Fault, f: + print f + print 'Failed to submit bug for %s. :-(' % best_candidate else: print (best_candidate, maintainer, other_maintainers) -- cgit v1.2.3-65-gdbad