]>
git.ipfire.org Git - thirdparty/pdns.git/blob - build-aux/gen-version
3 if [ ! -z "$BUILDER_VERSION" ]; then
4 printf $BUILDER_VERSION
5 echo $BUILDER_VERSION > .version
12 git status |
grep -q clean || DIRTY
='.dirty'
14 # Special environment variable to signal that we are building a release, as this
15 # has consequences for the version number.
16 if [ "${IS_RELEASE}" = "YES" ]; then
17 TAG
="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)"
18 if [ -n "${TAG}" ]; then
20 echo "${TAG}${DIRTY}" > .version
21 printf "${TAG}${DIRTY}"
24 echo 'This is not a tag, either tag this commit or do not set $IS_RELEASE' >&2
29 # Generate the version number based on the branch
31 if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then
32 if $
(git rev-parse
--abbrev-ref HEAD |
grep -q 'rel/'); then
33 REL_TYPE
="$(git rev-parse --abbrev-ref HEAD | cut -d/ -f 2 | cut -d- -f 1)"
34 VERSION
="$(git describe --match=${REL_TYPE}-* --tags --dirty=.dirty | cut -d- -f 2-)"
36 GIT_VERSION
=$
(git show
--no-patch --format=format
:%h HEAD
)
37 BRANCH
=".$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/[^[:alnum:]]//g;')"
38 [ "${BRANCH}" = ".master" ] && BRANCH
=''
39 VERSION
="0.0${BRANCH}.${PDNS_BUILD_NUMBER}g${GIT_VERSION}${DIRTY}"
41 echo "$VERSION" > .version
42 elif [ -f .version
]; then
43 VERSION
="$(cat .version)"