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
@@ -246,6 +254,10 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
246254else :
247255 gh = None
248256
257+ # load the packages maintainers
258+ with urlopen ('https://github.com/xcp-ng/xcp/raw/refs/heads/master/scripts/rpm_owners/packages.json' ) as f :
259+ PACKAGES = json .load (f )
260+
249261ok = True
250262with open (args .output , 'w' ) as out :
251263 print_header (out )
@@ -265,13 +277,17 @@ def find_pull_requests(gh, repo, start_sha, end_sha):
265277 for tagged in sorted (session .listTagged (tag ), key = lambda build : int (build ['build_id' ]), reverse = True ):
266278 build = session .getBuild (tagged ['build_id' ])
267279 prs : list [PullRequest ] = []
280+ maintained_by = None
268281 previous_build_sha = find_previous_build_commit (session , tag , build )
269282 if build ['source' ] is not None :
270283 (repo , sha ) = parse_source (build ['source' ])
271284 prs = find_pull_requests (gh , repo , sha , previous_build_sha )
285+ maintained_by = PACKAGES .get (repo .split ('/' )[- 1 ], {}).get ('maintainer' )
272286 build_url = f'https://koji.xcp-ng.org/buildinfo?buildID={ tagged ["build_id" ]} '
273287 build_issues = filter_issues (issues , [build_url ] + [pr .html_url for pr in prs ])
274- print_table_line (temp_out , tagged ['nvr' ], build_url , build_issues , tagged ['owner_name' ], prs )
288+ print_table_line (
289+ temp_out , tagged ['nvr' ], build_url , build_issues , tagged ['owner_name' ], prs , maintained_by
290+ )
275291 print_table_footer (temp_out )
276292 out .write (temp_out .getvalue ())
277293 except koji .GenericError :
0 commit comments