Fix build-root/scripts/version to not have spurious ~
[vpp.git] / build-root / scripts / version
1 #!/bin/bash
2
3 TAG=$(git describe | cut -d- -f1 | sed -e 's/^v//')
4 ADD=$(git describe | cut -s -d- -f2)
5 CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4)
6
7 if [ -n "${BUILD_NUMBER}" ]; then
8        BLD="~b${BUILD_NUMBER}"
9 fi
10
11 if [ "$1" = "rpm-version" ]; then
12   echo ${TAG}
13   exit
14 fi
15
16 if [ "$1" = "rpm-release" ]; then
17   [ -z "${ADD}" ] && echo release && exit
18   echo ${ADD}${CMT:+~${CMT}}${BLD}
19   exit
20 fi
21
22 if [ -n "${ADD}" ]; then
23   echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
24 else
25   echo ${TAG}
26 fi