summaryrefslogtreecommitdiff
blob: c75edd64767bcd2491b9a40e8d6eca6347d71811 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
# Copyright 2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

import optparse

import bugz.bugzilla
import portage.versions

from common import Bug, chunks


class MyBugz(bugz.bugzilla.Bugz):
	def get_input(self, prompt):
		return raw_input(prompt)


if __name__ == "__main__":
	parser = optparse.OptionParser()
	(options, args) = parser.parse_args()
	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()
	
	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")]
	for bug in bugs:
		if 'STABLEREQ' in bug.keywords():
			continue
		arch_found = False
		for arch in portage.archlist:
			if '%s@gentoo.org' % arch in bug.cc():
				arch_found = True
				break
		if arch_found:
			continue
		if len(bug.comments()) > 1:
			continue
		bug.detect_cpvs()
		if len(bug.cpvs()) != 1:
			continue
		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)