2
2
3
3
import argparse
4
4
import io
5
+ import json
5
6
import os
6
7
import re
7
8
import sys
8
9
from datetime import datetime
9
10
from textwrap import dedent
10
11
from typing import cast
12
+ from urllib .request import urlopen
11
13
12
14
import diskcache
13
15
import github
@@ -88,7 +90,10 @@ def print_table_header(out, tag):
88
90
Pull Requests
89
91
</th>
90
92
<th scope="col" class="px-6 py-3">
91
- By
93
+ Built by
94
+ </th>
95
+ <th scope="col" class="px-6 py-3">
96
+ Maintained by
92
97
</th>
93
98
</tr>
94
99
</thead>
@@ -103,7 +108,7 @@ def print_table_footer(out):
103
108
</div>
104
109
''' ), file = out )
105
110
106
- def print_table_line (out , build , link , issues , by , prs : list [PullRequest ]):
111
+ def print_table_line (out , build , link , issues , built_by , prs : list [PullRequest ], maintained_by ):
107
112
issues_content = '\n ' .join ([
108
113
f'''<li>
109
114
<a class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
@@ -136,7 +141,10 @@ def print_table_line(out, build, link, issues, by, prs: list[PullRequest]):
136
141
</ul>
137
142
</td>
138
143
<td class="px-6 py-4">
139
- { by }
144
+ { built_by }
145
+ </td>
146
+ <td class="px-6 py-4">
147
+ { maintained_by if maintained_by is not None else '' }
140
148
</td>
141
149
</tr>
142
150
''' , file = out ) # nopep8
@@ -231,6 +239,10 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
231
239
else :
232
240
gh = None
233
241
242
+ # load the packages maintainers
243
+ with urlopen ('https://github.com/xcp-ng/xcp/raw/refs/heads/master/scripts/rpm_owners/packages.json' ) as f :
244
+ PACKAGES = json .load (f )
245
+
234
246
ok = True
235
247
with open (args .output , 'w' ) as out :
236
248
print_header (out )
@@ -250,13 +262,17 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
250
262
for tagged in sorted (session .listTagged (tag ), key = lambda build : int (build ['build_id' ]), reverse = True ):
251
263
build = session .getBuild (tagged ['build_id' ])
252
264
prs : list [PullRequest ] = []
265
+ maintained_by = None
253
266
previous_build_sha = find_previous_build_commit (session , tag , build )
254
267
if gh and build ['source' ] is not None :
255
268
(repo , sha ) = parse_source (build ['source' ])
256
269
prs = find_pull_requests (gh , repo , sha , previous_build_sha )
257
- build_url = f'https://koji.xcp-ng.org/buildinfo?buildID={ tagged ['build_id' ]} '
270
+ maintained_by = PACKAGES .get (repo .split ('/' )[- 1 ], {}).get ('maintainer' )
271
+ build_url = f'https://koji.xcp-ng.org/buildinfo?buildID={ tagged ["build_id" ]} '
258
272
build_issues = filter_issues (issues , [build_url ] + [pr .html_url for pr in prs ])
259
- print_table_line (temp_out , tagged ['nvr' ], build_url , build_issues , tagged ['owner_name' ], prs )
273
+ print_table_line (
274
+ temp_out , tagged ['nvr' ], build_url , build_issues , tagged ['owner_name' ], prs , maintained_by
275
+ )
260
276
print_table_footer (temp_out )
261
277
out .write (temp_out .getvalue ())
262
278
except Exception as e :
0 commit comments