X-Git-Url: https://piware.de/gitweb/?a=blobdiff_plain;f=workitems.py;h=dea7768d32facd932503b2cac1c59a6ad1aa5fc5;hb=1db9933d4649c567932a7bb18785b4a365574254;hp=fa40e47764b0800d579b0f252df41171a2e1d27c;hpb=73f39f614bd2ef7c96785b37b75c3e9a5ae15c21;p=bin.git diff --git a/workitems.py b/workitems.py index fa40e47..dea7768 100755 --- a/workitems.py +++ b/workitems.py @@ -20,8 +20,9 @@ def get_db(dbpath): cur = db.cursor() cur.execute('''CREATE TABLE work_items ( blueprint VARCHAR(255) NOT NULL, - workitem VARCHAR(255) NOT NULL, + workitem VARCHAR(1000) NOT NULL, status VARCHAR(20) NOT NULL, + assignee VARCHAR(200) NOT NULL, date TIMESTAMP NOT NULL)''') cur.execute('''CREATE TABLE status ( blueprint VARCHAR(255) NOT NULL, @@ -41,6 +42,8 @@ def parse_argv(): help='Path to database', dest='database', metavar='PATH') optparser.add_option('-r', '--release', help='Release name', dest='release') + optparser.add_option('--milestone', + help='Milestone name', dest='milestone') optparser.add_option('-p', '--pattern', metavar='REGEX', help='Regex pattern for blueprint name', dest='pattern') optparser.add_option('-D', '--dump', action='store_true', default=False, @@ -71,31 +74,60 @@ def parse_argv(): return (opts, args) -def get_blueprints(url, name_pattern): +def get_blueprints(url, name_pattern, milestone): '''Return a list of blueprint URLs for the current release.''' blueprint_name_filter = re.compile('href="(/ubuntu/\+spec/%s[^"]+)"' % name_pattern) result = [] + scan_tr_end = False + found_ms = False + bp = None for l in urllib.urlopen(url): - m = blueprint_name_filter.search(l) - if m: - result.append(blueprints_base_url + m.group(1)) + if scan_tr_end: + if milestone: + if ('/+milestone/%s"' % milestone) in l: + found_ms = True + if '' in l: + scan_tr_end = False + if bp and (not milestone or found_ms): + result.append(bp) + bp = None + found_ms = False + else: + m = blueprint_name_filter.search(l) + if m: + bp = blueprints_base_url + m.group(1) + scan_tr_end = True return result def get_blueprint_workitems(blueprint_url): '''Collect work items from a particular blueprint URL. - This will return a list of ('item', 'status') pairs. + This will return a list of ('item', 'status', 'assignee') tuples. ''' work_items_re = re.compile('(
|^)work items:\s*
', re.I)
+ assignee_re = re.compile('')
found_workitems = False
+ found_assignee = False
result = []
+ default_assignee = 'nobody'
for l in urllib.urlopen(blueprint_url):
end = False
+
+ if ' ' % (
- blueprints_base_url, bp, bp, data[bp][0], data[bp][2],
+ if bp.startswith('http:'):
+ url = bp
+ else:
+ url = '%s/ubuntu/+spec/%s' % (blueprints_base_url, bp)
+ print ' %s %i/%i/%i %i%% %s ' % (
+ url, bp, data[bp][0], data[bp][2],
data[bp][1], percent,
data[bp][-1])
print ''
+ print '''
+%s %i/%i/%i %i%% %s Status by assignee
+
+
'
+
print '
+'''
+ data = assignee_completion(db)
+
+ completion = []
+ for (a, (todo, done, postponed)) in data.iteritems():
+ completion.append((a,
+ int(float(postponed+done)/(todo+done+postponed)*100 + 0.5)))
+
+ completion.sort(key=lambda k: k[0], reverse=False)
+
+ for (a, percent) in completion:
+ url = '%s/~%s/+specs?role=assignee' % (blueprints_base_url, a)
+ print ' Assignee todo/postponed/done Completion ' % (
+ url, a, data[a][0], data[a][2],
+ data[a][1], percent)
+ print '%s %i/%i/%i %i%%