Files
qt6-migration-pipeline/migration/migrate_module.sh
T
torstenandCopilot cf75745f8b Qt6 migration: Update Docker tag to ubuntu26.04 and fix submodule paths
Cosmetic changes for readability and consistency:
- Update Docker image tag from ubuntu22.04 to ubuntu26.04 in all scripts
- Align with Dockerfile base image (ubuntu:26.04)

Files updated:
- app/run_docker.sh
- migration/automate_migrate_Lts_DDS.sh
- migration/migrate_module.sh
- final-migration/run_final_migration.sh
- .github/workflows/qt6-migration.yml (submodules: recursive)
- migration/run_clang_tidy_common.sh

Documentation:
- files/qt6-submodule-migration-changes.md: Added note about qt6-after being empty

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Entire-Checkpoint: 01M08C7DVVVDNBXGPN4M02CFB5
2026-08-17 19:27:36 +02:00

54 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# migration/migrate_module.sh
# Usage: ./migration/migrate_module.sh <module-path> [--jobs N]
# Runs a reproducible configure/build/test of the specified module inside the app docker
# Note: Source directory is qt-migration-legatus/qt6-after/qt6-migrated-legatus/ (submodule)
MODULE_PATH=${1:-}
if [[ -z "$MODULE_PATH" ]]; then
echo "Usage: $0 <module-path> [--jobs N]"
exit 1
fi
JOBS=4
shift || true
while [[ $# -gt 0 ]]; do
case "$1" in
--jobs) JOBS="$2"; shift 2;;
-j*) JOBS="${1#-j}"; shift;;
*) echo "Unknown arg: $1"; exit 1;;
esac
done
# Submodule path containing the migrated Qt6 code
SUBMODULE_PATH="qt-migration-legatus/qt6-after/qt6-migrated-legatus"
# Ensure path is relative to repo root and compute absolute module path inside container
REPO_DIR="$(pwd)"
MODULE_ABS="/repo/${SUBMODULE_PATH}/$(realpath --relative-to="$REPO_DIR/${SUBMODULE_PATH}" "$MODULE_PATH" 2>/dev/null || echo "$MODULE_PATH")"
# Use app/run_docker.sh to run the migration inside the prepared Qt6 image
# The container will configure just the requested module in a clean build directory.
# Try using app/run_docker.sh; if it fails, fall back to direct docker run using the built image.
# Use a dedicated build dir per-module to avoid permission issues on /repo/build created by earlier runs.
SANITIZED_MODULE_NAME=$(echo "${MODULE_PATH}" | sed -e 's#/#_#g' -e 's/[^A-Za-z0-9_.-]/_/g')
BUILD_DIR="/repo/build_migrate_${SANITIZED_MODULE_NAME}"
if ./app/run_docker.sh "$REPO_DIR" -- bash -lc \
"set -euo pipefail && export LD_LIBRARY_PATH=/opt/Qt/6.8.3/gcc_64/lib:\${LD_LIBRARY_PATH:-} && export QT_QPA_PLATFORM=offscreen && rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR} && \
cmake -S /repo/${SUBMODULE_PATH} -B ${BUILD_DIR} -G Ninja -DCMAKE_PREFIX_PATH=/opt/Qt/6.8.3/gcc_64 -DCMAKE_CXX_STANDARD=20 -DMIGRATE_MODULE=${MODULE_PATH} -DBUILD_TESTING=ON && \
cmake --build ${BUILD_DIR} -- -j${JOBS} && ctest --test-dir ${BUILD_DIR} --output-on-failure"; then
echo "Migration run for module ${MODULE_PATH} finished via run_docker.sh. Check ${BUILD_DIR} for logs and artifacts."
else
echo "run_docker.sh failed or did not forward command args correctly; falling back to direct docker run"
# Build image (cached by Dockerfile in app/)
docker build -t migration-pipeline:ubuntu26.04 ./app >/dev/null || true
docker run --rm --user "$(id -u):$(id -g)" -v "$REPO_DIR":/repo -w /repo -e CMAKE_PREFIX_PATH=/opt/Qt/6.8.3/gcc_64 -e Qt6_ROOT=/opt/Qt/6.8.3/gcc_64 -e QT_QPA_PLATFORM=offscreen migration-pipeline:ubuntu26.04 bash -lc "set -euo pipefail && export LD_LIBRARY_PATH=/opt/Qt/6.8.3/gcc_64/lib:\${LD_LIBRARY_PATH:-} && rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR} && cmake -S /repo/${SUBMODULE_PATH} -B ${BUILD_DIR} -G Ninja -DCMAKE_PREFIX_PATH=/opt/Qt/6.8.3/gcc_64 -DCMAKE_CXX_STANDARD=20 -DMIGRATE_MODULE=${MODULE_PATH} -DBUILD_TESTING=ON && cmake --build ${BUILD_DIR} -- -j${JOBS} && ctest --test-dir ${BUILD_DIR} --output-on-failure"
echo "Migration run for module ${MODULE_PATH} finished via direct docker run. Check ${BUILD_DIR} for logs and artifacts."
fi
echo "Migration run for module ${MODULE_PATH} finished. Check ./build for logs and artifacts."