diff --git a/jenkins_builder_ubuntu26.sh b/jenkins_builder_ubuntu26.sh index 4d7a6a7..7db40aa 100644 --- a/jenkins_builder_ubuntu26.sh +++ b/jenkins_builder_ubuntu26.sh @@ -13,6 +13,8 @@ # BUILD_NUMBER Jenkins build number (used as release in DEB version) # BUILD_TAG Jenkins build tag # +# IMPORTANT: Source files under git management must NEVER be deleted. +# Only the temporary staging directory (deb_stage) is removed. set -eo pipefail @@ -26,27 +28,47 @@ set -eo pipefail echo "Building LTS ${LTS_VERSION}-${BUILD_NUMBER:-?} DEB for project '${PROJECT}' (Ubuntu ${OS_VERSION})." echo "PROJECT_BASE_DIR=${PROJECT_BASE_DIR}" -# Set up builder user environment (running as root in container) -export HOME=/home/builder -mkdir -p "${HOME}" - -# Stage workspace as a clean copy under PROJECT_BASE_DIR -rm -rf "${PROJECT_BASE_DIR}" -mkdir -p "${PROJECT_BASE_DIR}" -tar --exclude='./rpms' --exclude='./.git' --exclude='./build' --exclude='./deb_build_tmp' \ - -cf - -C "${WORKSPACE}" . | tar -xf - -C "${PROJECT_BASE_DIR}" +# Stage workspace as a clean copy under PROJECT_BASE_DIR/deb_stage. +# Only the staging subdirectory is removed — never the workspace itself, +# which contains git-managed source files that must not be deleted. +STAGE_DIR="${PROJECT_BASE_DIR}/deb_stage" +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}" export VERSION_DATE VERSION_DATE=$(date +%Y-%m-%d) +# Real CMake project root inside the staged tree +SOURCE_DIR="${STAGE_DIR}/qt-migration-legatus/qt6-after/qt6-migrated-legatus" +if [ ! -f "${SOURCE_DIR}/CMakeLists.txt" ]; then + echo "ERROR: CMakeLists.txt not found in staged source dir: ${SOURCE_DIR}" >&2 + exit 1 +fi + # Output is isolated per OS version so parallel OS builds of the same project cd "${WORKSPACE}/rpmbuild" python3 make_rpm_ubuntu26.py -c LTS \ --project_name "${PROJECT}" \ --version "${LTS_VERSION}" \ --output_dir "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/" \ - --cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/" \ + --source_dir "${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:-1}" +# Copy produced DEB packages to the dedicated packages-out mount so they +# are available on the host after the container exits. +PACKAGE_OUT_DIR="${PACKAGE_OUTPUT_DIR:-/workspace/packages-out}" +mkdir -p "${PACKAGE_OUT_DIR}" +shopt -s nullglob +for deb in "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/"*.deb; do + cp -f "${deb}" "${PACKAGE_OUT_DIR}/" +done +shopt -u nullglob + echo "DEB packages produced for '${PROJECT}' (Ubuntu ${OS_VERSION}):" -ls -lhR "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/" \ No newline at end of file +ls -lhR "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/" +echo "DEB packages copied to ${PACKAGE_OUT_DIR}:" +ls -lh "${PACKAGE_OUT_DIR}/" diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..316bcea --- /dev/null +++ b/run.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# +# Build an LTS DEB package for Ubuntu 26.04 +# Migrated from jenkins_builder.sh (openSUSE) to Ubuntu/DEB ecosystem +# +# Required environment (set by the Jenkinsfile or `docker run -e ...`): +export PROJECT=guez +export OS_VERSION=u26.04 +export LTS_VERSION=1.0 +export GUEZ_MODE=ON +export WORKSPACE=/home/torsten/sandbox/qt6-migration-pipeline/ +export PROJECT_BASE_DIR=/home/torsten/sandbox/release