diff --git a/tools/bump-changelog.sh b/tools/bump-changelog.sh index 3066ba4..a101e4b 100755 --- a/tools/bump-changelog.sh +++ b/tools/bump-changelog.sh @@ -12,6 +12,20 @@ CURRENT="$(head -n1 "${ROOT}/debian/changelog" | sed -nE 's/^[A-Za-z0-9._+-]+ \( if [ "${VERSION}" = "${CURRENT}" ]; then echo "Changelog already at ${VERSION}." else - dch --distribution noble --ignoretime -v "${VERSION}" \ + # dch identity: prefer the package maintainer (single source of truth in + # debian/control). Setting DEBNAME/DEBEMAIL keeps dch non-interactive -- + # without them dch prints warnings and waits for a keypress, which would + # hang unattended builds. + MAINTAINER="$(sed -nE 's/^Maintainer:[[:space:]]*(.*)$/\1/p' "${ROOT}/debian/control" | head -n1)" + EMAIL_RE='<([^>]+)>' + if [[ "${MAINTAINER}" =~ ${EMAIL_RE} ]]; then + NAME="${MAINTAINER%% <}*" + EMAIL="${BASH_REMATCH[1]}" + else + NAME="$(git -C "${ROOT}" config user.name || echo maintainer)" + EMAIL="$(git -C "${ROOT}" config user.email || echo maintainer@example.com)" + fi + DEBNAME="${NAME}" DEBEMAIL="${EMAIL}" \ + dch --distribution noble -v "${VERSION}" \ "Bumped to rolling version ${VERSION}." fi