diff options
author | Pawel Hajdan, Jr <phajdan.jr@gentoo.org> | 2012-02-02 17:47:36 +0100 |
---|---|---|
committer | Pawel Hajdan, Jr <phajdan.jr@gentoo.org> | 2012-02-02 17:47:36 +0100 |
commit | e6c4d9a4da903a2c4d1f190089bed7e365d28f39 (patch) | |
tree | 8db14e23259f2be447aeb6355f0904f3c9d189ee | |
parent | Begin work on maintainer-timeout script. (diff) | |
download | arch-tools-e6c4d9a4da903a2c4d1f190089bed7e365d28f39.tar.gz arch-tools-e6c4d9a4da903a2c4d1f190089bed7e365d28f39.tar.bz2 arch-tools-e6c4d9a4da903a2c4d1f190089bed7e365d28f39.zip |
Working implementation of maintainer-timeout.
-rw-r--r-- | common.py | 5 | ||||
-rwxr-xr-x | maintainer-timeout.py | 25 |
2 files changed, 28 insertions, 2 deletions
@@ -2,6 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 import cStringIO +import datetime import re import portage @@ -50,6 +51,7 @@ class Bug: self.__depends_on = [int(dep.text) for dep in xml.findall("dependson")] self.__comments = [c.find("who").text + "\n" + c.find("thetext").text for c in xml.findall("long_desc")] self.__cc = [cc.text for cc in xml.findall("cc")] + self.__creation_timestamp = datetime.datetime.strptime(xml.find('creation_ts').text, '%Y-%m-%d %H:%M:%S +0000') self.__keywords = [] keywords_elem = xml.find("keywords") @@ -92,6 +94,9 @@ class Bug: def cc(self): return self.__cc + def creation_timestamp(self): + return self.__creation_timestamp + def keywords(self): return self.__keywords diff --git a/maintainer-timeout.py b/maintainer-timeout.py index c75edd6..ee096c4 100755 --- a/maintainer-timeout.py +++ b/maintainer-timeout.py @@ -2,6 +2,7 @@ # Copyright 2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import datetime import optparse import bugz.bugzilla @@ -17,6 +18,7 @@ class MyBugz(bugz.bugzilla.Bugz): if __name__ == "__main__": parser = optparse.OptionParser() + parser.add_option("--days", dest="days", type=int, default=30, help="Number of days after maintainer timeout occurs.") (options, args) = parser.parse_args() if args: parser.error("unrecognized command-line args") @@ -31,6 +33,7 @@ if __name__ == "__main__": for chunk in chunks(raw_bugs, 100): bugs += [Bug(xml) for xml in bugzilla.get([bug['bugid'] for bug in chunk]).findall("bug")] for bug in bugs: + # Skip bugs where stabilization seems to be already in progress. if 'STABLEREQ' in bug.keywords(): continue arch_found = False @@ -40,12 +43,30 @@ if __name__ == "__main__": break if arch_found: continue + + # Skip bugs with comments, they may indicate objections or problem reports. if len(bug.comments()) > 1: continue + + # Skip too recent bugs. + if datetime.datetime.now() - bug.creation_timestamp() < datetime.timedelta(days=options.days): + continue + bug.detect_cpvs() if len(bug.cpvs()) != 1: continue + target_keywords = set() cp = portage.versions.cpv_getkey(bug.cpvs()[0]) for cpv in portage.portdb.cp_list(cp): - print portage.portdb.aux_get(cpv, ['KEYWORDS']) - print (bug.id_number(), bug.summary(), cp) + for keyword in portage.portdb.aux_get(cpv, ['KEYWORDS'])[0].split(): + if '~' not in keyword and '-' not in keyword: + target_keywords.add(keyword) + bugzilla.modify( + bug.id_number(), + comment='Maintainer timeout (%d days). Arches please go ahead.' % options.days, + add_cc=['%s@gentoo.org' % k for k in target_keywords], + keywords='STABLEREQ') + print 'Updated bug #%d (%s). Target KEYWORDS: %s ;-)' % ( + bug.id_number(), + bug.summary(), + ', '.join(list(target_keywords))) |