Adding support for package versionning

Create a tag with release/X.X.X to change the package version
This commit is contained in:
2015-08-20 16:29:36 +02:00
parent a4b739dc97
commit 8aec313e11
3 changed files with 44 additions and 23 deletions

View File

@ -9,30 +9,44 @@ fi
# Get commits log as changelog
logs=$(git log --pretty=format:"%an - %h : %s" | sed 's/"/\\"/g')
tags=$(git tag master -l "release/*")
# 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}")
if [[ -z ${tags} ]]
then
error "No relase tag found, you repo must have a tag like 'release/X.X'"
exit 2
fi
project_name=$(get_opt project_name)
version=$(get_opt version 0.0.0)
distribution=$(get_opt distribution UNRELEASED)
urgency=$(get_opt urgency low)
git checkout $(get_opt build_branch dist/ubuntu/precise/master)
touch debian/changelog
commit_count=$(git rev-list --count --first-parent HEAD)
current_commit=$(git log -n 1 --pretty=format:"%h")
version_suffix=${commit_count}~${current_commit}
for tag in ${tags}
do
logs=$(git log --pretty=format:"%an - %h : %s" ${tag} | sed 's/"/\\"/g')
echo "${project_name} (${version}.tamarin${version_suffix}) ${distribution}; urgency=${urgency}" > debian/changelog
# 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}")
echo >> debian/changelog
project_name=$(get_opt project_name)
version=${tag#*/} #$(get_opt version 0.0.0)
distribution=$(get_opt distribution UNRELEASED)
urgency=$(get_opt urgency low)
while read -r entry; do
commit_count=$(git rev-list --count --first-parent HEAD)
current_commit=$(git log -n 1 --pretty=format:"%h")
version_suffix=${commit_count}~${current_commit}
echo "${project_name} (${version}.tamarin${version_suffix}) ${distribution}; urgency=${urgency}" >> debian/changelog
echo >> debian/changelog
while read -r entry; do
echo " * ${entry}" >> debian/changelog
done <<< "$(echo -e "${logs}" | sed 's/^"//')"
done <<< "$(echo -e "${logs}" | sed 's/^"//')"
echo >> debian/changelog
echo >> debian/changelog
echo " -- ${maintainer} $(date -R)" >> debian/changelog
echo >> debian/changelog
echo " -- ${maintainer} $(date -R)" >> debian/changelog
echo >> debian/changelog
done