summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Hajdan, Jr <phajdan.jr@gentoo.org>2014-02-11 19:21:45 +0100
committerPawel Hajdan, Jr <phajdan.jr@gentoo.org>2014-02-11 19:21:45 +0100
commit709e4466eb1a8d3c19d522bb2539a821b133bd76 (patch)
treea2511fc6661868e3ab6dfc57992fc70101048aeb /maintainer-timeout.py
parentUse python2 as interpreter (diff)
downloadarch-tools-709e4466eb1a8d3c19d522bb2539a821b133bd76.tar.gz
arch-tools-709e4466eb1a8d3c19d522bb2539a821b133bd76.tar.bz2
arch-tools-709e4466eb1a8d3c19d522bb2539a821b133bd76.zip
Fix maintainer-tiemout.py
- adjust search strings for new bug template - port to new pybugz
Diffstat (limited to 'maintainer-timeout.py')
-rwxr-xr-xmaintainer-timeout.py65
1 files changed, 36 insertions, 29 deletions
diff --git a/maintainer-timeout.py b/maintainer-timeout.py
index ad5593f..ba8c322 100755
--- a/maintainer-timeout.py
+++ b/maintainer-timeout.py
@@ -7,17 +7,16 @@ import optparse
import os.path
import sys
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'third_party', 'pybugz-0.9.3'))
-
-import bugz.bugzilla
+from bugz.bugzilla import BugzillaProxy
import portage.versions
-from common import Bug, chunks
+from common import Bug, chunks, login, detect_cpvs
-class MyBugz(bugz.bugzilla.Bugz):
- def get_input(self, prompt):
- return raw_input(prompt)
+def keyword_to_email(keyword):
+ if keyword == 'arm64':
+ keyword = 'arm'
+ return '%s@gentoo.org' % keyword
if __name__ == "__main__":
@@ -27,48 +26,56 @@ if __name__ == "__main__":
if args:
parser.error("unrecognized command-line args")
- url = 'https://bugs.gentoo.org'
- print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
- bugzilla = MyBugz(url, forget=True)
- bugzilla.auth()
+ url = 'https://bugs.gentoo.org/xmlrpc.cgi'
+ print 'You will be prompted for your Gentoo Bugzilla username and password (%s).' % url
+ bugzilla = BugzillaProxy(url)
+ user = login(bugzilla)
- bugs = []
- raw_bugs = bugzilla.search('please stabilize', reporter=bugzilla.user, status=None)
- for chunk in chunks(raw_bugs, 100):
- bugs += [Bug(xml) for xml in bugzilla.get([bug['bugid'] for bug in chunk]).findall("bug")]
+ bugs = bugzilla.Bug.search({'reporter': user, 'summary': ['stabilize', 'stabilization', 'stable'], 'resolution': ''})['bugs']
+ comments = bugzilla.Bug.comments({'ids': [bug['id'] for bug in bugs]})
for bug in bugs:
# Skip bugs where stabilization seems to be already in progress.
arch_found = False
for arch in portage.archlist:
- if '%s@gentoo.org' % arch in bug.cc():
+ if '%s@gentoo.org' % arch in bug['cc']:
arch_found = True
break
if arch_found:
continue
+ # Skip bugs without STABLEREQ keyword.
+ if 'STABLEREQ' not in bug['keywords']:
+ continue
+
# Skip bugs with comments, they may indicate objections or problem reports.
- if len(bug.comments()) > 1:
+ if len(comments['bugs'][str(bug['id'])]['comments']) > 1:
continue
# Skip too recent bugs.
- if datetime.datetime.now() - bug.creation_timestamp() < datetime.timedelta(days=options.days):
+ creation_time = datetime.datetime.strptime(str(bug['creation_time']), '%Y%m%dT%H:%M:%S')
+ if datetime.datetime.now() - creation_time < datetime.timedelta(days=options.days):
continue
- bug.detect_cpvs()
- if len(bug.cpvs()) != 1:
+ cpvs = detect_cpvs(bug['summary'])
+ if len(cpvs) != 1:
continue
+
target_keywords = set()
- cp = portage.versions.cpv_getkey(bug.cpvs()[0])
+ cp = portage.versions.cpv_getkey(cpvs[0])
for cpv in portage.portdb.cp_list(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(),
+
+ params = {}
+ params['ids'] = [bug['id']]
+ params['cc'] = {}
+ params['cc']['add'] = list(set(keyword_to_email(k) for k in target_keywords))
+ params['comment'] = {}
+ 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 ;-)' % (
+ bug['id'],
+ bug['summary'],
', '.join(list(target_keywords)))