2015-08-04 23:58:43 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source "${TAMARIN_UTIL}"
|
|
|
|
|
|
|
|
if [ -f debian/changelog ] || [ ! -d .git ]; then
|
|
|
|
info "Not a Git repository or Debian changelog already exists !"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get commits log as changelog
|
|
|
|
|
|
|
|
logs=$(git log --pretty=format:"%an - %h : %s" | sed 's/"/\\"/g')
|
|
|
|
|
|
|
|
# Set the top commiter as the maintainer of the project if not defined
|
|
|
|
top_contributor=$(git log --pretty=short | git shortlog -s -n -e | sed 's/^\s*[0-9]*\s*//g' | head -n 1)
|
|
|
|
maintainer=$(get_opt maintainer "${top_contributor}")
|
|
|
|
|
|
|
|
project_name=$(get_opt project_name)
|
|
|
|
version=$(get_opt version 0.0.0)
|
|
|
|
distribution=$(get_opt distribution UNRELEASED)
|
|
|
|
urgency=$(get_opt urgency low)
|
|
|
|
|
|
|
|
commit_count=$(git rev-list --count --first-parent HEAD)
|
|
|
|
current_commit=$(git log -n 1 --pretty=format:"%h")
|
2015-08-05 15:49:04 +02:00
|
|
|
version_suffix=${commit_count}~${current_commit}
|
2015-08-04 23:58:43 +02:00
|
|
|
|
2015-08-05 15:49:04 +02:00
|
|
|
echo "${project_name} (${version}.tamarin${version_suffix}) ${distribution}; urgency=${urgency}" > debian/changelog
|
2015-08-04 23:58:43 +02:00
|
|
|
|
|
|
|
echo >> debian/changelog
|
|
|
|
|
|
|
|
while read -r entry; do
|
|
|
|
echo " * ${entry}" >> debian/changelog
|
|
|
|
done <<< "$(echo -e "${logs}" | sed 's/^"//')"
|
|
|
|
|
|
|
|
echo >> debian/changelog
|
|
|
|
|
|
|
|
echo " -- ${maintainer} $(date -R)" >> debian/changelog
|
|
|
|
echo >> debian/changelog
|