~ubuntu-defect-analysts/+junk/reports-trunk

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
from __future__ import with_statement

from launchpadlib.launchpad import Launchpad
from lp_utils import BugTask
import re
from os import path
from datetime import datetime
import reporting
import pdb


launchpad = Launchpad.login_anonymously('server-release-bugs', 'production')
#launchpad = Launchpad.login_with('server-release-bugs', 'production')
ubuntu = launchpad.projects['ubuntu']

team = launchpad.people["canonical-server"].members_details
SUPERVISOR = launchpad.people["ubuntu-server"]


def inteam(person):
    for member in team:
        if member.member == person:
            return True
    return False

def fortag(tag,supervisor=None):
    bugs = []
    if supervisor:
        rsbugtasks = ubuntu.searchTasks(tags=tag,bug_supervisor=supervisor)
    else:
        rsbugtasks = ubuntu.searchTasks(tags=tag)
    for bugtask in rsbugtasks:
        if tag == "server-o-ro" and inteam(bugtask.assignee):
            continue
        bugs.append(BugTask(bugtask))
    return bugs

report_timestamp = datetime.utcnow().strftime("%Y-%m-%d %H:%M")
server_release_bugs = fortag("server-o-rs")
otherteams_release_bugs = fortag("server-o-ro")
ftbfs_bugs = fortag('ftbfs', SUPERVISOR)
mir_bugs = fortag("server-o-mir")
ffe_bugs = fortag("server-o-ffe")
context = dict(
    report_timestamp=report_timestamp,
    server_release_bugs=server_release_bugs,
    otherteams_release_bugs=otherteams_release_bugs,
    ftbfs_bugs=ftbfs_bugs,
    mir_bugs=mir_bugs,
    ffe_bugs=ffe_bugs,
    )

directory = "/srv/qa.ubuntu.com/reports/ubuntu-server/"
report_name = "release-bugs.html"
report_path = path.join(directory, report_name)
with file(report_path, 'w') as reportfile:
    reporting.render_deployment_report(reportfile, context,
        'release-bugs-table.html')

data = {("Bugs pertinent to Oneiric Server release that we are working on "
        "(currently %d)" % len(server_release_bugs)) : server_release_bugs,
        ("Bugs we are tracking that other teams are working on (currently %s)"
            % len(otherteams_release_bugs)) : otherteams_release_bugs,
        ("FTBFS that we need to look at (currently %s)" %
            len(ftbfs_bugs)) : ftbfs_bugs,
        ("MIR's we are tracking required for Oneiric Release (currently %s)" %
            len(mir_bugs)) : mir_bugs,
        ("Feature Freeze exceptions that are required for release (currently"
            " %s)" % len(ffe_bugs)) : ffe_bugs,
        }

report_name = 'release-bugs.txt'
report_path = path.join(directory, report_name)

reporting.write_wiki_output(data, report_path)