blob: 8724ced3c18ddb009a00d402020384121fe79c0a [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
Ed Warnicke750c6252016-05-31 14:04:16 -070018 echo ${ADD}${CMT:+~${CMT}}${BLD}
Ed Warnickecb9cada2015-12-08 15:45:58 -070019 exit
20fi
21
22if [ -n "${ADD}" ]; then
Ed Warnicke750c6252016-05-31 14:04:16 -070023 echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
Ed Warnickecb9cada2015-12-08 15:45:58 -070024else
25 echo ${TAG}
26fi