From 8126a053b93855291eb64e7b069b3cc73d71464d Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Thu, 29 Dec 2022 23:46:51 +0000 Subject: [PATCH] gen_release_notes: include links in relnotes.rst when generating the new release note This is required to allow the docs to build, which in turn is required if we want to allow merge requests against release (staging) branches. Cc: mesa-stable Part-of: (cherry picked from commit b3f517b9889c11367f2b73bdf3033d0e85680871) --- .pick_status.json | 2 +- bin/gen_release_notes.py | 28 ++++++++++++++++++++++++++++ bin/post_version.py | 32 +------------------------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 59d7966261f..eb0f1c4557e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5926,7 +5926,7 @@ "description": "gen_release_notes: include links in relnotes.rst when generating the new release note", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/bin/gen_release_notes.py b/bin/gen_release_notes.py index 07cd3817157..820a50312fc 100755 --- a/bin/gen_release_notes.py +++ b/bin/gen_release_notes.py @@ -307,6 +307,31 @@ def get_features(is_point_release: bool) -> typing.Generator[str, None, None]: yield "None" +def update_release_notes_index(version: str) -> None: + relnotes_index_path = pathlib.Path('docs') / 'relnotes.rst' + + with relnotes_index_path.open('r') as f: + relnotes = f.readlines() + + new_relnotes = [] + first_list = True + second_list = True + for line in relnotes: + if first_list and line.startswith('-'): + first_list = False + new_relnotes.append(f'- :doc:`{version} release notes `\n') + if not first_list and second_list and line.startswith(' relnotes/'): + second_list = False + new_relnotes.append(f' relnotes/{version}\n') + new_relnotes.append(line) + + with relnotes_index_path.open('w') as f: + for line in new_relnotes: + f.write(line) + + subprocess.run(['git', 'add', relnotes_index_path]) + + async def main() -> None: v = pathlib.Path(__file__).parent.parent / 'VERSION' with v.open('rt') as f: @@ -345,6 +370,9 @@ async def main() -> None: print(exceptions.text_error_template().render()) subprocess.run(['git', 'add', final]) + + update_release_notes_index(this_version) + subprocess.run(['git', 'commit', '-m', f'docs: add release notes for {this_version}']) diff --git a/bin/post_version.py b/bin/post_version.py index e2a3580e845..26a9f899361 100755 --- a/bin/post_version.py +++ b/bin/post_version.py @@ -27,31 +27,6 @@ import pathlib import subprocess -def update_release_notes(version: str) -> None: - p = pathlib.Path('docs') / 'relnotes.rst' - - with open(p, 'r') as f: - relnotes = f.readlines() - - new_relnotes = [] - first_list = True - second_list = True - for line in relnotes: - if first_list and line.startswith('-'): - first_list = False - new_relnotes.append(f'- :doc:`{version} release notes `\n') - if not first_list and second_list and line.startswith(' relnotes/'): - second_list = False - new_relnotes.append(f' relnotes/{version}\n') - new_relnotes.append(line) - - with open(p, 'w') as f: - for line in new_relnotes: - f.write(line) - - subprocess.run(['git', 'add', p]) - - def update_calendar(version: str) -> None: p = pathlib.Path('docs') / 'release-calendar.csv' @@ -81,14 +56,9 @@ def main() -> None: args = parser.parse_args() update_calendar(args.version) - done = 'update calendar' - - if 'rc' not in args.version: - update_release_notes(args.version) - done += ' and link releases notes' subprocess.run(['git', 'commit', '-m', - f'docs: {done} for {args.version}']) + f'docs: update calendar for {args.version}']) if __name__ == "__main__":