Merge changelog creation and package name suffix in one hook

This commit is contained in:
Benjamin Bohard 2020-08-25 14:23:59 +02:00
parent 878b8c48ce
commit e49636df62
2 changed files with 22 additions and 6 deletions

View File

@ -38,6 +38,7 @@ touch debian/changelog
project_name=$(tamarin_db get project_name)
distribution=$(tamarin_db get distribution UNRELEASED)
urgency=$(tamarin_db get urgency low)
package_level=$(tamarin_db get package_level dev)
function get_hash {
# Return commit hash from various pointer
@ -45,6 +46,12 @@ function get_hash {
echo "$(git log -n1 --format=%H ${pointer})"
}
function get_short_hash {
# Return commit short hash from various pointer
pointer="$1"
echo "$(git log -n1 --format=%h ${pointer})"
}
function get_previous_pkg_tag {
# Return previous pkg/* tag or current tag if no previous pkg/* exists.
commit="$1"
@ -175,19 +182,29 @@ function next_version {
distance_from_release=$(get_distance_from_tag "$previous_release" "$commit")
if [ $distance_from_release -le $distance_from_pkg ]
then
echo "$(get_upstream_version_from_tag $previous_release)-1"
distance=$distance_from_release
version="$(get_upstream_version_from_tag $previous_release)-1"
else
echo "$(get_upstream_version_from_tag $previous_pkg)-$(expr $(get_package_version_from_tag $previous_pkg) + 1)"
distance=$distance_from_pkg
version="$(get_upstream_version_from_tag $previous_pkg)-$(expr $(get_package_version_from_tag $previous_pkg) + 1)"
fi
elif [ -n "$previous_release" ]
then
echo "$(get_upstream_version_from_tag $previous_release)-1"
distance=$distance_from_release
version="$(get_upstream_version_from_tag $previous_release)-1"
elif [ -n "$previous_pkg" ]
then
echo "$(get_upstream_version_from_tag $previous_pkg)-$(expr $(get_package_version_from_tag $previous_pkg) + 1)"
distance=$distance_from_pkg
version="$(get_upstream_version_from_tag $previous_pkg)-$(expr $(get_package_version_from_tag $previous_pkg) + 1)"
else
echo tata
distance=$(git rev-list --no-merges --count ${commit}..${first_commit})
version="0.0.0-1"
fi
if [ "$package_level" = 'dev' ] || [ "$package_level" = 'staging' ]
then
version="${version}~${package_level}+${distance}-$(get_short_hash $commit)"
fi
echo $version
}
function gen_changelog_entry {

View File

@ -17,7 +17,6 @@ hooks=
prebuild/debian/load-project-db,
prebuild/debian/complete-project-db,
prebuild/eole/create-changelog,
prebuild/eole/add-package-version-suffix,
prebuild/debian/install-build-depends
# Configuration de l'étape de construction du paquet