Fixup version release detection

This commit is contained in:
Matt Keeler 2018-06-18 11:57:35 -04:00
parent ca1a0619bd
commit b739bbfefe
1 changed files with 7 additions and 5 deletions

View File

@ -138,6 +138,7 @@ function parse_version {
version_main=$(awk '$1 == "Version" && $2 == "=" { gsub(/"/, "", $3); print $3 }' < ${vfile}) version_main=$(awk '$1 == "Version" && $2 == "=" { gsub(/"/, "", $3); print $3 }' < ${vfile})
release_main=$(awk '$1 == "VersionPrerelease" && $2 == "=" { gsub(/"/, "", $3); print $3 }' < ${vfile}) release_main=$(awk '$1 == "VersionPrerelease" && $2 == "=" { gsub(/"/, "", $3); print $3 }' < ${vfile})
# try to determine the version if we have build tags # try to determine the version if we have build tags
for tag in "$GOTAGS" for tag in "$GOTAGS"
do do
@ -151,6 +152,7 @@ function parse_version {
done done
done done
# override the version from source with the value of the GIT_DESCRIBE env var if present # override the version from source with the value of the GIT_DESCRIBE env var if present
if test -n "${git_version}" if test -n "${git_version}"
then then
@ -162,19 +164,19 @@ function parse_version {
if is_set "${include_release}" if is_set "${include_release}"
then then
# Get the release version out of the source file # Get the release version out of the source file
release="${release_main}" rel_ver="${release_main}"
# When no GIT_DESCRIBE env var is present and no release is in the source then we # When no GIT_DESCRIBE env var is present and no release is in the source then we
# are definitely in dev mode # are definitely in dev mode
if test -z "${git_version}" -a -z "$release" if test -z "${git_version}" -a -z "${rel_ver}"
then then
release="dev" rel_ver="dev"
fi fi
# Add the release to the version # Add the release to the version
if test -n "$release" if test -n "${rel_ver}"
then then
version="${version}-${release}" version="${version}-${rel_ver}"
# add the git commit to the version # add the git commit to the version
if test -n "${git_commit}" if test -n "${git_commit}"