From 2a157785a1cc0e45e4418dce51bee3a7b61b4652 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 23 Jul 2021 09:16:36 +0100 Subject: [PATCH 1/3] Change release script to update debian changelog for RCs --- scripts-dev/release.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts-dev/release.py b/scripts-dev/release.py index 5bfaa4ad2f62..6f7c0004ef65 100755 --- a/scripts-dev/release.py +++ b/scripts-dev/release.py @@ -190,12 +190,24 @@ def run(): # Generate changelogs subprocess.run("python3 -m towncrier", shell=True) - # Generate debian changelogs if its not an RC. - if not rc: - subprocess.run( - f'dch -M -v {new_version} "New synapse release {new_version}."', shell=True - ) - subprocess.run('dch -M -r -D stable ""', shell=True) + # Generate debian changelogs + assert not parsed_new_version.is_devrelease + assert not parsed_new_version.is_postrelease + + if parsed_new_version.pre is not None: + # If this is an RC then we need to coerce the version string to match + # Debian norms, e.g. 1.39.0rc2 gets converted to 1.39.0~rc2. + base_ver = parsed_new_version.base_version + pre_type, pre_num = parsed_new_version.pre + debian_version = f"{base_ver}~{pre_type}{pre_num}" + else: + debian_version = new_version + + subprocess.run( + f'dch -M -v {debian_version} "New synapse release {debian_version}."', + shell=True, + ) + subprocess.run('dch -M -r -D stable ""', shell=True) # Show the user the changes and ask if they want to edit the change log. repo.git.add("-u") From d0cc9a05e859aa563ea1b9c866e6c8c2a6635437 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 27 Jul 2021 11:47:04 +0100 Subject: [PATCH 2/3] Review --- scripts-dev/release.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts-dev/release.py b/scripts-dev/release.py index 6f7c0004ef65..cff433af2af2 100755 --- a/scripts-dev/release.py +++ b/scripts-dev/release.py @@ -139,6 +139,11 @@ def run(): # Switch to the release branch. parsed_new_version = version.parse(new_version) + + # We assume for debian changelogs that we only do RCs or full releases. + assert not parsed_new_version.is_devrelease + assert not parsed_new_version.is_postrelease + release_branch_name = ( f"release-v{parsed_new_version.major}.{parsed_new_version.minor}" ) @@ -191,9 +196,6 @@ def run(): subprocess.run("python3 -m towncrier", shell=True) # Generate debian changelogs - assert not parsed_new_version.is_devrelease - assert not parsed_new_version.is_postrelease - if parsed_new_version.pre is not None: # If this is an RC then we need to coerce the version string to match # Debian norms, e.g. 1.39.0rc2 gets converted to 1.39.0~rc2. From 0d4145e9872b03b3e234d5338e95b8dca6d0fa84 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 27 Jul 2021 11:47:46 +0100 Subject: [PATCH 3/3] Newsfile --- changelog.d/10465.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/10465.misc diff --git a/changelog.d/10465.misc b/changelog.d/10465.misc new file mode 100644 index 000000000000..4de6201dfc30 --- /dev/null +++ b/changelog.d/10465.misc @@ -0,0 +1 @@ +Fix release script to correctly version debian changelog when doing RCs.