Skip to content

Commit 1adff48

Browse files
authored
Prioritize release tag when generating versions. Fixes KhronosGroup#467 (KhronosGroup#475)
* Prioritize release over rc over beta tags for versions. Eliminate confusion caused by generating versions relative to rc or beta tags when there is is a newer release tag but no changes between, e.g., beta and release. * Have mkversion cd to its location (repo root) before running. Not running in the root during the Linux build is the only reason for the Linux version numbers reported in KhronosGroup#467 but whatever caused mkversion to not be run in root appears to have been fixed. It is not possible to reproduce in current master prior to this PR. * Try apt-get update in before_install to see if it fixes Linux build issue. Unrelated fix to Linux CI builds.
1 parent 68674a6 commit 1adff48

File tree

5 files changed

+49
-6
lines changed

5 files changed

+49
-6
lines changed

.appveyor.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ build_script:
130130
pushd $env:KTX_BUILD_DIR
131131
cmake --build . --config $env:CONFIGURATION
132132
cmake --build . --config $env:CONFIGURATION --target PACKAGE
133+
134+
#echo "***** toktx version.h *****"
135+
#pwd
136+
#cat ../tools/toktx/version.h
137+
#echo "****** toktx version ******"
138+
## Because toktx prints version to stderr.
139+
#$ErrorActionPreference = 'SilentlyContinue'
140+
#& $env:CONFIGURATION/toktx --version
141+
#$ErrorActionPreference = 'Stop'
142+
#echo "***************************"
143+
133144
popd
134145
$env:KTX_BUILD_DIR_NOSSE = "$env:BUILD_DIR\nosse"
135146
echo "Build without SSE support via $env:CMAKE_GEN Arch:$env:PLATFORM dir:$env:KTX_BUILD_DIR_NOSSE"

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ before_install:
6161
- |
6262
case "${TRAVIS_OS_NAME:-linux}" in
6363
linux)
64+
sudo apt-get update
6465
docker run -dit --name emscripten -v $(pwd):/src emscripten/emsdk bash
6566
;;
6667
esac

ci_scripts/build_linux.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ cpack -G RPM
4242
cpack -G TBZ2
4343
popd
4444

45+
#echo "***** toktx version.h *****"
46+
#cat tools/toktx/version.h
47+
#echo "****** toktx version ******"
48+
#build/linux-release/tools/toktx/toktx --version
49+
#echo "***************************"
50+
51+
4552
echo "Configure KTX-Software (Linux Debug without SSE support)"
4653
${CMAKE_EXE} . -G Ninja -B$nosse_debug_build_dir -DCMAKE_BUILD_TYPE=Debug -DBASISU_SUPPORT_SSE=OFF
4754
pushd $nosse_debug_build_dir

ci_scripts/build_macos.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ if ! cpack -G productbuild; then
9595
exit 1
9696
fi
9797

98+
#echo "***** toktx version.h *****"
99+
#pwd
100+
#cat ../tools/toktx/version.h
101+
#echo "****** toktx version ******"
102+
#Release/toktx --version
103+
#echo "***************************"
104+
98105
popd
99106

100107
pushd build-macos-sse

mkversion

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,29 @@ DEF_VER=v4.0
1414
LF='
1515
'
1616

17+
# Change directory to this script location which must be root of the
18+
# Git repo.
19+
cd $(dirname $0)
20+
1721
function genversion() {
1822
# Try git-describe, then default.
1923
if [ -d ${GIT_DIR:-.git} -o -f .git ]; then
2024
if [ -z "$1" ]; then
2125
# Get version number for HEAD revision of repo.
2226
VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null)
2327
else
24-
# Get version number containing the object identified in
25-
# $1.
28+
# Get release tag containing the object identified in # $1.
29+
VN=$(git describe --contains --match "v[0-9]*" --exclude "*-beta*" --exclude "*-rc[0-9]*" $(git rev-list -1 HEAD $1) 2>/dev/null)
30+
if [ -z "$VN" ]; then
31+
# No containing release tag. Look for an RC tag.
32+
VN=$(git describe --contains --match "v[0-9]*" --exclude "*-beta*" $(git rev-list -1 HEAD $1) 2>/dev/null)
33+
fi
34+
if [ -z "$VN" ]; then
35+
# No containing RC tag. Look for a beta tag.
2636
VN=$(git describe --contains --match "v[0-9]*" $(git rev-list -1 HEAD $1) 2>/dev/null)
37+
fi
2738
if [ -z "$VN" ]; then
28-
# If no containing tag, get version number for $1 based on
29-
# previous tag.
39+
# No containing tag. Get version number a previous tag.
3040
VN=$(git describe --match "v[0-9]*" $(git rev-list -1 HEAD $1) 2>/dev/null)
3141
fi
3242
fi
@@ -47,6 +57,10 @@ function genversion() {
4757
function setfile() {
4858
local VC
4959
local verstring=$1_VERSION
60+
if [ $dry_run -eq 1 ]; then
61+
echo $verstring $VN
62+
return
63+
fi
5064
if [ -r $2 ]; then
5165
VC=$(grep $verstring $2 | sed -e "s/^#define $verstring //")
5266
else
@@ -89,13 +103,14 @@ function writeversion() {
89103
}
90104

91105
function usage() {
92-
echo "Usage: $0 [-a] [-f] [<object>]"
106+
echo "Usage: $0 [-a] [-f] [-n] [-o <outfile>] [<object>]"
93107
exit 1
94108
}
95109

96110
force=0
111+
dry_run=0
97112
write_all=0;
98-
args=$(getopt afo: $*)
113+
args=$(getopt afno: $*)
99114

100115
set -- $args
101116
for i; do
@@ -104,6 +119,8 @@ for i; do
104119
shift;;
105120
-f) force=1;
106121
shift;;
122+
-n) dry_run=1;
123+
shift;;
107124
-o) VF=$2; shift; shift;;
108125
--) shift; break;;
109126
esac

0 commit comments

Comments
 (0)