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

Subscribers

People subscribed via source and target branches

to status/vote changes: