blob: bf7e31551b929bb399726e65b6c388c75d2765a4 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001#!/bin/bash
2
3TAG=$(git describe | cut -d- -f1 | sed -e 's/^v//')
4ADD=$(git describe | cut -s -d- -f2)
5CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4)
6
Damjan Marion4e6be682016-05-16 15:55:36 +02007if [ -n "${BUILD_NUMBER}" ]; then
8 BLD="~b${BUILD_NUMBER}"
9fi
10
Ed Warnickecb9cada2015-12-08 15:45:58 -070011if [ "$1" = "rpm-version" ]; then
12 echo ${TAG}
13 exit
14fi
15
16if [ "$1" = "rpm-release" ]; then
17 [ -z "${ADD}" ] && echo release && exit
Dave Barach0e5e3c32016-01-25 08:28:22 -050018 CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4 | sed 's/-/_/')
Damjan Marion4e6be682016-05-16 15:55:36 +020019 echo ${ADD}~${CMT}${BLD}
Ed Warnickecb9cada2015-12-08 15:45:58 -070020 exit
21fi
22
23if [ -n "${ADD}" ]; then
Damjan Marion4e6be682016-05-16 15:55:36 +020024 echo ${TAG}-${ADD}~${CMT}${BLD}
Ed Warnickecb9cada2015-12-08 15:45:58 -070025else
26 echo ${TAG}
27fi