3 path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
7 if [ -f .version ]; then
8 vstring=$(cat .version)
10 vstring=$(git describe)
16 TAG=$(echo ${vstring} | cut -d- -f1 | sed -e 's/^v//')
17 ADD=$(echo ${vstring} | cut -s -d- -f2)
19 git rev-parse 2> /dev/null
21 CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4)
23 CMT=$(echo ${vstring} | cut -s -d- -f3,4)
25 CMTR=$(echo $CMT | sed 's/-/_/')
27 if [ -n "${BUILD_NUMBER}" ]; then
28 BLD="~b${BUILD_NUMBER}"
31 if [ "$1" = "rpm-version" ]; then
36 if [ "$1" = "rpm-release" ]; then
37 [ -z "${ADD}" ] && echo release && exit
38 echo ${ADD}${CMTR:+~${CMTR}}${BLD}
42 if [ -n "${ADD}" ]; then
43 if [ "$1" = "rpm-string" ]; then
44 echo ${TAG}-${ADD}${CMTR:+~${CMTR}}${BLD}
46 echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}