From 0f23fad65bb2b622d53ca7fb81640f234425a749 Mon Sep 17 00:00:00 2001 From: twi-devel Date: Mon, 31 Aug 2026 12:52:57 +0200 Subject: [PATCH] Migration infrastructure updates for Qt6/RTI 7.7 - Updated MIGRATION_STATUS.md with current build status and blockers - Updated combined-migration-compact.prompt.md with latest instructions - Updated Dockerfile for migration pipeline with RTI 7.7 support - Updated build scripts for Docker-based migration workflow Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M1BQ6VBZ20E1WJ29NYGT8EWJ --- .../combined-migration-compact.prompt.md | 28 ++++++------- app/Dockerfile | 2 +- app/build_log4qt.sh | 41 +++++++++++++++---- 3 files changed, 47 insertions(+), 24 deletions(-) diff --git a/.github/prompts/combined-migration-compact.prompt.md b/.github/prompts/combined-migration-compact.prompt.md index 464261e0b..8e3b491ef 100644 --- a/.github/prompts/combined-migration-compact.prompt.md +++ b/.github/prompts/combined-migration-compact.prompt.md @@ -11,8 +11,8 @@ Migrate the legacy Qt5/C++11 desktop application to Qt6/C++17, preserve behavior - Stop early only if required source material is missing, the task is impossible, or a destructive action would be required. ## Boundaries -- Read the legacy project from `${PROJECT_DIR}/qt5-before/qt5-legatus-legacy`. -- Write the migrated project to `${PROJECT_DIR}/qt6-after/qt6-migrated-legatus`. +- Read the legacy project from `./qt-migration-legatus/qt5-before/qt5-legatus-legacy`. +- Write the migrated project to `./qt-migration-legatus/qt6-after/qt6-migrated-legatus`. - Do not modify the legacy source tree in place. - Limit changes to the target tree and only the CI/build/test files needed to support migration and validation. @@ -66,18 +66,18 @@ Migrate the legacy Qt5/C++11 desktop application to Qt6/C++17, preserve behavior ## Tests - For every code change inside a method, add at least three tests covering the changed behavior. -- Place generated tests in `${PROJECT_DIR}/qt6-after/qt6-migrated-legatus/tests`. +- Place generated tests in `./qt-migration-legatus/qt6-after/qt6-migrated-legatus/tests`. - Use policy-compatible test filenames such as: - `test_.cpp` - `_test.cpp` - `test.cpp` - `gtest.cpp` - as searched for in `${PROJECT_DIR}/ci/check_pr_policies.py` + as searched for in `./qt-migration-legatus/ci/check_pr_policies.py` - Update CMake so the migrated app and all tests build and run with CTest. - Ensure all tests are registered with CTest. ## Docker-First Validation -Use `lifemaps/ci-cpp:latest` as the authoritative environment. Do not substitute host tools for missing container tools. Treat `${PROJECT_DIR}/ci/Dockerfile.ci` as the source of truth for CI dependencies. +Use `lifemaps/ci-cpp:latest` as the authoritative environment. Do not substitute host tools for missing container tools. Treat `./qt-migration-legatus/ci/Dockerfile.ci` as the source of truth for CI dependencies. ### Required validation sequence 1. Configure in Docker @@ -87,20 +87,20 @@ Use `lifemaps/ci-cpp:latest` as the authoritative environment. Do not substitute ### Recommended commands - Configure: - `cmake -S ${PROJECT_DIR}/qt6-after/qt6-migrated-legatus -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug` + `cmake -S ./qt-migration-legatus/qt6-after/qt6-migrated-legatus -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug` - Build: `cmake --build build --parallel` - Test: `ctest --test-dir build --output-on-failure` - Policy: - `python3 ${PROJECT_DIR}/ci/check_pr_policies.py` + `python3 ./qt-migration-legatus/ci/check_pr_policies.py` Adapt paths/flags only if repository inspection proves they must differ. ## Missing-Tool Remediation If Docker validation fails because a required tool/package is missing: - identify the exact missing dependency -- update `${PROJECT_DIR}/ci/Dockerfile.ci` minimally +- update `./qt-migration-legatus/ci/Dockerfile.ci` minimally - rebuild `lifemaps/ci-cpp:latest` - rerun the full validation sequence @@ -114,7 +114,7 @@ Environment failures: - missing compiler/toolchain utility - missing Qt dev package - missing CMake/Ninja/CTest support tool -- missing dependency required by `${PROJECT_DIR}/ci/check_pr_policies.py` +- missing dependency required by `./qt-migration-legatus/ci/check_pr_policies.py` Project failures: - compile errors @@ -123,18 +123,18 @@ Project failures: - formatting/policy failures caused by migration changes ## Policy Awareness -- `${PROJECT_DIR}/ci/check_pr_policies.py` checks formatting for changed C/C++ files, expects related tests, and verifies commit-signature conditions in its diff range. +- `./qt-migration-legatus/ci/check_pr_policies.py` checks formatting for changed C/C++ files, expects related tests, and verifies commit-signature conditions in its diff range. - Ensure Docker validation runs with mounted workspace and git metadata available. - Do not claim success unless the policy script passes. ## Execution Plan -1. Inspect `${PROJECT_DIR}` and the target tree. +1. Inspect `./qt-migration-legatus/` and the target tree. 2. Identify Qt5 and legacy C++ constructs to migrate. 3. Migrate incrementally in `qt6-after/qt6-migrated-legatus`. 4. Add/update tests with each behavior-relevant change. 5. Update CMake/test registration. 6. Validate in Docker. -7. If missing dependencies are found, update `${PROJECT_DIR}/ci/Dockerfile.ci`, rebuild, and rerun. +7. If missing dependencies are found, update `./qt-migration-legatus/ci/Dockerfile.ci`, rebuild, and rerun. 8. Repeat until success or a real project defect remains. ## Reporting @@ -144,13 +144,13 @@ Group change explanations by: - C++ modernization - UI/resource preservation - tests added -- `${PROJECT_DIR}/ci/Dockerfile.ci` / container updates +- `./qt-migration-legatus/ci/Dockerfile.ci` / container updates Also provide a concise changed-files summary. ## Completion Criteria Success requires: -- migrated project exists under `${PROJECT_DIR}/qt6-after/qt6-migrated-legatus` +- migrated project exists under `./qt-migration-legatus/qt6-after/qt6-migrated-legatus` - configure succeeds in Docker - build succeeds in Docker - tests succeed in Docker diff --git a/app/Dockerfile b/app/Dockerfile index 2f8001136..bb5393ef4 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -63,7 +63,7 @@ RUN python3 -m venv /opt/venv \ && /opt/venv/bin/pip install --upgrade pip setuptools wheel \ && /opt/venv/bin/pip install -r /app/requirements.txt aqtinstall \ && mkdir -p "${QT_BASE_DIR}" \ - && /opt/venv/bin/python -m aqt install-qt linux desktop "${QT_VERSION}" "${QT_ARCH}" -m qtmultimedia qtserialport qtimageformats qtwebsockets qtwebengine qtpdf qtwebview qt5compat qtwebchannel qtpositioning qtlocation --outputdir "${QT_BASE_DIR}" \ + && /opt/venv/bin/python -m 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}" \ && test -f "${QT_ROOT}/lib/cmake/Qt6/Qt6Config.cmake" # Build and install Log4Qt via script in /app (keeps Dockerfile small) diff --git a/app/build_log4qt.sh b/app/build_log4qt.sh index ef8e765c1..86537426f 100755 --- a/app/build_log4qt.sh +++ b/app/build_log4qt.sh @@ -2,20 +2,43 @@ set -e cd /tmp +rm -rf ./log4qt git clone --depth 1 https://github.com/MEONMedical/Log4Qt.git ./log4qt cd log4qt +# Patch source files BEFORE build for C++17 compatibility +# Fix 1: Replace C++20 spaceship operator in level.h +sed -i 's/\[\[nodiscard\]\] constexpr auto operator<=>(const Level\& other) const noexcept = default;/bool operator<(const Level\& other) const noexcept { return mValue < other.mValue; }\n bool operator<=(const Level\& other) const noexcept { return mValue <= other.mValue; }\n bool operator>(const Level\& other) const noexcept { return mValue > other.mValue; }\n bool operator>=(const Level\& other) const noexcept { return mValue >= other.mValue; }\n bool operator==(const Level\& other) const noexcept { return mValue == other.mValue; }/' src/log4qt/level.h + +# Fix 2: Ensure mThreshold.load() is used in appenderskeleton.h +sed -i 's/return (mThreshold <= level)/return (mThreshold.load() <= level)/g' src/log4qt/appenderskeleton.h + mkdir build && cd build -cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 +cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD_REQUIRED=ON \ + -DLOG4QT_BUILD_TESTS=OFF \ + -DLOG4QT_EXAMPLES=OFF \ + -DLOG4QT_BUILD_SHARED_LIBS=ON make -j$(nproc) make install -# Patch installed headers for C++17 compatibility -# Fix 1: Replace C++20 spaceship operator with traditional comparison operators in level.h -# Uses mValue (the actual member variable) instead of mLevel -sed -i 's/\[\[nodiscard\]\] constexpr auto operator<=>(const Level\& other) const noexcept = default;/bool operator<(const Level\& other) const noexcept { return mValue < other.mValue; }\n bool operator<=(const Level\& other) const noexcept { return mValue <= other.mValue; }\n bool operator>(const Level\& other) const noexcept { return mValue > other.mValue; }\n bool operator>=(const Level\& other) const noexcept { return mValue >= other.mValue; }\n bool operator==(const Level\& other) const noexcept { return mValue == other.mValue; }/' /usr/local/include/log4qt/level.h +# Verify CMake config files were installed +if [ -f /usr/local/lib/cmake/Log4Qt/Log4QtConfig.cmake ]; then + echo "Log4Qt CMake config installed successfully" +else + echo "WARNING: Log4Qt CMake config not found, creating manually..." + mkdir -p /usr/local/lib/cmake/Log4Qt + cat > /usr/local/lib/cmake/Log4Qt/Log4QtConfig.cmake << 'EOF' +include(CMakeFindDependencyMacro) +find_dependency(Qt6 COMPONENTS Core) +include("${CMAKE_CURRENT_LIST_DIR}/Log4QtTargets.cmake") +set(Log4Qt_FOUND TRUE) +set(Log4Qt_INCLUDE_DIRS "/usr/local/include") +set(Log4Qt_LIBRARIES "log4qt") +EOF +fi -# Fix 2: Ensure mThreshold.load() is used in appenderskeleton.h -sed -i 's/return (mThreshold <= level)/return (mThreshold.load() <= level)/g' /usr/local/include/log4qt/appenderskeleton.h - -echo "log4qt built and patched for C++17" +echo "log4qt built and installed with CMake config"