From e2c4284f9646d57edb6164e9e975e33e1fe0a3a3 Mon Sep 17 00:00:00 2001
From: Markus Frosch <markus.frosch@icinga.com>
Date: Fri, 29 Nov 2019 10:44:22 +0100
Subject: [PATCH] Update release script to avoid dch

---
 icinga-build-release | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/icinga-build-release b/icinga-build-release
index 0f64d28..36965af 100755
--- a/icinga-build-release
+++ b/icinga-build-release
@@ -101,20 +101,31 @@ fi
 
 # Doing the actual work now
 if [ "$variant" = deb ]; then
-  echo "Updating version with dch"
-  DEBFULLNAME="$(git config user.name)"
-  DEBEMAIL="$(git config user.email)"
+  echo "Updating version in debian/changelog"
+  if ! DEBFULLNAME="$(git config user.name)"; then
+    echo "Could not get your user name from git!" >&2
+    exit 1
+  fi
+  if ! DEBEMAIL="$(git config user.email)"; then
+    echo "Could not get your user email from git!" >&2
+    exit 1
+  fi
   export DEBFULLNAME DEBEMAIL
 
-  dchopt=()
   if [[ "${version}" != *-* ]]; then
     full_version="${version}-1"
   else
     full_version="${version}"
-    dchopt+=(--force-distribution -D "${DCH_DIST}")
   fi
 
-  (set -x; dch -v "${full_version}" "${dchopt[@]}" -- "${message}")
+  source_name="$(grep Source: debian/control | awk '{print $2}')"
+  changelog="${source_name} (${full_version}) ${DCH_DIST}; urgency=medium"$'\n\n'
+  changelog+="  * ${message}"$'\n'
+  changelog+=$'\n'" -- ${DEBFULLNAME} <${DEBEMAIL}>  $(LANG=C date -R)"$'\n\n'
+
+  # Insert into changelog
+  echo -n "${changelog}" | cat - debian/changelog >debian/changelog.tmp
+  mv debian/changelog.tmp debian/changelog
 
   # Staging the change
   git add debian/changelog
-- 
GitLab