Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #617 from arogge/dev/arogge/master/devtools
devtools: introduce devtools directory
- Loading branch information
Showing
4 changed files
with
261 additions
and
15 deletions.
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,15 @@ | ||
# Bareos Developer Tools | ||
|
||
This directory contains tools to work with the Bareos sourcecode. As a user, you will probably never need them. | ||
|
||
## `prepare-release.sh` | ||
|
||
This script does most of the hard work when releasing Bareos. It is used to prepare and tag the release-commit and a following base-commit for the ongoing work on the branch. | ||
|
||
## `update-changelog-links.sh` | ||
|
||
Script to find common link references in CHANGELOG.md (i.e. versions and bugs) and add the correct reference to the end of the file. Should be called after adding a link reference to CHANGELOG.md, but will not hurt if called too often. | ||
|
||
## `new-changelog-release.sh` | ||
|
||
Update the changelog when a release is made. Will either add a new "Unreleased" chapter in the changelog or replace an existing one with a provided version number and release-date. |
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,85 @@ | ||
#!/bin/bash | ||
# BAREOS® - Backup Archiving REcovery Open Sourced | ||
# | ||
# Copyright (C) 2020-2020 Bareos GmbH & Co. KG | ||
# | ||
# This program is Free Software; you can redistribute it and/or | ||
# modify it under the terms of version three of the GNU Affero General Public | ||
# License as published by the Free Software Foundation and included | ||
# in the file LICENSE. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. | ||
|
||
set -e | ||
set -u | ||
|
||
# this script edits the current release in the release notes or adds a new | ||
# unreleased section | ||
|
||
prog="$(basename "$0")" | ||
topdir="$(realpath "$(dirname "$0")/..")" | ||
pushd "$topdir" >/dev/null | ||
|
||
if [ $# -ne 2 ] && [ "${1:-}" != unreleased ]; then | ||
echo "usage: $prog {<version> <date>|unreleased}" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f CHANGELOG.md ]; then | ||
echo "No CHANGELOG.md to work with" >&2 | ||
exit 1 | ||
fi | ||
|
||
tmp="$(mktemp)" | ||
|
||
function cleanup { | ||
rm -f "$tmp" | ||
} | ||
trap cleanup EXIT | ||
|
||
if [ $# -eq 2 ]; then | ||
version="$1" date="$2" awk ' | ||
{ | ||
if($0 == "## [Unreleased]") { | ||
printf("## [%s] - %s\n", ENVIRON["version"], ENVIRON["date"]) | ||
} else { | ||
} | ||
} | ||
' CHANGELOG.md >"$tmp" | ||
|
||
else | ||
awk ' | ||
BEGIN { | ||
found=0 | ||
} | ||
/^## \[Unreleased\]/ { | ||
found=1 | ||
} | ||
/^## \[/ { | ||
if(found == 0 && $0 != "## [Unreleased]") { | ||
printf("## [Unreleased]\n\n") | ||
found=1 | ||
} | ||
} | ||
{ | ||
} | ||
' CHANGELOG.md >"$tmp" | ||
fi | ||
|
||
if diff -u CHANGELOG.md "$tmp" >/dev/null; then | ||
echo "$prog: CHANGELOG.md is unchanged." | ||
else | ||
mv "$tmp" CHANGELOG.md | ||
echo "$prog: updated CHANGELOG.md" | ||
echo "$prog: run update-changelog-links.sh to update link references" | ||
fi |
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
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,101 @@ | ||
#!/bin/bash | ||
# BAREOS® - Backup Archiving REcovery Open Sourced | ||
# | ||
# Copyright (C) 2020-2020 Bareos GmbH & Co. KG | ||
# | ||
# This program is Free Software; you can redistribute it and/or | ||
# modify it under the terms of version three of the GNU Affero General Public | ||
# License as published by the Free Software Foundation and included | ||
# in the file LICENSE. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. | ||
|
||
set -e | ||
set -u | ||
|
||
# This script will update link references at the end of a CHANGELOG.md | ||
# 1. remove all references (lines starting with "[...]: " | ||
# 2. look for reference tokens ([...]) and for each one that adheres to a | ||
# known format add a reference to the correct url. | ||
# A message will be shown for each unsupported token. | ||
# | ||
# Currently supported: | ||
# * "unreleased" -> link to github master branch | ||
# * version numbers -> link to gitgub release | ||
# * issue numbers -> link to bugs.bareos.org | ||
# * pull requests -> link to github PR | ||
|
||
topdir="$(realpath "$(dirname "$0")/..")" | ||
pushd "$topdir" >/dev/null | ||
|
||
if [ ! -f CHANGELOG.md ]; then | ||
echo "No CHANGELOG.md to work with" >&2 | ||
exit 1 | ||
fi | ||
|
||
tmp="$(mktemp)" | ||
|
||
function cleanup { | ||
rm -f "$tmp" | ||
} | ||
trap cleanup EXIT | ||
|
||
# strip all references first | ||
grep -v -E '^\[[^]]+\]: ' CHANGELOG.md > "$tmp" | ||
|
||
# grab every reference token, repetitions only once | ||
readarray -t ref_tokens < <( | ||
grep -o -E '\[[^]]+\]' "$tmp" \ | ||
| sed -e 's/^\[//;s/\]$//;' \ | ||
| sort -uV) | ||
|
||
for ref_tok in "${ref_tokens[@]}"; do | ||
case "$ref_tok" in | ||
Unreleased) | ||
echo '[unreleased]: https://github.com/bareos/bareos/tree/master' \ | ||
>>"$tmp" | ||
;; | ||
[0-9].[0-9].[0-9]|\ | ||
[0-9].[0-9].[0-9][0-9]|\ | ||
[0-9].[0-9][0-9].[0-9]|\ | ||
[0-9].[0-9][0-9].[0-9][0-9]|\ | ||
[0-9][0-9].[0-9].[0-9]|\ | ||
[0-9][0-9].[0-9].[0-9][0-9]|\ | ||
[0-9][0-9].[0-9][0-9].[0-9]|\ | ||
[0-9][0-9].[0-9][0-9].[0-9][0-9]) | ||
printf \ | ||
"[%s]: https://github.com/bareos/bareos/releases/tag/Release%%2F%s\n" \ | ||
"$ref_tok" \ | ||
"$ref_tok" \ | ||
>>"$tmp" | ||
;; | ||
Issue\ \#[0-9]*|\ | ||
\#[0-9]*) | ||
ticket="$(grep -o -E '[0-9]+$' <<< "$ref_tok")" | ||
printf "[%s]: https://bugs.bareos.org/view.php?id=%d\n" \ | ||
"$ref_tok" \ | ||
"$ticket" \ | ||
>>"$tmp" | ||
;; | ||
PR\ \#[0-9]*) | ||
pr="$(grep -o -E '[0-9]+$' <<< "$ref_tok")" | ||
printf "[%s]: https://github.com/bareos/bareos/pull/%d\n" \ | ||
"$ref_tok" \ | ||
"$pr" \ | ||
>>"$tmp" | ||
;; | ||
*) | ||
echo "Ignoring token [$ref_tok]" >&2 | ||
;; | ||
esac | ||
done | ||
|
||
mv "$tmp" CHANGELOG.md |