Merge lp:~wgrant/lp-ftbfs-report/multi-archive into lp:lp-ftbfs-report

Proposed by William Grant
Status: Merged
Merged at revision: 48
Proposed branch: lp:~wgrant/lp-ftbfs-report/multi-archive
Merge into: lp:lp-ftbfs-report
Prerequisite: lp:~wgrant/lp-ftbfs-report/customise-archs
Diff against target: 185 lines (+40/-40)
2 files modified
source/build_status.html (+2/-13)
source/build_status.py (+38/-27)
To merge this branch: bzr merge lp:~wgrant/lp-ftbfs-report/multi-archive
Reviewer Review Type Date Requested Status
Michael Bienia Pending
Review via email: mp+78534@code.launchpad.net

Commit message

Add rebuild archive support.

Description of the change

Add rebuild archive support. Now run like "./build_status.py primary natty i386 amd64 armel powerpc", or "./build_status.py test-rebuild-20110114-arm natty armel".

I've dropped the active series list, as it's not clear that it was immensely useful, nor obvious how to implement it across multiple archives.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'source/build_status.html'
2--- source/build_status.html 2011-10-07 03:38:40 +0000
3+++ source/build_status.html 2011-10-07 03:38:40 +0000
4@@ -113,14 +113,14 @@
5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
7 <head>
8- <title>Build status for {{ series.fullseriesname }}</title>
9+ <title>Build status for {{ series.fullseriesname }} in {{ archive.displayname }}</title>
10 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
11 <link rel="stylesheet" type="text/css" href="source/style.css" />
12 </head>
13
14 <body>
15 <script type="text/javascript" src="source/wz_tooltip.js"></script>
16- <h1 id="top">Build status for {{ series.fullseriesname }}</h1>
17+ <h1 id="top">Build status for {{ series.fullseriesname }} in {{ archive.displayname }}</h1>
18
19 <p>Jump to:
20 <a href="#main">main</a> ({{ main|count }})
21@@ -135,17 +135,6 @@
22 {% endfor -%}
23 </p>
24
25- <p style="font-size: smaller">
26- Other releases:
27- {% for s in active_series_list -%}
28- {% if s.name == series.name -%}
29- {{ s.displayname }}
30- {% else -%}
31- <a href="{{ s.name }}.html">{{ s.displayname }}</a>
32- {% endif -%}
33- {% endfor -%}
34- </p>
35-
36 <h2>Legend and statistics for the displayed data</h2>
37 <table class="grid" width="95%">
38 <colgroup>
39
40=== modified file 'source/build_status.py'
41--- source/build_status.py 2011-10-07 03:38:40 +0000
42+++ source/build_status.py 2011-10-07 03:38:40 +0000
43@@ -200,11 +200,17 @@
44 '''
45 return u'Changed-By: %s' % (self.changed_by)
46
47-def fetch_pkg_list(series, state, last_published, arch_list=default_arch_list):
48+
49+def fetch_pkg_list(archive, series, state, last_published, arch_list=default_arch_list):
50 print "Processing '%s'" % state
51
52 cur_last_published = None
53- buildlist = series.getBuildRecords(build_state = state)
54+ # XXX wgrant 2009-09-19: This is an awful hack. We should really
55+ # just let IArchive.getBuildRecords take a series argument.
56+ if archive.name == 'primary':
57+ buildlist = series.getBuildRecords(build_state = state)
58+ else:
59+ buildlist = archive.getBuildRecords(build_state = state)
60
61 for build in buildlist:
62 if (last_published is not None and
63@@ -230,9 +236,10 @@
64
65 return cur_last_published
66
67-def generate_page(series, archs_by_archive, template = 'build_status.html', arch_list = default_arch_list):
68+
69+def generate_page(archive, series, archs_by_archive, template = 'build_status.html', arch_list = default_arch_list):
70 try:
71- out = open('../%s.html' % series.name, 'w')
72+ out = open('../%s-%s.html' % (archive.name, series.name), 'w')
73 except IOError:
74 return
75
76@@ -271,8 +278,8 @@
77 stats[state][arch] = StatData(None, None)
78
79 data['stats'] = stats
80+ data['archive'] = archive
81 data['series'] = series
82- data['active_series_list'] = active_series_list
83 data['arch_list'] = arch_list
84 data['archs_by_archive'] = archs_by_archive
85 data['lastupdate'] = time.strftime('%F %T %z')
86@@ -284,8 +291,8 @@
87 out.write(stream.encode('utf-8'))
88 out.close()
89
90-def generate_csvfile(series, arch_list = default_arch_list):
91- csvout = open('../%s.csv' % series.name, 'w')
92+def generate_csvfile(archive, series, arch_list = default_arch_list):
93+ csvout = open('../%s-%s.csv' % (archive.name, series.name), 'w')
94 linetemplate = '%(name)s,%(link)s,%(explain)s\n'
95 for comp in components.values():
96 for pkg in comp:
97@@ -297,10 +304,10 @@
98 csvout.write(linetemplate % {'name': pkg.name, 'link': log,
99 'explain':"[%s] %s" %(', '.join(archs), state)})
100
101-def load_timestamps(series):
102+def load_timestamps(archive, series):
103 '''Load the saved timestamps about the last still published FTBFS build record.'''
104 try:
105- timestamp_file = file('%s.json' % series.name, 'r')
106+ timestamp_file = file('%s-%s.json' % (archive.name, series.name), 'r')
107 tmp = json.load(timestamp_file)
108 timestamps = {}
109 for state, timestamp in tmp.items():
110@@ -317,9 +324,9 @@
111 'Failed to upload': None,
112 }
113
114-def save_timestamps(series, timestamps):
115+def save_timestamps(archive, series, timestamps):
116 '''Save the timestamps of the last still published FTBFS build record into a JSON file.'''
117- timestamp_file = file('%s.json' % series.name, 'w')
118+ timestamp_file = file('%s-%s.json' % (archive.name, series.name), 'w')
119 tmp = {}
120 for state, timestamp in timestamps.items():
121 if timestamp is not None:
122@@ -334,31 +341,35 @@
123 launchpad = Launchpad.login_anonymously('qa-ftbfs', lp_service)
124
125 ubuntu = launchpad.distributions['ubuntu']
126- active_series_list = sorted([s for s in ubuntu.series if s.active], key = attrgetter('name'))
127-
128- assert len(sys.argv) >= 3
129-
130- try:
131- series_list = [ubuntu.getSeries(name_or_version = sys.argv[1])]
132- except HTTPError:
133- print 'Error: %s is not a valid name or version' % sys.argv[1]
134+
135+ assert len(sys.argv) >= 4
136+
137+ try:
138+ archive = ubuntu.getArchive(name=sys.argv[1])
139+ except HTTPError:
140+ print 'Error: %s is not a valid archive.' % sys.argv[1]
141+ sys.exit(1)
142+ try:
143+ series = ubuntu.getSeries(name_or_version=sys.argv[2])
144+ except HTTPError:
145+ print 'Error: %s is not a valid series.' % sys.argv[2]
146 sys.exit(1)
147
148 archs_by_archive = dict(main=[], ports=[])
149- for arch in sys.argv[2:]:
150- das = series_list[0].getDistroArchSeries(archtag=arch)
151+ for arch in sys.argv[3:]:
152+ das = series.getDistroArchSeries(archtag=arch)
153 archs_by_archive[das.official and 'main' or 'ports'].append(arch)
154 default_arch_list.extend(archs_by_archive['main'])
155 default_arch_list.extend(archs_by_archive['ports'])
156
157- for series in series_list:
158+ for (archive, series) in [(archive, series)]:
159 print "Generating FTBFS for %s" % series.fullseriesname
160
161 # clear all caches
162 PersonTeam.clear()
163 SourcePackage.clear()
164 SPPH.clear()
165- last_published = load_timestamps(series)
166+ last_published = load_timestamps(archive, series)
167
168 # list of SourcePackages for each component
169 components = {
170@@ -377,11 +388,11 @@
171 packagesets_ftbfs[ps.name] = [] # empty list to add FTBFS for each package set later
172
173 for state in ('Failed to build', 'Dependency wait', 'Chroot problem', 'Failed to upload'):
174- last_published[state] = fetch_pkg_list(series, state, last_published[state])
175+ last_published[state] = fetch_pkg_list(archive, series, state, last_published[state], default_arch_list)
176
177- save_timestamps(series, last_published)
178+ save_timestamps(archive, series, last_published)
179
180 print "Generating HTML page..."
181- generate_page(series, archs_by_archive)
182+ generate_page(archive, series, archs_by_archive)
183 print "Generating CSV file..."
184- generate_csvfile(series)
185+ generate_csvfile(archive, series)

Subscribers

People subscribed via source and target branches

to all changes: