version-at-commit.sh uses '.dev' instead of '.pre'
[arvados.git] / build / version-at-commit.sh
index 2f514c82da0cf7f58d1f08a5b9a26a2c1e3c1f5e..6ed34244a139247dd1409b7fcab114a621d24c02 100755 (executable)
@@ -3,6 +3,7 @@
 set -e -o pipefail
 commit="$1"
 versionglob="[0-9].[0-9]*.[0-9]*"
+devsuffix=".dev"
 
 if ! git describe --exact-match --match "$versionglob" "$commit" 2>/dev/null; then
     if git merge-base --is-ancestor "$commit" origin/master; then
@@ -12,6 +13,7 @@ if ! git describe --exact-match --match "$versionglob" "$commit" 2>/dev/null; th
         # x.y.(z+1).preTIMESTAMP, where x.y.z is the latest released ancestor of $commit
         v=$(git describe --abbrev=0 --match "$versionglob" "$commit" | perl -pe 's/(\d+)$/$1+1/e')
     fi
-    ts=$(TZ=UTC git log -n1 --format=%cd --date="format-local:%Y%m%d%H%M%S" "$commit")
-    echo "$v.pre$ts"
+    isodate=$(TZ=UTC git log -n1 --format=%cd --date=iso "$commit")
+    ts=$(TZ=UTC date --date="$isodate" "+%Y%m%d%H%M%S")
+    echo "${v}${devsuffix}${ts}"
 fi