prevent the 'latest' tag from messing with our version

We need to use git describe in a way that only refers to vX.Y.Z style tags.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2023-12-07 04:00:32 -08:00
parent c609bc9446
commit f252af1dd1
20 changed files with 20 additions and 20 deletions

View file

@ -20,7 +20,7 @@ git submodule init
git submodule update git submodule update
cd - cd -
GITVERSION=$(cd subsurface ; git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//') GITVERSION=$(cd subsurface ; git describe --match "v[0-9]*" --abbrev=12 | sed -e 's/-g.*$// ; s/^v//')
GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//') GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//')
VERSION=$(echo $GITVERSION | sed -e 's/-/./') VERSION=$(echo $GITVERSION | sed -e 's/-/./')
GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d) GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)

View file

@ -84,7 +84,7 @@ mkdir -p "$BUILDROOT"/subsurface-mobile-build
pushd "$BUILDROOT"/subsurface-mobile-build pushd "$BUILDROOT"/subsurface-mobile-build
# set up the Subsurface versions by hand # set up the Subsurface versions by hand
GITVERSION=$(cd "$SUBSURFACE_SOURCE" ; git describe --abbrev=12) GITVERSION=$(cd "$SUBSURFACE_SOURCE" ; git describe --match "v[0-9]*" --abbrev=12)
CANONICALVERSION=$(echo "$GITVERSION" | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./') CANONICALVERSION=$(echo "$GITVERSION" | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./')
MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2) MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2)
echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > ssrf-version.h echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > ssrf-version.h

View file

@ -27,7 +27,7 @@ git submodule init
git submodule update git submodule update
cd - cd -
GITVERSION=$(cd subsurface ; git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//') GITVERSION=$(cd subsurface ; git describe --match "v[0-9]*" --abbrev=12 | sed -e 's/-g.*$// ; s/^v//')
GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//') GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//')
VERSION=$(echo $GITVERSION | sed -e 's/-/./') VERSION=$(echo $GITVERSION | sed -e 's/-/./')
GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d) GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)

View file

@ -58,7 +58,7 @@ if [ -z $QT_VERSION ] ; then
fi fi
# set up the Subsurface versions by hand # set up the Subsurface versions by hand
GITVERSION=$(cd "$SUBSURFACE_SOURCE" ; git describe --abbrev=12) GITVERSION=$(cd "$SUBSURFACE_SOURCE" ; git describe --match "v[0-9]*" --abbrev=12)
CANONICALVERSION=$(echo $GITVERSION | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./') CANONICALVERSION=$(echo $GITVERSION | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./')
MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2) MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2)
echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > "$SUBSURFACE_SOURCE"/ssrf-version.h echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > "$SUBSURFACE_SOURCE"/ssrf-version.h

View file

@ -21,7 +21,7 @@ git submodule init
git submodule update git submodule update
cd - cd -
GITVERSION=$(cd subsurface ; git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//') GITVERSION=$(cd subsurface ; git describe --match "v[0-9]*" --abbrev=12 | sed -e 's/-g.*$// ; s/^v//')
GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//') GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//')
VERSION=$(echo $GITVERSION | sed -e 's/-/./') VERSION=$(echo $GITVERSION | sed -e 's/-/./')
GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d) GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)

View file

