Merge lp:~brian-murray/arsenal/collect-team-changes into lp:arsenal/trunk

Proposed by Brian Murray
Status: Merged
Merged at revision: 771
Proposed branch: lp:~brian-murray/arsenal/collect-team-changes
Merge into: lp:arsenal/trunk
Diff against target: 82 lines (+32/-10)
1 file modified
scripts/collect-team-bugtotals (+32/-10)
To merge this branch: bzr merge lp:~brian-murray/arsenal/collect-team-changes
Reviewer Review Type Date Requested Status
Bryce Harrington code Approve
Review via email: mp+61300@code.launchpad.net

Description of the change

I want to use this for the foundations team and don't like the idea of excluding some tags in the count so I've added in optparse and arguments to not exclude bug tags. Additionally, I added in a --team and --packages switches. I've tried to keep the defaults so that people using collect-team-bugtotals won't have to modify their scripts.

I also tested this with './collect-team-bugtotals -p fglrx-installer' and came up with the same numbers as at http://www.bryceharrington.org/X/Data/ubuntu-x-swat/BugStats/bugtotals-20110517.json

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/collect-team-bugtotals'
2--- scripts/collect-team-bugtotals 2011-02-03 20:48:13 +0000
3+++ scripts/collect-team-bugtotals 2011-05-17 18:57:25 +0000
4@@ -3,15 +3,38 @@
5 # Script to retrieve statistics about bugs for source packages with various statuses
6
7 import datetime
8+import optparse
9 import socket
10 import simplejson as json
11 from arsenal_lib import *
12 from lpltk import LaunchpadService
13 from httplib import IncompleteRead
14
15-if len(sys.argv) < 2:
16- sys.stderr.write("Usage: %s <source-package>\n" %(sys.argv[0]))
17- sys.exit(1)
18+
19+parser = optparse.OptionParser()
20+parser.add_option("-p", "--packages", help="Source packages - \
21+ srcpkg,srcpkg,...")
22+parser.add_option("-n", "--noexclude", help="Do not exclude tags (kubuntu, \
23+ xubuntu, ppc, omit) from search",
24+ action="store_false", dest="exclude")
25+parser.add_option("-t", "--team", help="Team name to write to json file")
26+
27+parser.set_defaults(exclude=True)
28+(opt, args) = parser.parse_args()
29+
30+source_pkgs = []
31+for srcpkg in opt.packages.split(','):
32+ source_pkgs.append(srcpkg)
33+
34+if opt.exclude:
35+ tag_list = ['-kubuntu', '-xubuntu', '-ppc', '-omit']
36+elif not opt.exclude:
37+ tag_list = []
38+
39+if not opt.team:
40+ team_name = 'ubuntu-x-swat'
41+else:
42+ team_name = opt.team
43
44 try:
45 lp = LaunchpadService(config={'read_only':True})
46@@ -23,13 +46,13 @@
47 sys.stderr.write("Error: Could not retrieve project from launchpad\n")
48 sys.exit(1)
49
50-source_pkgs = sys.argv[1:]
51 tag_sets = [
52- {"name":devseries, "tags":devseries+" -kubuntu -xubuntu -ppc -omit"},
53- {"name":"all", "tags":"-kubuntu -xubuntu -ppc -omit"},
54+ {"name":devseries, "tags":tag_list + devseries.split(' ')},
55+ {"name":"all", "tags":tag_list},
56 ]
57+
58 records = { 'timestamp-start': str(datetime.datetime.now()),
59- 'team': 'ubuntu-x-swat',
60+ 'team': team_name,
61 'dev-series': devseries,
62 'data': [],
63 }
64@@ -45,11 +68,11 @@
65
66 for tag_set in tag_sets:
67 n = tag_set['name']
68- tags = tag_set['tags'].split(' ')
69+ tags = tag_set['tags']
70
71 tasks = s.searchTasks(tags = tags, tags_combinator = "All")
72 if len(list(tasks)) == 0:
73- # If there are no bug_tasks, don't bother recording them
74+ # If there are no open bug_tasks, don't bother recording them
75 continue
76 statistics[n+'-total'] = len(list(tasks))
77
78@@ -121,4 +144,3 @@
79 records['timestamp-stop'] = str(datetime.datetime.now())
80
81 print json.dumps(records, indent=4)
82-

Subscribers

People subscribed via source and target branches

to status/vote changes: