summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2025-01-10 16:47:16 +0100
committerAndrei Pavel <andrei@isc.org>2025-01-10 16:47:16 +0100
commit079e0352ae0cde1321ec83f2de4c0e30ea29ddfa (patch)
tree021488ba5cb3515bea64ab8643aeb982e9244106
parent[#3530] add add-changelog-entry Makefile rule (diff)
downloadkea-079e0352ae0cde1321ec83f2de4c0e30ea29ddfa.tar.xz
kea-079e0352ae0cde1321ec83f2de4c0e30ea29ddfa.zip
[#3530] Address review
- Add @ to suppress Makefile output. - Warn about file already existing and exit. - Use template file as base.
-rw-r--r--Makefile.am2
-rwxr-xr-xchangelog_unreleased/.add-entry.sh15
2 files changed, 11 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 7675376cdd..466028f676 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,7 +180,7 @@ install-exec-hook:
mkdir -p $(DESTDIR)${runstatedir}/${PACKAGE_NAME}
add-changelog-entry:
- ./changelog_unreleased/.add-entry.sh
+ @./changelog_unreleased/.add-entry.sh
#### include external sources in the distributed tarball:
EXTRA_DIST = ext/coroutine/coroutine.hpp
diff --git a/changelog_unreleased/.add-entry.sh b/changelog_unreleased/.add-entry.sh
index 863aa8467d..c641688056 100755
--- a/changelog_unreleased/.add-entry.sh
+++ b/changelog_unreleased/.add-entry.sh
@@ -4,12 +4,17 @@ set -eu
parent_dir=$(cd "$(dirname "${0}")" && pwd)
cd "${parent_dir}" || exit 1
+basedir=$(basename "${parent_dir}")
author=$(git show -s --format='%ae' | cut -d '@' -f 1)
branch=$(git branch --show-current)
-file="${branch}"
gitlab_id=$(printf '%s' "${branch}" | cut -d '-' -f 1)
-printf '[category]\t\t%s\n' "${author}" > "${file}"
-printf '\tdescription\n' >> "${file}"
-printf '\t(Gitlab #%s)\n' "${gitlab_id}" >> "${file}"
-printf 'Created changelog_unreleased/%s.\n' "${file}"
+file="${branch}"
+if test -e "${file}"; then
+ printf 'Nothing done. File already exists: %s\n' "${basedir}/${file}"
+ exit 1
+fi
+content=$(cat .template)
+content="${content//author/${author}}"
+content="${content//#0000/#${gitlab_id}}"
+printf '%s\n' "${content}" > "${file}"