← Back to team overview

arsenal-devel team mailing list archive

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

 

Brian Murray has proposed merging lp:~brian-murray/arsenal/collect-team-changes into lp:arsenal.

Requested reviews:
  Bryce Harrington (bryce)

For more details, see:
https://code.launchpad.net/~brian-murray/arsenal/collect-team-changes/+merge/61300

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
-- 
https://code.launchpad.net/~brian-murray/arsenal/collect-team-changes/+merge/61300
Your team arsenal-devel is subscribed to branch lp:arsenal.
=== 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 @@
 # Script to retrieve statistics about bugs for source packages with various statuses
 
 import datetime
+import optparse
 import socket
 import simplejson as json
 from arsenal_lib import *
 from lpltk import LaunchpadService
 from httplib import IncompleteRead
 
-if len(sys.argv) < 2:
-    sys.stderr.write("Usage: %s <source-package>\n" %(sys.argv[0]))
-    sys.exit(1)
+
+parser = optparse.OptionParser()
+parser.add_option("-p", "--packages", help="Source packages - \
+    srcpkg,srcpkg,...")
+parser.add_option("-n", "--noexclude", help="Do not exclude tags (kubuntu, \
+    xubuntu, ppc, omit) from search",
+    action="store_false", dest="exclude")
+parser.add_option("-t", "--team", help="Team name to write to json file")
+
+parser.set_defaults(exclude=True)
+(opt, args) = parser.parse_args()
+
+source_pkgs  = []
+for srcpkg in opt.packages.split(','):
+    source_pkgs.append(srcpkg)
+
+if opt.exclude:
+    tag_list = ['-kubuntu', '-xubuntu', '-ppc', '-omit']
+elif not opt.exclude:
+    tag_list = []
+
+if not opt.team:
+    team_name = 'ubuntu-x-swat'
+else:
+    team_name = opt.team
 
 try:
     lp          = LaunchpadService(config={'read_only':True})
@@ -23,13 +46,13 @@
     sys.stderr.write("Error:  Could not retrieve project from launchpad\n")
     sys.exit(1)
 
-source_pkgs = sys.argv[1:]
 tag_sets    = [
-    {"name":devseries,  "tags":devseries+" -kubuntu -xubuntu -ppc -omit"},
-    {"name":"all",      "tags":"-kubuntu -xubuntu -ppc -omit"},
+    {"name":devseries,  "tags":tag_list + devseries.split(' ')},
+    {"name":"all",      "tags":tag_list},
     ]
+
 records = { 'timestamp-start': str(datetime.datetime.now()),
-            'team': 'ubuntu-x-swat',
+            'team': team_name,
             'dev-series': devseries,
             'data': [],
             }
@@ -45,11 +68,11 @@
 
         for tag_set in tag_sets:
             n = tag_set['name']
-            tags = tag_set['tags'].split(' ')
+            tags = tag_set['tags']
 
             tasks = s.searchTasks(tags = tags, tags_combinator = "All")
             if len(list(tasks)) == 0:
-                # If there are no bug_tasks, don't bother recording them
+                # If there are no open bug_tasks, don't bother recording them
                 continue
             statistics[n+'-total'] = len(list(tasks))
 
@@ -121,4 +144,3 @@
 records['timestamp-stop'] = str(datetime.datetime.now())
 
 print json.dumps(records, indent=4)
-


Follow ups