diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2022-09-19 13:28:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-19 13:28:52 +0200 |
commit | 9282b402c6871048f4be628849f25d37497eddfb (patch) | |
tree | 57afe55399eec6e696ef673afb158eb0bc22c716 /dist | |
parent | 8abef402a7f49646e1f7ac797603acedf281f5e9 (diff) | |
parent | 6d07fcaf34dd1e958483ef97d17ca4f83345623a (diff) |
Merge pull request #24115 from vespa-engine/arnej/getversion-sh
add and use getversionmap.sh
Diffstat (limited to 'dist')
-rwxr-xr-x | dist/getversionmap.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/dist/getversionmap.sh b/dist/getversionmap.sh new file mode 100755 index 00000000000..a58bfa462a4 --- /dev/null +++ b/dist/getversionmap.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +srcdir=$1 + +[ "$srcdir" ] && [ -d "$srcdir" ] && [ -f "$srcdir/VERSION" ] || { echo "Usage: $0 <source-top-dir>" >&2; exit 1; } + +cd "$srcdir" + +dateadd=${VBUILD_VERSION_DATE} +if [ "$dateadd" = "" ]; then + dateadd=$(date +"%Y%m%d.%H%M%S") +fi + +tag="HEAD" + +version=${FACTORY_VESPA_VERSION} +if [ "$version" = "" ]; then + mainver=$(cat VERSION) + version="${mainver}.${dateadd}" +fi + +ostype=$(uname -s) +osver=$(uname -r) +osarch=$(uname -m) +commit_sha=$(git rev-parse HEAD || echo ffffffffffffffffffffffffffffffffffffffff) +commit_date=$(git show -s --format=%ct ${commit_sha} || echo 0) + +vtag_system_rev="${ostype}-${osver}" +who=$(whoami || logname) +where=$(uname -n) +where=${where%.yahoo.com} + +vtag_date=${dateadd} + +mv=$version +major=${mv%%.*}; mv=${mv#*.} +minor=${mv%%.*}; mv=${mv#*.} +micro=${mv%%.*}; + +if [ "$major" = "" ]; then major=0; fi +if [ "$minor" = "" ]; then minor=0; fi +if [ "$micro" = "" ]; then micro=0; fi + +vtag_component=$major.$minor.$micro + +echo "V_TAG ${tag}" +echo "V_TAG_DATE ${vtag_date}" +echo "V_TAG_PKG ${version}" +echo "V_TAG_ARCH ${osarch}" +echo "V_TAG_SYSTEM ${ostype}" +echo "V_TAG_SYSTEM_REV ${vtag_system_rev}" +echo "V_TAG_BUILDER ${who}@${where}" +echo "V_TAG_COMPONENT ${vtag_component}" +echo "V_TAG_COMMIT_SHA ${commit_sha}" +echo "V_TAG_COMMIT_DATE ${commit_date}" + +exit 0 |