From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from <gentoo-commits+bounces-423028-garchives=archives.gentoo.org@lists.gentoo.org>) id 1Rszpc-0001cD-TC for garchives@archives.gentoo.org; Thu, 02 Feb 2012 16:48:21 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AE57FE0845; Thu, 2 Feb 2012 16:48:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 68DDAE0845 for <gentoo-commits@lists.gentoo.org>; Thu, 2 Feb 2012 16:48:08 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CC6F71B400D for <gentoo-commits@lists.gentoo.org>; Thu, 2 Feb 2012 16:48:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 23FBE80042 for <gentoo-commits@lists.gentoo.org>; Thu, 2 Feb 2012 16:48:07 +0000 (UTC) From: "Paweł Hajdan" <phajdan.jr@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paweł Hajdan" <phajdan.jr@gentoo.org> Message-ID: <e6c4d9a4da903a2c4d1f190089bed7e365d28f39.phajdan.jr@gentoo> Subject: [gentoo-commits] proj/arch-tools:master commit in: / X-VCS-Repository: proj/arch-tools X-VCS-Files: common.py maintainer-timeout.py X-VCS-Directories: / X-VCS-Committer: phajdan.jr X-VCS-Committer-Name: Paweł Hajdan X-VCS-Revision: e6c4d9a4da903a2c4d1f190089bed7e365d28f39 Date: Thu, 2 Feb 2012 16:48:07 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: b326e2f6-3f73-4a09-9d38-dcdb08501712 X-Archives-Hash: 8c24954c1ec1884eed5f16304d68de7e commit: e6c4d9a4da903a2c4d1f190089bed7e365d28f39 Author: Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org> AuthorDate: Thu Feb 2 16:47:36 2012 +0000 Commit: Pawe=C5=82 Hajdan <phajdan.jr <AT> gentoo <DOT> org> CommitDate: Thu Feb 2 16:47:36 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/arch-tools.gi= t;a=3Dcommit;h=3De6c4d9a4 Working implementation of maintainer-timeout. --- common.py | 5 +++++ maintainer-timeout.py | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/common.py b/common.py index d6841fb..ad25ad8 100644 --- a/common.py +++ b/common.py @@ -2,6 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 =20 import cStringIO +import datetime import re =20 import portage @@ -50,6 +51,7 @@ class Bug: self.__depends_on =3D [int(dep.text) for dep in xml.findall("dependso= n")] self.__comments =3D [c.find("who").text + "\n" + c.find("thetext").te= xt for c in xml.findall("long_desc")] self.__cc =3D [cc.text for cc in xml.findall("cc")] + self.__creation_timestamp =3D datetime.datetime.strptime(xml.find('cr= eation_ts').text, '%Y-%m-%d %H:%M:%S +0000') =20 self.__keywords =3D [] keywords_elem =3D xml.find("keywords") @@ -92,6 +94,9 @@ class Bug: def cc(self): return self.__cc =20 + def creation_timestamp(self): + return self.__creation_timestamp + def keywords(self): return self.__keywords =09 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 =20 +import datetime import optparse =20 import bugz.bugzilla @@ -17,6 +18,7 @@ class MyBugz(bugz.bugzilla.Bugz): =20 if __name__ =3D=3D "__main__": parser =3D optparse.OptionParser() + parser.add_option("--days", dest=3D"days", type=3Dint, default=3D30, he= lp=3D"Number of days after maintainer timeout occurs.") (options, args) =3D parser.parse_args() if args: parser.error("unrecognized command-line args") @@ -31,6 +33,7 @@ if __name__ =3D=3D "__main__": for chunk in chunks(raw_bugs, 100): bugs +=3D [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 =3D False @@ -40,12 +43,30 @@ if __name__ =3D=3D "__main__": break if arch_found: continue + + # Skip bugs with comments, they may indicate objections or problem rep= orts. if len(bug.comments()) > 1: continue + + # Skip too recent bugs. + if datetime.datetime.now() - bug.creation_timestamp() < datetime.timed= elta(days=3Doptions.days): + continue + bug.detect_cpvs() if len(bug.cpvs()) !=3D 1: continue + target_keywords =3D set() cp =3D 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=3D'Maintainer timeout (%d days). Arches please go ahead.' % o= ptions.days, + add_cc=3D['%s@gentoo.org' % k for k in target_keywords], + keywords=3D'STABLEREQ') + print 'Updated bug #%d (%s). Target KEYWORDS: %s ;-)' % ( + bug.id_number(), + bug.summary(), + ', '.join(list(target_keywords)))