From 14dde18e8a6dd130e844191a3f89ece05a204572 Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Tue, 13 Oct 2026 22:13:30 +0200 Subject: [PATCH] Remove OFF-switched machinery and everything not built by this branch - new_docker_build.sh (665 -> 528 lines): drop the OFF-fixed build variables and their redundant cmake flags (BUILD_RTI/GRANTLEE/ VIEWER_ONLY/CODIFICATION default OFF, BUILD_ALL/SV/WS/AAR default ON - all matching this branch's configuration); the container cmake now passes only the flags that override CMake defaults (-DBUILD_ARCGIS=OFF, -DRELEASE_BUILD=ON, -DBUILD_TESTING=ON). - Drop the non-prebuilt base-image path (in-container apt-get install + aqtinstall fallback, --use-prebuilt-image/--no-prebuilt-image) and --cmake_build_flags: the branch only ever builds inside the prebuilt image. - Drop ensure_database(): the PostgreSQL server only served the DB tools (Lts/Tools), which are not built in this branch; the build links against the header-only dev packages baked into the image. - Drop libvlc-dev/vlc-plugin-base from the image packages: VLC existed only for thp_viewer (Lts/Application, out of scope). - --build-prebuilt-image now builds the image from ./Dockerfile and exits, matching the documented two-step flow. --- .../qt6-migrated-legatus/new_docker_build.sh | 185 +++--------------- 1 file changed, 24 insertions(+), 161 deletions(-) diff --git a/qt6-after/qt6-migrated-legatus/new_docker_build.sh b/qt6-after/qt6-migrated-legatus/new_docker_build.sh index 61cf0a1c8..89a52c11e 100755 --- a/qt6-after/qt6-migrated-legatus/new_docker_build.sh +++ b/qt6-after/qt6-migrated-legatus/new_docker_build.sh @@ -5,16 +5,14 @@ set -euo pipefail # Build helper for the release validation-scope branch of qt-migrated-legatus # # Builds only the release scope (TetraIF, Z/src, Lts/Common + -# Lts/Proxies/TrainingAreaBase) inside Docker and optionally runs the Jenkins -# builder to produce the release DEB packages. +# Lts/Proxies/TrainingAreaBase) inside the prebuilt Docker image and +# optionally runs the Jenkins builder to produce the release DEB packages. # # - Loads environment from .envrc # - Validates MIGRATE_PIPELINE_ROOT and rti_license.dat -# - Optional usage of a prebuilt Docker image with installed dependencies -# - Optional creation of that prebuilt Docker image via --build-prebuilt-image -# (Dockerfile lives next to this script; the package list and Qt settings -# are passed as build args) -# - Optional deletion of that prebuilt Docker image via --delete-prebuilt-image +# - Uses a prebuilt Docker image with all build dependencies installed +# (build it from ./Dockerfile via --build-prebuilt-image) +# - Optional deletion of the prebuilt Docker image via --delete-prebuilt-image # - Optional Jenkins builder run for RPM/DEB package production # - Uses a temporary container-side script for robust execution # ----------------------------------------------------------------------------- @@ -23,22 +21,17 @@ usage() { cat <<'EOF' Usage: ./new_docker_build.sh [options] -Builds the release validation scope inside Docker: +Builds the release validation scope inside the prebuilt Docker image: RELEASE_BUILD=ON (fixed) - TetraIF, Z, Lts/Common (+ TrainingAreaBase) - BUILD_RTI=OFF (fixed) - uses the ProjectDataManagement stubs + ctest runs for the release scope test executables (Lts/Common + Z) Options: - --use-prebuilt-image Use a Docker image with dependencies already installed - --no-prebuilt-image Use base image and run apt-get install inside the container --docker-image IMAGE Docker image name to use/build/delete (default: legatus-qt6-prebuilt:latest) --build-prebuilt-image Build the prebuilt Docker image (from ./Dockerfile) - before running the build. If used alone, the script - builds the image and exits - If combined with --use-prebuilt-image, the built image is used immediately + and exit. To run the build with it, run the script + again with --docker-image --delete-prebuilt-image Delete the configured Docker image and exit - --cmake_build_flags FLAGS Extra CMake flags passed to the in-container configure - (space-separated -D flags, e.g. "-DBUILD_WLS=ON") Jenkins builder options (for RPM/DEB package production): --run-jenkins-builder Run jenkins_builder_ubuntu26.sh inside container to produce packages @@ -49,11 +42,9 @@ Jenkins builder options (for RPM/DEB package production): --build-tag TAG Build tag for package (default: manual-build) Environment variable overrides: - USE_PREBUILT_IMAGE=ON|OFF BUILD_PREBUILT_IMAGE=ON|OFF DELETE_PREBUILT_IMAGE=ON|OFF DOCKER_IMAGE= - CMAKE_BUILD_FLAGS= RUN_JENKINS_BUILDER=ON|OFF PACKAGE_OUTPUT_DIR= LTS_VERSION= @@ -70,10 +61,9 @@ Expected file: Examples: ./new_docker_build.sh --build-prebuilt-image --docker-image legatus-qt6:1.0 - ./new_docker_build.sh --use-prebuilt-image --docker-image legatus-qt6:1.0 - ./new_docker_build.sh --build-prebuilt-image --use-prebuilt-image --docker-image legatus-qt6:1.0 + ./new_docker_build.sh --docker-image legatus-qt6:1.0 ./new_docker_build.sh --delete-prebuilt-image --docker-image legatus-qt6:1.0 - ./new_docker_build.sh --use-prebuilt-image --docker-image legatus-qt6:1.0 \ + ./new_docker_build.sh --docker-image legatus-qt6:1.0 \ --run-jenkins-builder --package-output-dir /path/to/rpms/guez/26.04 EOF } @@ -190,8 +180,6 @@ APT_PACKAGES=( libgtest-dev libpq-dev postgresql-server-dev-all - libvlc-dev - vlc-plugin-base git python3-pip # Packaging tools for RPM/DEB build @@ -274,17 +262,7 @@ set +a # Fixed configuration for the release validation-scope branch RELEASE_BUILD=ON -BUILD_RTI=OFF -BUILD_GRANTLEE=ON -BUILD_ARCGIS=OFF -BUILD_VIEWER_ONLY=OFF -BUILD_CODIFICATION=OFF -BUILD_ALL=ON -BUILD_SV=ON -BUILD_WS=ON -BUILD_AAR=ON RUN_CTEST=ON -USE_PREBUILT_IMAGE="${USE_PREBUILT_IMAGE:-OFF}" BUILD_PREBUILT_IMAGE="${BUILD_PREBUILT_IMAGE:-OFF}" DELETE_PREBUILT_IMAGE="${DELETE_PREBUILT_IMAGE:-OFF}" # Jenkins builder options for RPM/DEB package production @@ -303,12 +281,6 @@ export QT_BASE_DIR="${QT_BASE_DIR:-/opt/Qt}" while [[ $# -gt 0 ]]; do case "$1" in - --use-prebuilt-image) - USE_PREBUILT_IMAGE=ON - ;; - --no-prebuilt-image) - USE_PREBUILT_IMAGE=OFF - ;; --build-prebuilt-image) BUILD_PREBUILT_IMAGE=ON ;; @@ -320,11 +292,6 @@ while [[ $# -gt 0 ]]; do [[ $# -gt 0 ]] || die "--docker-image requires an image name" DOCKER_IMAGE="$1" ;; - --cmake_build_flags) - shift - [[ $# -gt 0 ]] || die "--cmake_build_flags requires a flag string" - CMAKE_BUILD_FLAGS="$1" - ;; --run-jenkins-builder) RUN_JENKINS_BUILDER=ON ;; @@ -365,7 +332,6 @@ while [[ $# -gt 0 ]]; do shift done -USE_PREBUILT_IMAGE="$(normalize_on_off "$USE_PREBUILT_IMAGE" "USE_PREBUILT_IMAGE")" BUILD_PREBUILT_IMAGE="$(normalize_on_off "$BUILD_PREBUILT_IMAGE" "BUILD_PREBUILT_IMAGE")" DELETE_PREBUILT_IMAGE="$(normalize_on_off "$DELETE_PREBUILT_IMAGE" "DELETE_PREBUILT_IMAGE")" RUN_JENKINS_BUILDER="$(normalize_on_off "$RUN_JENKINS_BUILDER" "RUN_JENKINS_BUILDER")" @@ -373,11 +339,8 @@ RUN_JENKINS_BUILDER="$(normalize_on_off "$RUN_JENKINS_BUILDER" "RUN_JENKINS_BUIL # Default for the Docker image name DOCKER_IMAGE="${DOCKER_IMAGE:-legatus-qt6-prebuilt:latest}" -# Default for extra CMake flags (set via --cmake_build_flags or environment) -CMAKE_BUILD_FLAGS="${CMAKE_BUILD_FLAGS:-}" - # Export variables for Docker container -export RELEASE_BUILD BUILD_RTI BUILD_GRANTLEE BUILD_CODIFICATION BUILD_ALL BUILD_SV BUILD_WS BUILD_AAR RUN_CTEST USE_PREBUILT_IMAGE BUILD_PREBUILT_IMAGE DELETE_PREBUILT_IMAGE DOCKER_IMAGE CMAKE_BUILD_FLAGS RUN_JENKINS_BUILDER PACKAGE_OUTPUT_DIR LTS_VERSION PROJECT GUEZ_MODE BUILD_NUMBER BUILD_TAG +export RELEASE_BUILD RUN_CTEST BUILD_PREBUILT_IMAGE DELETE_PREBUILT_IMAGE DOCKER_IMAGE RUN_JENKINS_BUILDER PACKAGE_OUTPUT_DIR LTS_VERSION PROJECT GUEZ_MODE BUILD_NUMBER BUILD_TAG require_non_empty "${DOCKER_IMAGE}" "DOCKER_IMAGE" @@ -397,9 +360,7 @@ require_file "${RTI_LICENSE_FILE_HOST}" "RTI license file" require_directory "${PROJECT_DIR_HOST}" "Project directory" log_info "RELEASE_BUILD=${RELEASE_BUILD}" -log_info "BUILD_RTI=${BUILD_RTI}" log_info "RUN_CTEST=${RUN_CTEST}" -log_info "USE_PREBUILT_IMAGE=${USE_PREBUILT_IMAGE}" log_info "BUILD_PREBUILT_IMAGE=${BUILD_PREBUILT_IMAGE}" log_info "DELETE_PREBUILT_IMAGE=${DELETE_PREBUILT_IMAGE}" log_info "DOCKER_IMAGE=${DOCKER_IMAGE}" @@ -417,15 +378,10 @@ log_info "PROJECT_DIR_HOST=${PROJECT_DIR_HOST}" if [[ "${BUILD_PREBUILT_IMAGE}" == "ON" ]]; then build_prebuilt_image "${DOCKER_IMAGE}" - if [[ "${USE_PREBUILT_IMAGE}" != "ON" ]]; then - log_info "Prebuilt image was built successfully." - log_info "Exiting because --use-prebuilt-image was not requested." - log_info "To use it, run:" - printf ' ./new_docker_build.sh --use-prebuilt-image --docker-image %q\n' "${DOCKER_IMAGE}" - exit 0 - fi - - log_info "Continuing with freshly built prebuilt image: ${DOCKER_IMAGE}" + log_info "Prebuilt image was built successfully." + log_info "To run the build with it, run:" + printf ' ./new_docker_build.sh --docker-image %q\n' "${DOCKER_IMAGE}" + exit 0 fi RELEASE_BUILD_TARGETS_STRING="$(join_by ' ' "${RELEASE_BUILD_TARGETS[@]}")" @@ -443,18 +399,7 @@ set -euo pipefail # Fixed configuration for the release validation-scope branch RELEASE_BUILD="${RELEASE_BUILD:-ON}" -BUILD_RTI="${BUILD_RTI:-OFF}" -BUILD_GRANTLEE="${BUILD_GRANTLEE:-ON}" -BUILD_ARCGIS="${BUILD_ARCGIS:-OFF}" -BUILD_VIEWER_ONLY="${BUILD_VIEWER_ONLY:-OFF}" -BUILD_CODIFICATION="${BUILD_CODIFICATION:-OFF}" -BUILD_ALL="${BUILD_ALL:-ON}" -BUILD_SV="${BUILD_SV:-ON}" -BUILD_WS="${BUILD_WS:-ON}" -BUILD_AAR="${BUILD_AAR:-ON}" RUN_CTEST="${RUN_CTEST:-ON}" -USE_PREBUILT_IMAGE="${USE_PREBUILT_IMAGE:-OFF}" -APT_PACKAGES_STRING="${APT_PACKAGES_STRING:-}" # Jenkins builder and packaging variables RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER:-OFF}" MIGRATE_PIPELINE_ROOT="/workspace" @@ -464,7 +409,6 @@ PROJECT="${PROJECT:-guez}" GUEZ_MODE="${GUEZ_MODE:-ON}" BUILD_NUMBER="${BUILD_NUMBER:-1}" BUILD_TAG="${BUILD_TAG:-manual-build}" -CMAKE_BUILD_FLAGS="${CMAKE_BUILD_FLAGS:-}" RELEASE_BUILD_TARGETS="${RELEASE_BUILD_TARGETS:-}" QT_VERSION="${QT_VERSION:-6.10.2}" QT_ARCH="${QT_ARCH:-linux_gcc_64}" @@ -479,75 +423,7 @@ log_error() { printf 'ERROR: %s\n' "$*" >&2 } -install_qt6_packages() { - log_info "Installing Qt6 packages via aqtinstall" - - # Install aqtinstall if not available - if ! command -v aqt &> /dev/null; then - log_info "Installing aqtinstall via pip3" - pip3 install --break-system-packages --quiet aqtinstall - fi - - # Install Qt6 modules (same as the prebuilt-image Dockerfile) - # Note: qtsvg is NOT available via aqtinstall - it's provided by libqt6svg6-dev apt package - aqt install-qt linux desktop "${QT_VERSION}" "${QT_ARCH}" \ - -m qtmultimedia qtserialport qtimageformats qtwebsockets qtwebengine \ - qtpdf qtwebview qt5compat qtwebchannel qtpositioning qtlocation qtsensors \ - --outputdir "${QT_BASE_DIR}" - - log_info "Qt6 packages installed successfully" -} - -# Ensure a local PostgreSQL DB is available. -# Entirely non-fatal: a DB problem must never abort the build. -ensure_database() { - log_info "Checking for a pre-installed PostgreSQL server..." - if ls /usr/lib/postgresql/*/bin/postgres >/dev/null 2>&1; then - log_info "PostgreSQL server already installed - skipping apt install" - else - log_info "PostgreSQL server not found - installing postgresql-18" - apt-get update -qq || true - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq postgresql-18 >/dev/null 2>&1 || true - fi - - # Map the app's DB hostnames to the local server + start the cluster (idempotent). - grep -qE 'EXCDBS01' /etc/hosts || echo '127.0.0.1 EXCDBS01 EXCADB01' >> /etc/hosts - pg_ctlcluster 18 main start >/dev/null 2>&1 || true - sleep 1 - - # Ensure the roles + databases the DB tools use (idempotent; login password is 'postgres'). - su postgres -c "psql -c \"ALTER USER postgres PASSWORD 'postgres'\"" >/dev/null 2>&1 || true - if ! su postgres -c "psql -tAc \"SELECT 1 FROM pg_roles WHERE rolname='ctc_sv'\"" 2>/dev/null | grep -q 1; then - su postgres -c "psql -c \"CREATE ROLE ctc_sv LOGIN PASSWORD 'postgres' CREATEDB\"" >/dev/null 2>&1 || true - fi - if ! su postgres -c "psql -tAc \"SELECT 1 FROM pg_database WHERE datname='lts_ets_pro'\"" 2>/dev/null | grep -q 1; then - su postgres -c "createdb -O postgres lts_ets_pro" >/dev/null 2>&1 || true - fi - if ! su postgres -c "psql -tAc \"SELECT 1 FROM pg_database WHERE datname='dbAdmin'\"" 2>/dev/null | grep -q 1; then - su postgres -c "createdb -O postgres dbAdmin" >/dev/null 2>&1 || true - fi - - if pg_isready -h 127.0.0.1 -p 5432 >/dev/null 2>&1; then - log_info "PostgreSQL ready on 127.0.0.1:5432 (roles postgres/ctc_sv, dbs lts_ets_pro/dbAdmin)" - else - log_info "PostgreSQL not ready on 127.0.0.1:5432 (install may have failed)" - fi -} - -if [[ "${USE_PREBUILT_IMAGE}" == "ON" ]]; then - log_info "Using prebuilt Docker image - skipping apt-get install and Qt6 package installation" -else - log_info "Using base image - installing apt packages" - apt-get update -qq - # shellcheck disable=SC2086 - apt-get install -y -qq ${APT_PACKAGES_STRING} > /dev/null 2>&1 - - # Install Qt6 packages via aqtinstall for non-prebuilt-image builds - install_qt6_packages -fi - -# Ensure the local PostgreSQL DB is available before the build. -ensure_database +log_info "Using prebuilt Docker image: all build dependencies are baked in" export RTI_LICENSE_FILE=/workspace/rti_license.dat export QT_QPA_PLATFORM=offscreen @@ -558,19 +434,16 @@ rm -rf build4 mkdir -p build4 cd build4 +# CMake option defaults that this branch must override: +# BUILD_ARCGIS defaults to ON -> force OFF (ArcGIS SDK is not in the scope) +# RELEASE_BUILD defaults to OFF -> force ON (release scope modules only) +# All other BUILD_* flags are left at their CMake defaults, which match +# the release scope configuration (BUILD_RTI/CODIFICATION/VIEWER_ONLY=OFF, +# BUILD_GRANTLEE/ALL/SV/WS/AAR=ON). cmake .. \ -DBUILD_TESTING=ON \ - -DBUILD_ALL="${BUILD_ALL}" \ - -DBUILD_SV="${BUILD_SV}" \ - -DBUILD_WS="${BUILD_WS}" \ - -DBUILD_AAR="${BUILD_AAR}" \ - -DBUILD_RTI="${BUILD_RTI}" \ - -DBUILD_VIEWER_ONLY="${BUILD_VIEWER_ONLY}" \ - -DBUILD_GRANTLEE="${BUILD_GRANTLEE}" \ - -DBUILD_ARCGIS="${BUILD_ARCGIS}" \ - -DBUILD_CODIFICATION="${BUILD_CODIFICATION}" \ + -DBUILD_ARCGIS=OFF \ -DRELEASE_BUILD="${RELEASE_BUILD}" \ - ${CMAKE_BUILD_FLAGS:-} \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH="${QT_BASE_DIR}/${QT_VERSION}/${QT_ARCH_DIR}:/usr/local" @@ -633,15 +506,7 @@ docker run --rm \ -e LANG \ -e LC_ALL \ -e RELEASE_BUILD \ - -e BUILD_RTI \ - -e BUILD_GRANTLEE \ - -e BUILD_CODIFICATION \ - -e BUILD_ALL \ - -e BUILD_SV \ - -e BUILD_WS \ - -e BUILD_AAR \ -e RUN_CTEST \ - -e USE_PREBUILT_IMAGE \ -e RUN_JENKINS_BUILDER \ -e PACKAGE_OUTPUT_DIR \ -e LTS_VERSION \ @@ -649,12 +514,10 @@ docker run --rm \ -e GUEZ_MODE \ -e BUILD_NUMBER \ -e BUILD_TAG \ - -e CMAKE_BUILD_FLAGS \ -e QT_VERSION \ -e QT_ARCH \ -e QT_ARCH_DIR \ -e QT_BASE_DIR \ - -e APT_PACKAGES_STRING="${APT_PACKAGES_STRING}" \ -e RELEASE_BUILD_TARGETS="${RELEASE_BUILD_TARGETS_STRING}" \ -v "${WORKSPACE_ROOT_HOST}:/workspace" \ -v "${RTI_LICENSE_FILE_HOST}:/workspace/rti_license.dat" \