~vila/udd/735477-kill-harder

« back to all changes in this revision

Viewing changes to categorise_failures.py

  • Committer: Vincent Ladeuil
  • Date: 2011-02-11 18:23:03 UTC
  • mfrom: (394.1.3 716123-self-doc)
  • Revision ID: v.ladeuil+lp@free.fr-20110211182303-exq8on92250e8dna
Add more self documentation to the status pages

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
sys.path.insert(0, os.path.dirname(__file__))
12
12
import icommon
13
13
 
14
 
output_dir = "/srv/package-import.canonical.com/new/logs/status/"
15
 
 
16
14
html_head = '''<html>
17
15
<head>
18
16
<title>%(title)s</title>
22
20
</head>
23
21
<body>
24
22
<a href="http://package-import.ubuntu.com/status/">Overview</a>
25
 
<p>You are looking at information on the Bazaar importer system that serves <a href="https://wiki.ubuntu.com/DistributedDevelopment">Ubuntu Distributed Development</a>. It's hoped that you won't have to care about the existence of this, but things don't always work out that way.</p>
26
 
<p>It is expected that uploads appear in the branches in less than 30 minutes, if it takes longer then something is up and this page should tell you why. To discuss issues or to ask for a package to be looked at please email James Westby.</p>
 
23
 
 
24
<p>You are looking at information on the Bazaar importer system that serves <a
 
25
href="https://wiki.ubuntu.com/DistributedDevelopment">Ubuntu Distributed
 
26
Development</a>. It's hoped that you won't have to care about the existence of
 
27
this, but things don't always work out that way.</p>
 
28
 
 
29
<p>It is expected that uploads appear in the branches in less than 30 minutes,
 
30
if it takes longer then something is up and this page should tell you why. To
 
31
discuss issues or to ask for a package to be looked at please email James
 
32
Westby.</p>
 
33
 
 
34
<p>The scripts used to import the packages are available <a
 
35
href="https://code.launchpad.net/~udd/udd/import-scripts"> here. </a> Please
 
36
file bugs <a href="https://launchpad.net/udd/+filebug"> here. </a> A more
 
37
detailed explanation about how it works is available <a
 
38
href="https://wiki.ubuntu.com/DistributedDevelopment/UnderTheHood">
 
39
here. </a></p>
 
40
 
27
41
<p>This page was last updated at <tt>''' + datetime.datetime.utcnow().isoformat() + ''' UTC.</tt></p>
28
42
'''
 
43
 
29
44
html_tail = '''</body>
30
45
</html>
31
46
'''
53
68
 
54
69
def list_old_pages():
55
70
    old_pages = set()
56
 
    for page in os.listdir(output_dir):
57
 
        path = os.path.join(output_dir, page)
 
71
    for page in os.listdir(icommon.web_status_dir):
 
72
        path = os.path.join(icommon.web_status_dir, page)
58
73
        if not os.path.isdir(path):
59
74
            old_pages.add(path)
60
75
    return old_pages
72
87
    for reason in reasons:
73
88
        for info in reasons[reason][:]:
74
89
            assert not "/" in info.name
75
 
            path = os.path.join(output_dir, cgi.escape(info.name,
 
90
            path = os.path.join(icommon.web_status_dir, cgi.escape(info.name,
76
91
                        True) + ".html")
77
92
            f = open(path, "wb")
78
93
            try:
89
104
            finally:
90
105
                f.close()
91
106
            paths.add(path)
92
 
        path = os.path.join(output_dir, error_page(reason))
 
107
        path = os.path.join(icommon.web_status_dir, error_page(reason))
93
108
        f = open(path, "wb")
94
109
        try:
95
110
            f.write(html_head % {"title": "Failures of type"})
181
196
 
182
197
def write_overview_page(reasons, package_info, explanations):
183
198
    paths = set()
184
 
    path = os.path.join(output_dir, "index.html")
 
199
    path = os.path.join(icommon.web_status_dir, "index.html")
185
200
    f = open(path, "wb")
186
201
    try:
187
202
        f.write(html_head % {"title": "bzr import failures"})
254
269
    main_packages = get_main_packages()
255
270
    reasons, package_info = filter_packages(main_packages, reasons, package_info)
256
271
    paths = set()
257
 
    path = os.path.join(output_dir, "main.html")
 
272
    path = os.path.join(icommon.web_status_dir, "main.html")
258
273
    f = open(path, "wb")
259
274
    try:
260
275
        f.write(html_head % {"title": "bzr import failures for main"})
288
303
    copied_paths = set()
289
304
    for fn in source_paths:
290
305
        shutil.copy(os.path.join(os.path.dirname(__file__), fn),
291
 
                    output_dir)
292
 
        copied_paths.add(os.path.join(output_dir, fn))
 
306
                    icommon.web_status_dir)
 
307
        copied_paths.add(os.path.join(icommon.web_status_dir, fn))
293
308
    return copied_paths
294
309
 
295
310