This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add a script to update the debian changelog for non-Debian systems #10778
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ddc4dc5
Add a script to update the debian changelog for non-Debian systems
babolivier 18fed2e
Apply suggestions from code review
babolivier 431a2c2
Add more checks to make sure the script is running in the right condi…
babolivier 767cf67
Merge branch 'babolivier/docker_debian_changelog' of github.com:matri…
babolivier a8fa4c4
Set -e after running checks
babolivier 6367396
Apply suggestions from code review
babolivier a165296
Now we can move -e back to the shebang
babolivier d5b4c2b
Typo
babolivier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash -e | ||
# 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): | ||
# docker run --rm -v $PWD:/synapse ubuntu:latest /synapse/scripts-dev/docker_update_debian_changelog.sh VERSION | ||
# | ||
# 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\")" | ||
exit 1 | ||
fi | ||
|
||
# Check that apt-get is available on the system. | ||
if ! which apt-get > /dev/null 2>&1; then | ||
echo "\"apt-get\" isn't available on this system. This script needs to be run in a Docker container using a Debian-based image." | ||
exit 1 | ||
fi | ||
|
||
# Check if devscripts is available in the default repos for this distro. | ||
# Update the apt package list cache. | ||
# We need to do this before we can search the apt cache or install devscripts. | ||
apt-get update || exit 1 | ||
|
||
if ! apt-cache search devscripts | grep -E "^devscripts \-" > /dev/null; then | ||
echo "The package \"devscripts\" needs to exist in the default repositories for this distribution." | ||
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 | ||
babolivier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Install devscripts (which provides dch). We need to make the Debian frontend | ||
# noninteractive because installing devscripts otherwise asks for the machine's location. | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y devscripts | ||
babolivier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# 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 "" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say putting
-e
in the shebang isn't great style. If your script relies on-e
being set, why not do so withset -e
- which means it doesn't matter if it gets run as./docker_update_debian_changelog.sh
orbash docker_update_debian_changelog.sh
.Not a big deal, just seems an odd choice to me.