tools_common.sh: Correct the source_version() func
version.cmake strips optional prefix before the version. So,
source_version() function needs to do the same, so that the strings can
be matched.
Before this, for any commit after research-v1.0.0 anchor, it used to
give incorrect warnings like the one below:
"Warning: version has changed since last cmake run.
cmake version: v1.0.0-114-g4dcb6b040 version now:
research-v1.0.0-114-g4dcb6b040"
Change-Id: I0a61c476d59e8f349ca798dd1781bbb27846ca80
diff --git a/test/tools_common.sh b/test/tools_common.sh
index d40709b..9646e50 100755
--- a/test/tools_common.sh
+++ b/test/tools_common.sh
@@ -88,10 +88,13 @@
# Echoes current git version as reported by running 'git describe', or the
# version used by the cmake build when git is unavailable.
+# Note: version.cmake strips optional prefix before the version. So,
+# source_version() function needs to do the same, so that the strings can be
+# compared in check_version_strings() later.
source_version() {
if git --version > /dev/null 2>&1; then
(cd "$(dirname "${0}")"
- git describe)
+ git describe | sed 's/.*-v/v/')
else
cmake_version
fi