@ -5,7 +5,7 @@
# this will, however, fail for plain tar balls create via git archive # this will, however, fail for plain tar balls create via git archive
SCRIPT_DIR="$( cd "${BASH_SOURCE%/*}" ; pwd )" SCRIPT_DIR="$( cd "${BASH_SOURCE%/*}" ; pwd )"
VERSION=$(git describe --abbrev=12) || VERSION=$(cat "$SCRIPT_DIR"/../.gitversion) VERSION=$(git describe --match "v[0-9]*" --abbrev=12) || VERSION=$(cat "$SCRIPT_DIR"/../.gitversion)
DATE=$(git log -1 --format="%ct" | xargs -I{} date -d @{} +%Y-%m-%d) DATE=$(git log -1 --format="%ct" | xargs -I{} date -d @{} +%Y-%m-%d)
if [ "$DATE" = "" ] ; then if [ "$DATE" = "" ] ; then
DATE=$(cat "$SCRIPT_DIR"/../.gitdate) DATE=$(cat "$SCRIPT_DIR"/../.gitdate)

View file

@ -4,7 +4,7 @@
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
# setup build dir on the host, not inside of the container # setup build dir on the host, not inside of the container
mkdir -p ../subsurface-mobile-build-docker-arm mkdir -p ../subsurface-mobile-build-docker-arm

View file

@ -18,7 +18,7 @@ os=$1
if [ $# -eq 2 ] && [ "$2" ]; then if [ $# -eq 2 ] && [ "$2" ]; then
v0=$2 v0=$2
else else
cmd="git describe --abbrev=12" cmd="git describe --match "v[0-9]*" --abbrev=12"
v0=$($cmd) || v0=$(cat .gitversion) || croak "odd; command '$cmd' failed" v0=$($cmd) || v0=$(cat .gitversion) || croak "odd; command '$cmd' failed"
fi fi

View file

@ -14,7 +14,7 @@ unset -f popd
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
git submodule init git submodule init
git submodule update --recursive git submodule update --recursive

View file

@ -6,7 +6,7 @@ set -e
# this gets executed by Travis when building for iOS # this gets executed by Travis when building for iOS
# it gets started from inside the subsurface directory # it gets started from inside the subsurface directory
GITVERSION=$(git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//') GITVERSION=$(git describe --match "v[0-9]*" --abbrev=12 | sed -e 's/-g.*$// ; s/^v//')
VERSION=$(echo $GITVERSION | sed -e 's/-/./') VERSION=$(echo $GITVERSION | sed -e 's/-/./')
echo "preparing dependencies for Subsurface-mobile ${VERSION} for iOS" echo "preparing dependencies for Subsurface-mobile ${VERSION} for iOS"

View file

@ -13,7 +13,7 @@ TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR:-$PWD}
git fetch --unshallow || true # if running locally, unshallow could fail git fetch --unshallow || true # if running locally, unshallow could fail
git pull --tags git pull --tags
git submodule init git submodule init
git describe git describe --match "v[0-9]*"
# make sure we have libdivecomputer # make sure we have libdivecomputer
echo "Get libdivecomputer" echo "Get libdivecomputer"

View file

@ -12,7 +12,7 @@ set -x
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
export QT_ROOT=$PWD/Qt/5.9.3 export QT_ROOT=$PWD/Qt/5.9.3
rm -rf Qt rm -rf Qt

View file

@ -16,7 +16,7 @@ export CXX=g++-5
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
. /opt/qt510/bin/qt510-env.sh . /opt/qt510/bin/qt510-env.sh
export QT_ROOT=/opt/qt510 export QT_ROOT=/opt/qt510

View file

@ -13,7 +13,7 @@ unset -f popd
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
# prep things so we can build for Mac # prep things so we can build for Mac
# we have a custom built Qt some gives us just what we need, including QtWebKit # we have a custom built Qt some gives us just what we need, including QtWebKit

View file

@ -4,7 +4,7 @@
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
# Ugly, but keeps it running during the build # Ugly, but keeps it running during the build
docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d ubuntu:16.04 /bin/sleep 60m docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d ubuntu:16.04 /bin/sleep 60m

View file

@ -4,7 +4,7 @@
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
# Ugly, but keeps it running during the build # Ugly, but keeps it running during the build
docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d opensuse:42.3 /bin/sleep 60m docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d opensuse:42.3 /bin/sleep 60m

View file

@ -4,7 +4,7 @@
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
# Ugly, but keeps it running during the build # Ugly, but keeps it running during the build
docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d fedora:26 /bin/sleep 60m docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d fedora:26 /bin/sleep 60m

View file

@ -4,7 +4,7 @@
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
# Ugly, but keeps it running during the build # Ugly, but keeps it running during the build
docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d fedora:27 /bin/sleep 60m docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d fedora:27 /bin/sleep 60m

View file

@ -10,7 +10,7 @@ TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR:-$PWD}
git fetch --unshallow || true # if running locally, unshallow could fail git fetch --unshallow || true # if running locally, unshallow could fail
git pull --tags git pull --tags
git submodule init git submodule init
git describe git describe --match "v[0-9]*"
# make sure we have libdivecomputer # make sure we have libdivecomputer
echo "Get libdivecomputer" echo "Get libdivecomputer"

View file

@ -6,7 +6,7 @@ set -x
# Sorry Travis, fetching the whole thing and the tags as well... # Sorry Travis, fetching the whole thing and the tags as well...
git fetch --unshallow git fetch --unshallow
git pull --tags git pull --tags
git describe git describe --match "v[0-9]*"
# grab our own custom MXE environment # grab our own custom MXE environment
pushd ${TRAVIS_BUILD_DIR}/.. pushd ${TRAVIS_BUILD_DIR}/..