Tamarin/hooks/07-add-package-version-suff...

20 lines
597 B
Plaintext
Raw Normal View History

2015-11-18 10:45:20 +01:00
#!/usr/bin/env bash
source "${TAMARIN_UTIL}"
if [ ! -f debian/changelog ]; then
info "No changelog. Skipping..."
exit
fi
if [ -d .git ]; then
info "It seems to be a Git repository. Generating version suffix based on Git history..."
commit_count=$(git rev-list --count HEAD)
current_commit=$(git log -n 1 --pretty=format:"%h")
version_suffix=tamarin${commit_count}~${current_commit}
else
info "Not a Git project. Fallback to timestamp for suffix generation..."
version_suffix=tamarin$(date +%Y%m%d%H%M)
fi
sed -i "0,/(\(.*\))/s/(\(.*\))/(\1-${version_suffix})/" debian/changelog