You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

  1. --- a/build-aux/gen-version
  2. +++ b/build-aux/gen-version
  3. @@ -1,39 +1,4 @@
  4. #!/bin/sh
  5. -VERSION="unknown"
  6. -
  7. -DIRTY=""
  8. -git status | grep -q clean || DIRTY='.dirty'
  9. -
  10. -# Special environment variable to signal that we are building a release, as this
  11. -# has consequences for the version number.
  12. -if [ "${IS_RELEASE}" = "YES" ]; then
  13. - TAG="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)"
  14. - if [ -n "${TAG}" ]; then
  15. - # We're on a tag
  16. - echo "${TAG}${DIRTY}" > .version
  17. - printf "${TAG}${DIRTY}"
  18. - exit 0
  19. - fi
  20. - echo 'This is not a tag, either tag this commit or do not set $IS_RELEASE' >&2
  21. - exit 1
  22. -fi
  23. -
  24. -#
  25. -# Generate the version number based on the branch
  26. -#
  27. -if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then
  28. - if $(git rev-parse --abbrev-ref HEAD | grep -q 'rel/'); then
  29. - REL_TYPE="$(git rev-parse --abbrev-ref HEAD | cut -d/ -f 2 | cut -d- -f 1)"
  30. - VERSION="$(git describe --match=${REL_TYPE}-* --tags --dirty=.dirty | cut -d- -f 2-)"
  31. - else
  32. - GIT_VERSION=$(git show --no-patch --format=format:%h HEAD)
  33. - BRANCH=".$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/[^[:alnum:]]//g;')"
  34. - [ "${BRANCH}" = ".master" ] && BRANCH=''
  35. - VERSION="0.0${BRANCH}.${PDNS_BUILD_NUMBER}g${GIT_VERSION}${DIRTY}"
  36. - fi
  37. - echo "$VERSION" > .version
  38. -elif [ -f .version ]; then
  39. - VERSION="$(cat .version)"
  40. -fi
  41. +VERSION="$(cat .version)"
  42. printf $VERSION