Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add a script to update the debian changelog for non-Debian systems #10778

Merged
merged 8 commits into from
Sep 8, 2021
1 change: 1 addition & 0 deletions changelog.d/10778.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a script to update the Debian changelog in a Docker container for systems that aren't Debian-based.
50 changes: 50 additions & 0 deletions scripts-dev/update_debian_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash -e
babolivier marked this conversation as resolved.
Show resolved Hide resolved
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script is meant to be used inside a Docker container to run the `dch` incantations
# needed to release Synapse. This is useful on systems like macOS where such scripts are
# not easily accessible.
#
# Running it (when if the current working directory is the root of the Synapse checkout):
babolivier marked this conversation as resolved.
Show resolved Hide resolved
# docker run -v $PWD:/synapse ubuntu:latest /synapse/scripts-dev/update_debian_changelog.sh VERSION
babolivier marked this conversation as resolved.
Show resolved Hide resolved
#
# The image can be replaced by any other Debian-based image (as long as the `devscripts`
# package exists in the default repository).
# `VERSION` is the version of Synapse being released without the leading "v" (e.g. 1.42.0).

# Check if a version was provided.
if [ "$#" -ne 1 ]; then
echo "Usage: update_debian_changelog.sh VERSION"
echo "VERSION is the version of Synapse being released in the form 1.42.0 (without the leading \"v\")"
babolivier marked this conversation as resolved.
Show resolved Hide resolved
exit 1
fi

# We set -x here rather than in the shebang so that if we need to exit early because no
# version was provided, the message doesn't get drowned in useless output.
set -x

# Make the root of the Synapse checkout the current working directory.
cd /synapse

# Update the packages list and install devscripts (which provides dch). We need to make
# the Debian frontent noninteractive because installing devscripts otherwise asks for the
# machine's location.
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y devscripts

# Update the Debian changelog.
ver=${1}
dch -M -v $(sed -Ee 's/(rc|a|b|c)/~\1/' <<<$ver) "New synapse release $ver."
dch -M -r -D stable ""