blob: 84ee5dbe4deb6d6c068aec5020d518373b45067c [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 Warnicke227fe262016-06-02 17:38:22 -050018 CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4 | sed 's/-/_/')
Ed Warnicke750c6252016-05-31 14:04:16 -070019 echo ${ADD}${CMT:+~${CMT}}${BLD}
Ed Warnickecb9cada2015-12-08 15:45:58 -070020 exit
21fi
22
23if [ -n "${ADD}" ]; then
Ed Warnicke750c6252016-05-31 14:04:16 -070024 echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
Ed Warnickecb9cada2015-12-08 15:45:58 -070025else
26 echo ${TAG}
27fi