2
2
3
3
import argparse
4
4
import io
5
+ import json
5
6
import os
6
7
import re
7
8
from datetime import datetime
8
9
from textwrap import dedent
9
10
from typing import cast
11
+ from urllib .request import urlopen
10
12
11
13
import diskcache
12
14
import github
@@ -94,7 +96,10 @@ def print_table_header(out, tag):
94
96
Pull Requests
95
97
</th>
96
98
<th scope="col" class="px-6 py-3">
97
- By
99
+ Built by
100
+ </th>
101
+ <th scope="col" class="px-6 py-3">
102
+ Maintained by
98
103
</th>
99
104
</tr>
100
105
</thead>
@@ -109,7 +114,7 @@ def print_table_footer(out):
109
114
</div>
110
115
''' ), file = out )
111
116
112
- def print_table_line (out , build , link , issues , by , prs : list [PullRequest ]):
117
+ def print_table_line (out , build , link , issues , built_by , prs : list [PullRequest ], maintained_by ):
113
118
issues_content = '\n ' .join ([
114
119
f'''<li>
115
120
<a class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
@@ -142,7 +147,10 @@ def print_table_line(out, build, link, issues, by, prs: list[PullRequest]):
142
147
</ul>
143
148
</td>
144
149
<td class="px-6 py-4">
145
- { by }
150
+ { built_by }
151
+ </td>
152
+ <td class="px-6 py-4">
153
+ { maintained_by if maintained_by is not None else '' }
146
154
</td>
147
155
</tr>
148
156
''' , file = out ) # nopep8
@@ -245,6 +253,10 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
245
253
else :
246
254
gh = None
247
255
256
+ # load the packages maintainers
257
+ with urlopen ('https://github.com/xcp-ng/xcp/raw/refs/heads/master/scripts/rpm_owners/packages.json' ) as f :
258
+ PACKAGES = json .load (f )
259
+
248
260
ok = True
249
261
with open (args .output , 'w' ) as out :
250
262
print_header (out )
@@ -264,13 +276,17 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
264
276
for tagged in sorted (session .listTagged (tag ), key = lambda build : int (build ['build_id' ]), reverse = True ):
265
277
build = session .getBuild (tagged ['build_id' ])
266
278
prs : list [PullRequest ] = []
279
+ maintained_by = None
267
280
previous_build_sha = find_previous_build_commit (session , tag , build )
268
281
if build ['source' ] is not None :
269
282
(repo , sha ) = parse_source (build ['source' ])
270
283
prs = find_pull_requests (gh , repo , sha , previous_build_sha )
284
+ maintained_by = PACKAGES .get (repo .split ('/' )[- 1 ], {}).get ('maintainer' )
271
285
build_url = f'https://koji.xcp-ng.org/buildinfo?buildID={ tagged ["build_id" ]} '
272
286
build_issues = filter_issues (issues , [build_url ] + [pr .html_url for pr in prs ])
273
- print_table_line (temp_out , tagged ['nvr' ], build_url , build_issues , tagged ['owner_name' ], prs )
287
+ print_table_line (
288
+ temp_out , tagged ['nvr' ], build_url , build_issues , tagged ['owner_name' ], prs , maintained_by
289
+ )
274
290
print_table_footer (temp_out )
275
291
out .write (temp_out .getvalue ())
276
292
except koji .GenericError :
0 commit comments