22
33import argparse
44import io
5+ import json
56import os
67import re
78from datetime import datetime
89from textwrap import dedent
910from typing import cast
11+ from urllib .request import urlopen
1012
1113import diskcache
1214import github
@@ -94,7 +96,10 @@ def print_table_header(out, tag):
9496 Pull Requests
9597 </th>
9698 <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
98103 </th>
99104 </tr>
100105 </thead>
@@ -109,7 +114,7 @@ def print_table_footer(out):
109114 </div>
110115 ''' ), file = out )
111116
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 ):
113118 issues_content = '\n ' .join ([
114119 f'''<li>
115120 <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]):
142147 </ul>
143148 </td>
144149 <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 '' }
146154 </td>
147155 </tr>
148156 ''' , file = out ) # nopep8
@@ -245,6 +253,10 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
245253else :
246254 gh = None
247255
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+
248260ok = True
249261with open (args .output , 'w' ) as out :
250262 print_header (out )
@@ -264,13 +276,17 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
264276 for tagged in sorted (session .listTagged (tag ), key = lambda build : int (build ['build_id' ]), reverse = True ):
265277 build = session .getBuild (tagged ['build_id' ])
266278 prs : list [PullRequest ] = []
279+ maintained_by = None
267280 previous_build_sha = find_previous_build_commit (session , tag , build )
268281 if build ['source' ] is not None :
269282 (repo , sha ) = parse_source (build ['source' ])
270283 prs = find_pull_requests (gh , repo , sha , previous_build_sha )
284+ maintained_by = PACKAGES .get (repo .split ('/' )[- 1 ], {}).get ('maintainer' )
271285 build_url = f'https://koji.xcp-ng.org/buildinfo?buildID={ tagged ["build_id" ]} '
272286 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+ )
274290 print_table_footer (temp_out )
275291 out .write (temp_out .getvalue ())
276292 except koji .GenericError :
0 commit comments