From 217bb54bc03e1d9d9fad960fc7133951d3abb528 Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Tue, 13 Oct 2026 23:08:37 +0200 Subject: [PATCH] Build the DEB packages with the in-tree rpmbuild script The container script now runs the packaging flow itself instead of calling the outer-repo jenkins_builder_ubuntu26.sh: - Stage the workspace to deb_stage (same tar/excludes as the verified jenkins flow; the workspace itself is never deleted) - Run the in-tree rpmbuild/make_rpm_ubuntu26.py from the staged source tree with the same cmake flags and arguments as before - Copy the produced DEBs to the package output mount - A packaging failure now fails the build instead of being logged and swallowed - Drop the now-unneeded MIGRATE_PIPELINE_ROOT/WORKSPACE/PROJECT_BASE_DIR container env plumbing The branch is now fully self-contained: new_docker_build.sh + Dockerfile + rpmbuild/. The build-pipeline DEB additionally ships rpmbuild/make_rpm_ubuntu26.py (the staging list already named it). Verified: zero-warning build, 5 DEBs with identical contents. --- .../qt6-migrated-legatus/new_docker_build.sh | 76 +++++++++++++------ 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/qt6-after/qt6-migrated-legatus/new_docker_build.sh b/qt6-after/qt6-migrated-legatus/new_docker_build.sh index 89a52c11e..025a221ef 100755 --- a/qt6-after/qt6-migrated-legatus/new_docker_build.sh +++ b/qt6-after/qt6-migrated-legatus/new_docker_build.sh @@ -13,7 +13,8 @@ set -euo pipefail # - 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 +# - Optional DEB package production via the in-tree rpmbuild/ +# make_rpm_ubuntu26.py (self-contained - no outer-repo dependencies) # - Uses a temporary container-side script for robust execution # ----------------------------------------------------------------------------- @@ -33,8 +34,9 @@ Options: again with --docker-image --delete-prebuilt-image Delete the configured Docker image and exit -Jenkins builder options (for RPM/DEB package production): - --run-jenkins-builder Run jenkins_builder_ubuntu26.sh inside container to produce packages +Package production options (RPM/DEB): + --run-jenkins-builder Build the release DEB packages inside the container + using the in-tree rpmbuild/make_rpm_ubuntu26.py --package-output-dir DIR Directory to mount for package output (default: ./packages-out) --lts-version VERSION LTS version for package (default: 1.0) --project NAME Project name for package (default: guez) @@ -400,9 +402,8 @@ set -euo pipefail # Fixed configuration for the release validation-scope branch RELEASE_BUILD="${RELEASE_BUILD:-ON}" RUN_CTEST="${RUN_CTEST:-ON}" -# Jenkins builder and packaging variables +# Packaging variables RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER:-OFF}" -MIGRATE_PIPELINE_ROOT="/workspace" PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR:-/workspace/packages-out}" LTS_VERSION="${LTS_VERSION:-1.0}" PROJECT="${PROJECT:-guez}" @@ -463,39 +464,64 @@ else log_info "Skipping CTest" fi -# Jenkins builder execution (produces the release DEB packages) +# DEB package production with the in-tree rpmbuild script if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then - log_info "=== Jenkins Builder Execution (RPM/DEB Package Production) ===" + log_info "=== DEB Package Production (in-tree rpmbuild) ===" - # Set up environment variables for jenkins_builder_ubuntu26.sh - export OS_VERSION=$(cat /etc/os-release | grep "^VERSION_ID=" | cut -d'"' -f2) - export WORKSPACE=/workspace - export PROJECT_BASE_DIR=/workspace + OS_VERSION=$(cat /etc/os-release | grep "^VERSION_ID=" | cut -d'"' -f2) + STAGE_DIR=/workspace/deb_stage + STAGED_SOURCE_DIR="${STAGE_DIR}/qt-migration-legatus/qt6-after/qt6-migrated-legatus" - log_info "Running jenkins_builder_ubuntu26.sh with:" + # Stage the workspace as a clean copy. The workspace itself is NEVER + # deleted (it contains git-managed sources); only the staging + # subdirectory is removed. + log_info "Staging workspace to ${STAGE_DIR}" + rm -rf "${STAGE_DIR}" + mkdir -p "${STAGE_DIR}" + tar --exclude='./rpms' --exclude='./.git' --exclude='./build' \ + --exclude='./deb_build_tmp' --exclude='./deb_stage' --exclude='./packages-out' \ + -cf - -C /workspace . | tar -xf - -C "${STAGE_DIR}" + + if [[ ! -f "${STAGED_SOURCE_DIR}/CMakeLists.txt" || ! -f "${STAGED_SOURCE_DIR}/rpmbuild/make_rpm_ubuntu26.py" ]]; then + log_error "Staged source incomplete under ${STAGED_SOURCE_DIR} (CMakeLists.txt or rpmbuild/make_rpm_ubuntu26.py missing)" + exit 1 + fi + + log_info "Running ${STAGED_SOURCE_DIR}/rpmbuild/make_rpm_ubuntu26.py with:" log_info " PROJECT=${PROJECT}" log_info " OS_VERSION=${OS_VERSION}" log_info " LTS_VERSION=${LTS_VERSION}" log_info " GUEZ_MODE=${GUEZ_MODE}" - log_info " WORKSPACE=${WORKSPACE}" - log_info " PROJECT_BASE_DIR=${PROJECT_BASE_DIR}" log_info " BUILD_NUMBER=${BUILD_NUMBER}" log_info " BUILD_TAG=${BUILD_TAG}" - # Execute jenkins_builder_ubuntu26.sh - if [[ -f "${MIGRATE_PIPELINE_ROOT}/jenkins-ci-rme/jenkins_builder_ubuntu26.sh" ]]; then - bash "${MIGRATE_PIPELINE_ROOT}/jenkins-ci-rme/jenkins_builder_ubuntu26.sh" || JENKINS_BUILDER_RESULT=$? - if [[ "${JENKINS_BUILDER_RESULT:-0}" -ne 0 ]]; then - log_info "Jenkins builder completed with errors (exit code: ${JENKINS_BUILDER_RESULT})" - else - log_info "Jenkins builder completed successfully" - fi + cd "${STAGED_SOURCE_DIR}/rpmbuild" + if python3 make_rpm_ubuntu26.py -c LTS \ + --project_name "${PROJECT}" \ + --version "${LTS_VERSION}" \ + --output_dir "/workspace/rpms/${PROJECT}/${OS_VERSION}/" \ + --source_dir "${STAGED_SOURCE_DIR}" \ + --cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DRELEASE_BUILD=ON" \ + --build_number "${BUILD_NUMBER}" \ + --release_scope; then + log_info "Package build completed successfully" else - log_error "jenkins_builder_ubuntu26.sh not found at ${MIGRATE_PIPELINE_ROOT}/jenkins-ci-rme/jenkins_builder_ubuntu26.sh" - JENKINS_BUILDER_RESULT=1 + log_error "Package build failed (exit code: $?)" + exit 1 fi + + # Copy produced DEB packages to the packages-out mount so they are + # available on the host after the container exits. + mkdir -p "${PACKAGE_OUTPUT_DIR}" + shopt -s nullglob + for deb in "/workspace/rpms/${PROJECT}/${OS_VERSION}/"*.deb; do + cp -f "${deb}" "${PACKAGE_OUTPUT_DIR}/" + done + shopt -u nullglob + log_info "DEB packages copied to ${PACKAGE_OUTPUT_DIR}:" + ls -lh "${PACKAGE_OUTPUT_DIR}/" else - log_info "Skipping Jenkins builder execution" + log_info "Skipping DEB package production" fi EOF