clickhouse: preserve VERSION_REVISION from the source tree

The preConfigure that regenerates cmake/autogenerated_versions.txt
hardcoded SET(VERSION_REVISION 0), so nixpkgs-built servers report 0
from the revision(), which e.g. clickhouse-go reads.

(cherry picked from commit c00f8bc01c)
This commit is contained in:
Bouke van der Bijl
2026-07-21 19:24:05 +02:00
committed by github-actions[bot]
parent 82dd05d9aa
commit fe05ef35c2

View File

@@ -165,8 +165,17 @@ llvmStdenv.mkDerivation (finalAttrs: {
gitHash = rev;
in
''
cat <<'EOF' > cmake/autogenerated_versions.txt
SET(VERSION_REVISION 0)
# Preserve VERSION_REVISION from the source tree, like ClickHouse CI
# does. It identifies the server release line to clients (exposed via
# the revision() SQL function)
versionRevision=$(sed -n 's/^SET(VERSION_REVISION \([0-9]\{1,\}\))$/\1/p' cmake/autogenerated_versions.txt)
if [[ -z "$versionRevision" ]]; then
echo "Could not extract VERSION_REVISION from cmake/autogenerated_versions.txt" >&2
exit 1
fi
cat <<EOF > cmake/autogenerated_versions.txt
SET(VERSION_REVISION $versionRevision)
SET(VERSION_MAJOR ${major})
SET(VERSION_MINOR ${minor})
SET(VERSION_PATCH ${patch})