From 4f5cf8ecd993df764253a2abbed608571c348864 Mon Sep 17 00:00:00 2001 From: Keith Smith Date: Tue, 15 Sep 2026 06:26:15 -0600 Subject: [PATCH] packaging: read project version after building, not before build-deb.sh and build-dmg.sh both read VERSION from CMakeCache.txt before calling cmake --build -- but that build step is exactly what reconfigures CMakeCache.txt if CMakeLists.txt changed since the build dir was last configured. If the version was bumped and the script is run without an explicit reconfigure first, it silently packages the stale version (observed: v2026.9.15's macOS build produced OrbitHub-2026.9.14.2.dmg). Move the VERSION read to after the build. Co-Authored-By: Claude Sonnet 5 --- packaging/linux/build-deb.sh | 6 +++++- packaging/macos/build-dmg.sh | 16 ++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packaging/linux/build-deb.sh b/packaging/linux/build-deb.sh index 58d598a..a582483 100755 --- a/packaging/linux/build-deb.sh +++ b/packaging/linux/build-deb.sh @@ -17,6 +17,11 @@ mkdir -p "$DIST_DIR" rm -rf "$STAGE_DIR" mkdir -p "$PKG_ROOT/DEBIAN" +# Read VERSION only after the build (which reconfigures CMakeCache.txt if +# CMakeLists.txt changed since the build dir was last configured) -- +# reading it beforehand risks packaging a stale version string. +cmake --build "$BUILD_DIR" -j + VERSION="$(sed -n 's/^CMAKE_PROJECT_VERSION:STATIC=//p' "$BUILD_DIR/CMakeCache.txt" | head -n1)" ARCH="$(dpkg --print-architecture)" @@ -25,7 +30,6 @@ if [[ -z "$VERSION" ]]; then exit 1 fi -cmake --build "$BUILD_DIR" -j cmake --install "$BUILD_DIR" --prefix "$PKG_ROOT/usr" cat > "$PKG_ROOT/DEBIAN/control" <&2 - exit 1 -fi - MACDEPLOYQT="$(brew --prefix qt@6)/bin/macdeployqt" if [[ ! -x "$MACDEPLOYQT" ]]; then echo "macdeployqt not found at $MACDEPLOYQT" >&2 @@ -31,7 +25,17 @@ mkdir -p "$DIST_DIR" rm -rf "$STAGE_DIR" "$INSTALL_PREFIX" mkdir -p "$STAGE_DIR" +# Read VERSION only after the build (which reconfigures CMakeCache.txt if +# CMakeLists.txt changed since the build dir was last configured) -- +# reading it beforehand risks packaging a stale version string. cmake --build "$BUILD_DIR" -j + +VERSION="$(sed -n 's/^CMAKE_PROJECT_VERSION:STATIC=//p' "$BUILD_DIR/CMakeCache.txt" | head -n1)" +if [[ -z "$VERSION" ]]; then + echo "Unable to determine project version from $BUILD_DIR/CMakeCache.txt" >&2 + exit 1 +fi + cmake --install "$BUILD_DIR" --prefix "$INSTALL_PREFIX" if [[ ! -d "$INSTALL_PREFIX/$APP_BUNDLE" ]]; then