From f252af1dd10d58505abc823eeb8d301eacd88bde Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 7 Dec 2023 04:00:32 -0800 Subject: [PATCH] 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 --- packaging/OBS/make-package.sh | 2 +- packaging/android/qmake-build.sh | 2 +- packaging/copr/make-package.sh | 2 +- packaging/ios/build.sh | 2 +- packaging/ubuntu/make-package.sh | 2 +- scripts/add-version-to-appdata.sh | 2 +- scripts/android/before_install.sh | 2 +- scripts/get-version | 2 +- scripts/ios/before_install.sh | 2 +- scripts/ios/travisbuild.sh | 2 +- scripts/linux-trusty-qt512/before_install.sh | 2 +- scripts/linux/before_install.sh | 2 +- scripts/linux2/before_install.sh | 2 +- scripts/mac/before_install.sh | 2 +- scripts/qt55/before_install.sh | 2 +- scripts/qt56/before_install.sh | 2 +- scripts/qt57/before_install.sh | 2 +- scripts/qt59/before_install.sh | 2 +- scripts/windows-container/before_install.sh | 2 +- scripts/windows/before_install.sh | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packaging/OBS/make-package.sh b/packaging/OBS/make-package.sh index ff85a0e26..bbcf1725f 100644 --- a/packaging/OBS/make-package.sh +++ b/packaging/OBS/make-package.sh @@ -20,7 +20,7 @@ git submodule init git submodule update 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/.*\..*//') VERSION=$(echo $GITVERSION | sed -e 's/-/./') GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d) diff --git a/packaging/android/qmake-build.sh b/packaging/android/qmake-build.sh index c471a467d..7bd97b8df 100755 --- a/packaging/android/qmake-build.sh +++ b/packaging/android/qmake-build.sh @@ -84,7 +84,7 @@ mkdir -p "$BUILDROOT"/subsurface-mobile-build pushd "$BUILDROOT"/subsurface-mobile-build # 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/-/./') MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2) echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > ssrf-version.h diff --git a/packaging/copr/make-package.sh b/packaging/copr/make-package.sh index a270f73f5..ec77954e2 100644 --- a/packaging/copr/make-package.sh +++ b/packaging/copr/make-package.sh @@ -27,7 +27,7 @@ git submodule init git submodule update 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/.*\..*//') VERSION=$(echo $GITVERSION | sed -e 's/-/./') GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d) diff --git a/packaging/ios/build.sh b/packaging/ios/build.sh index 7b3374d99..562b035c5 100755 --- a/packaging/ios/build.sh +++ b/packaging/ios/build.sh @@ -58,7 +58,7 @@ if [ -z $QT_VERSION ] ; then fi # 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/-/./') MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2) echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > "$SUBSURFACE_SOURCE"/ssrf-version.h diff --git a/packaging/ubuntu/make-package.sh b/packaging/ubuntu/make-package.sh index 7fb61f71b..ada1740c3 100644 --- a/packaging/ubuntu/make-package.sh +++ b/packaging/ubuntu/make-package.sh @@ -21,7 +21,7 @@ git submodule init git submodule update 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/.*\..*//') VERSION=$(echo $GITVERSION | sed -e 's/-/./') GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d) diff --git a/scripts/add-version-to-appdata.sh b/scripts/add-version-to-appdata.sh index 930db44ae..e4b03c73c 100755 --- a/scripts/add-version-to-appdata.sh +++ b/scripts/add-version-to-appdata.sh @@ -5,7 +5,7 @@ # this will, however, fail for plain tar balls create via git archive 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) if [ "$DATE" = "" ] ; then DATE=$(cat "$SCRIPT_DIR"/../.gitdate) diff --git a/scripts/android/before_install.sh b/scripts/android/before_install.sh index 42a3bb1d1..ccd611fe7 100644 --- a/scripts/android/before_install.sh +++ b/scripts/android/before_install.sh @@ -4,7 +4,7 @@ # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" # setup build dir on the host, not inside of the container mkdir -p ../subsurface-mobile-build-docker-arm diff --git a/scripts/get-version b/scripts/get-version index a063efc9e..99758ade7 100755 --- a/scripts/get-version +++ b/scripts/get-version @@ -18,7 +18,7 @@ os=$1 if [ $# -eq 2 ] && [ "$2" ]; then v0=$2 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" fi diff --git a/scripts/ios/before_install.sh b/scripts/ios/before_install.sh index 44f3dabe3..ed0b7471b 100644 --- a/scripts/ios/before_install.sh +++ b/scripts/ios/before_install.sh @@ -14,7 +14,7 @@ unset -f popd # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" git submodule init git submodule update --recursive diff --git a/scripts/ios/travisbuild.sh b/scripts/ios/travisbuild.sh index fd8513b29..1f7f5ca38 100644 --- a/scripts/ios/travisbuild.sh +++ b/scripts/ios/travisbuild.sh @@ -6,7 +6,7 @@ set -e # this gets executed by Travis when building for iOS # 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/-/./') echo "preparing dependencies for Subsurface-mobile ${VERSION} for iOS" diff --git a/scripts/linux-trusty-qt512/before_install.sh b/scripts/linux-trusty-qt512/before_install.sh index cd119c774..f9ae24485 100644 --- a/scripts/linux-trusty-qt512/before_install.sh +++ b/scripts/linux-trusty-qt512/before_install.sh @@ -13,7 +13,7 @@ TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR:-$PWD} git fetch --unshallow || true # if running locally, unshallow could fail git pull --tags git submodule init -git describe +git describe --match "v[0-9]*" # make sure we have libdivecomputer echo "Get libdivecomputer" diff --git a/scripts/linux/before_install.sh b/scripts/linux/before_install.sh index f38ea4649..2b7c1217f 100644 --- a/scripts/linux/before_install.sh +++ b/scripts/linux/before_install.sh @@ -12,7 +12,7 @@ set -x # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" export QT_ROOT=$PWD/Qt/5.9.3 rm -rf Qt diff --git a/scripts/linux2/before_install.sh b/scripts/linux2/before_install.sh index 2e82e1156..d64c331be 100644 --- a/scripts/linux2/before_install.sh +++ b/scripts/linux2/before_install.sh @@ -16,7 +16,7 @@ export CXX=g++-5 # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" . /opt/qt510/bin/qt510-env.sh export QT_ROOT=/opt/qt510 diff --git a/scripts/mac/before_install.sh b/scripts/mac/before_install.sh index 4bfd039ff..aa2ed5658 100644 --- a/scripts/mac/before_install.sh +++ b/scripts/mac/before_install.sh @@ -13,7 +13,7 @@ unset -f popd # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" # prep things so we can build for Mac # we have a custom built Qt some gives us just what we need, including QtWebKit diff --git a/scripts/qt55/before_install.sh b/scripts/qt55/before_install.sh index 5859da915..e066427d2 100644 --- a/scripts/qt55/before_install.sh +++ b/scripts/qt55/before_install.sh @@ -4,7 +4,7 @@ # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" # 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 diff --git a/scripts/qt56/before_install.sh b/scripts/qt56/before_install.sh index 88714a410..b1329eaba 100644 --- a/scripts/qt56/before_install.sh +++ b/scripts/qt56/before_install.sh @@ -4,7 +4,7 @@ # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" # 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 diff --git a/scripts/qt57/before_install.sh b/scripts/qt57/before_install.sh index c064dad6a..9f1c99342 100644 --- a/scripts/qt57/before_install.sh +++ b/scripts/qt57/before_install.sh @@ -4,7 +4,7 @@ # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" # Ugly, but keeps it running during the build docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d fedora:26 /bin/sleep 60m diff --git a/scripts/qt59/before_install.sh b/scripts/qt59/before_install.sh index 83a8ba441..82f49f289 100644 --- a/scripts/qt59/before_install.sh +++ b/scripts/qt59/before_install.sh @@ -4,7 +4,7 @@ # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" # Ugly, but keeps it running during the build docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d fedora:27 /bin/sleep 60m diff --git a/scripts/windows-container/before_install.sh b/scripts/windows-container/before_install.sh index 5635cb450..69bc6b4f3 100644 --- a/scripts/windows-container/before_install.sh +++ b/scripts/windows-container/before_install.sh @@ -10,7 +10,7 @@ TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR:-$PWD} git fetch --unshallow || true # if running locally, unshallow could fail git pull --tags git submodule init -git describe +git describe --match "v[0-9]*" # make sure we have libdivecomputer echo "Get libdivecomputer" diff --git a/scripts/windows/before_install.sh b/scripts/windows/before_install.sh index e0acf6bf5..9f6140659 100644 --- a/scripts/windows/before_install.sh +++ b/scripts/windows/before_install.sh @@ -6,7 +6,7 @@ set -x # Sorry Travis, fetching the whole thing and the tags as well... git fetch --unshallow git pull --tags -git describe +git describe --match "v[0-9]*" # grab our own custom MXE environment pushd ${TRAVIS_BUILD_DIR}/..