2020-07-27 14:27:00 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
cd src
|
|
|
|
|
|
|
|
if [ ! -f debian/changelog ]; then
|
2020-08-25 11:25:34 +02:00
|
|
|
tamarin_info "No changelog. Skipping adding suffix to package version"
|
2020-07-27 14:27:00 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $(tamarin_db get no_version_suffix 'no') == 'yes' ]; then
|
|
|
|
tamarin_info "Not adding version suffix."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2020-08-25 11:25:34 +02:00
|
|
|
tamarin_info "Suffixing package version"
|
2020-07-27 14:27:00 +02:00
|
|
|
if [ -d .git ]; then
|
|
|
|
tamarin_info "It seems to be a Git repository. Generating version suffix based on Git history..."
|
2020-08-25 11:25:34 +02:00
|
|
|
release_tag=$(git describe --match "release/*" --abbrev=0 2>/dev/null)
|
|
|
|
if [ -z "${release_tag}" ]
|
|
|
|
then
|
|
|
|
dev_commit_count=$(git rev-list --count --no-merges develop)
|
|
|
|
else
|
|
|
|
dev_commit_count=$(git rev-list --count ${release_tag}..master)
|
|
|
|
fi
|
|
|
|
if [ ${dev_commit_count} -gt 0 ]
|
|
|
|
then
|
|
|
|
build_level=$(tamarin_db get build_level 'dev')
|
|
|
|
version_suffix="~$build_level+${dev_commit_count}-$(git log -n1 --format=%h)"
|
|
|
|
else
|
|
|
|
version_suffix=''
|
|
|
|
fi
|
2020-07-27 14:27:00 +02:00
|
|
|
else
|
|
|
|
tamarin_info "Not a Git project. Fallback to timestamp for suffix generation..."
|
|
|
|
version_suffix=tamarin$(date +%Y%m%d%H%M)
|
|
|
|
fi
|
|
|
|
|
2020-08-25 11:25:34 +02:00
|
|
|
tamarin_info "Suffixing package version with $version_suffix"
|
2020-07-27 14:27:00 +02:00
|
|
|
sed -i "0,/(\(.*\))/s/(\(.*\))/(\1${version_suffix})/" debian/changelog
|
2020-08-25 11:25:34 +02:00
|
|
|
cp debian/changelog /dist/changelog
|