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
|
#!/usr/bin/python
import xmlrpclib,sys,datetime
from wmfphablib import config
import argparse
import subprocess
server = xmlrpclib.ServerProxy(config.Bugzilla_url, use_datetime=True)
token_data = server.User.login({'login':config.Bugzilla_login,'password':config.Bugzilla_password})
token = token_data['token']
parser = argparse.ArgumentParser(description="Generate list of bug ids by specifying product and/or component")
parser.add_argument('-c', help='limit to a component', action='store', dest='COMPONENT')
parser.add_argument('-p', help='limit to a product', action='store', dest='PRODUCT')
parser.add_argument('-F', help='no fetch', action='store_true', dest='NO_FETCH', default=False)
parser.add_argument('-C', help='no create', action='store_true', dest='NO_CREATE', default=False)
args = parser.parse_args()
kwargs = {'Bugzilla_token': token}
if args.COMPONENT is not None:
kwargs['component'] = args.COMPONENT
if args.PRODUCT is not None:
kwargs['product'] = args.PRODUCT
#print kwargs
#print "no fetch: %s" % args.NO_FETCH
#print "no create: %s" % args.NO_CREATE
#sys.exit(2)
bug_list = server.Bug.search(kwargs)
for b in bug_list['bugs']:
print 'Processing: [%s] %s/%s - % s' % (b['id'], b['product'], b['component'], b['summary'])
if not args.NO_FETCH:
output = subprocess.check_output(['./bugzilla_fetch.py', str(b['id'])])
print str(output)
if not args.NO_CREATE:
output = subprocess.check_output(['./bugzilla_create.py', str(b['id'])])
print str(output)
|