Merge lp:~brian-murray/ubuntu-archive-tools/component-mismatches-uploader into lp:ubuntu-archive-tools

Proposed by Brian Murray on 2015-03-19
Status: Merged
Merged at revision: 943
Proposed branch: lp:~brian-murray/ubuntu-archive-tools/component-mismatches-uploader
Merge into: lp:ubuntu-archive-tools
Diff against target: 148 lines (+67/-9)
1 file modified
component-mismatches (+67/-9)
To merge this branch: bzr merge lp:~brian-murray/ubuntu-archive-tools/component-mismatches-uploader
Reviewer Review Type Date Requested Status
Ubuntu Package Archive Administrators 2015-03-19 Pending
Review via email: mp+253587@code.launchpad.net

Description of the Change

This adds "(Uploader: launchpad username)" to lines in the html version of the component mismatches report. See this following page for an example:

http://people.canonical.com/~brian/tmp/component-mismatches.html

The guessing at package names (lines 303-312), and displaying them (lines 538-551) is rather messy but does work and is minimally invasive. Having said that I'm open to suggestions on how to do either or both better.

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 'component-mismatches'
2--- component-mismatches 2015-03-12 16:50:13 +0000
3+++ component-mismatches 2015-03-19 21:44:48 +0000
4@@ -248,7 +248,35 @@
5 return current_binary[binary][2]
6
7
8-def do_reverse(source, binaries, why_d):
9+def find_signer(options, source):
10+ # look at the source package publishing history for the most recent
11+ # package_signer, a copy from debian won't have a package signer
12+ series = options.distro.getSeries(name_or_version=options.suite)
13+ publications = options.archive.getPublishedSources(
14+ distro_series=series, source_name=source,
15+ exact_match=True)
16+ if not publications:
17+ return('no publications found', '')
18+ sorted_pubs = sorted([(ps.date_published, ps)
19+ for ps in publications
20+ if ps.date_published is not None], reverse=True)
21+ for pub in sorted_pubs:
22+ if pub[1].package_signer:
23+ signer = pub[1].package_signer.name
24+ web_link = pub[1].package_signer.web_link
25+ return(signer, web_link)
26+ else:
27+ signer = ''
28+ web_link = ''
29+ return (signer, web_link)
30+
31+
32+def do_reverse(options, source, binaries, why_d):
33+ global signers
34+ try:
35+ signers.keys()
36+ except NameError:
37+ signers = {}
38 output = []
39 depend = {}
40 recommend = {}
41@@ -267,6 +295,21 @@
42 def do_category(map, category):
43 keys = []
44 for k in map:
45+ if k.startswith('Rescued from '):
46+ pkg = k.replace('Rescued from ', '')
47+ else:
48+ pkg = k
49+ # seed names have spaces in them
50+ if ' ' not in pkg:
51+ try:
52+ source = get_source(pkg)
53+ except KeyError:
54+ source = pkg
55+ pass
56+ if source not in signers:
57+ signer, web_link = find_signer(options, source)
58+ if signer and web_link:
59+ signers[source] = (signer, web_link)
60 if k in current_binary:
61 keys.append('%s (%s)' % (k, current_binary[k][1].upper()))
62 elif k in current_source:
63@@ -328,7 +371,7 @@
64 written_nodes.add(name)
65
66 fd.write(' "%s" [label="%s" style="filled" tooltip="%s"' %
67- (name, name, ', '.join(package_team_mapping[name])))
68+ (name, name, ', '.join(package_team_mapping[name])))
69
70 mirs = mir_bugs.get(name, [])
71 approved_mirs = [
72@@ -367,7 +410,7 @@
73 # generate relation
74 fd.write(' "%s" -> "%s" [label="%s" color="%s" '
75 'fontcolor="%s"]\n' %
76- (why_node, s_node, relation, color, color))
77+ (why_node, s_node, relation, color, color))
78
79 # add legend
80 fd.write("""
81@@ -412,6 +455,7 @@
82
83 package_team_mapping = defaultdict(set)
84
85+
86 def get_teams(options, source):
87 global package_team_mapping
88
89@@ -491,6 +535,20 @@
90 if isinstance(line, MIRLink):
91 line = line.html()
92 else:
93+ for item in line.strip('[]').split(' '):
94+ if item.strip(',') in signers:
95+ comma = ''
96+ if item.endswith(','):
97+ comma = ','
98+ pkg = item.strip(',')
99+ else:
100+ pkg = item
101+ # neither of these will help fix the issue
102+ if signers[pkg][0] in ['ps-jenkins',
103+ 'ci-train-bot']:
104+ continue
105+ line = line.replace(item, '%s (Uploader: %s)%s' %
106+ (pkg, signers[pkg][0], comma))
107 line = escape(line)
108 print_html(
109 '<tr><td colspan="2"><span class="note">%s'
110@@ -541,10 +599,8 @@
111 </head>
112 <body>
113 <h1>Component mismatches for %s</h1>
114- """) % (
115- escape(options.suite), make_chart_header(),
116- escape(options.suite)),
117- file=options.html_output)
118+ """) % (escape(options.suite), make_chart_header(),
119+ escape(options.suite)), file=options.html_output)
120
121 # Additions
122
123@@ -582,7 +638,7 @@
124 for (id, status, title) in mir_bugs.get(source, []):
125 entry.append(MIRLink(id, status, title))
126
127- entry.extend(do_reverse(source, binaries, both))
128+ entry.extend(do_reverse(options, source, binaries, both))
129 output.append(entry)
130
131 all_output["Source and binary movements to %s" % component] = {
132@@ -597,7 +653,8 @@
133
134 if binaries:
135 entry = [[source] + binaries]
136- entry.extend(do_reverse(source, binaries, binary_only))
137+ entry.extend(do_reverse(options, source, binaries,
138+ binary_only))
139 output.append(entry)
140
141 all_output["Binary only movements to %s" % component] = {
142@@ -784,6 +841,7 @@
143 options.launchpad = Launchpad.login_anonymously(
144 'component-mismatches', options.launchpad_instance)
145 options.distro = options.launchpad.distributions['ubuntu']
146+ options.archive = options.distro.getArchive(name='primary')
147
148 options.archive_dir = os.path.expanduser('~/mirror/ubuntu/')
149

Subscribers

People subscribed via source and target branches