Files
qt6-migration-pipeline/migration/automate_migrate_Lts_DDS.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

86 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# automate_migrate_Lts_DDS.sh
# Run inside migration Docker image (migration-pipeline:ubuntu26.04)
# - Installs lightweight tooling (clang-tidy, clang-format, pip)
# - Runs clang-tidy fixes (safe checks) over Lts/DDS
# - Runs strix to generate tests for modified functions (if strix available)
# - Commits changes incrementally
REPO_DIR="/repo"
MODULE="Lts/DDS"
BUILD_DIR="/repo/build_migrate_Lts_DDS"
echo "This script must run inside the migration image with network access. It will attempt to install tools and
apply automated clang-tidy fixes. Review changes before pushing."
apt-get update
apt-get install -y --no-install-recommends clang-tidy clang-format python3-pip git || true
# Install strix via pip if available (strix has a pip package 'strix' — fallback: clone usestrix/strix)
if ! python3 -m pip show strix >/dev/null 2>&1; then
pip install --upgrade pip setuptools || true
if python3 -m pip install strix; then
echo "Installed strix via pip"
else
echo "strix pip install failed; cloning repository as fallback"
TMP=$(mktemp -d)
git clone --depth 1 https://github.com/usestrix/strix.git "$TMP" || true
if [ -d "$TMP" ]; then
pip install --upgrade "$TMP" || true
fi
fi
fi
# Run clang-tidy fixes (safe subset)
# NOTE: This uses compile_commands from the build dir. Ensure build_migrate_Lts_DDS has been configured.
if [ ! -f "${BUILD_DIR}/compile_commands.json" ]; then
echo "Configuring build dir to generate compile_commands.json"
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
cmake -S "${REPO_DIR}" -B "${BUILD_DIR}" -G Ninja -DCMAKE_PREFIX_PATH=/opt/Qt/6.8.3/gcc_64:/usr/local -DCMAKE_CXX_STANDARD=20 -DMIGRATE_MODULE=${MODULE} -DBUILD_TESTING=OFF
cd "${REPO_DIR}"
fi
# Safe checks: modernize-use-nullptr, modernize-loop-convert, readability-identifier-naming (no-apply)
CHECKS="-checks=modernize-*,-modernize-use-trailing-return-type,-modernize-raw-string-literal"
# Run clang-tidy and auto-fix per file
FILES=$(git ls-files "${MODULE}" | grep -E "\.(cpp|cc|cxx|h|hpp)$" || true)
for f in $FILES; do
echo "Running clang-tidy on $f"
clang-tidy $f -p "${BUILD_DIR}" ${CHECKS} --format-style=file -fix -quiet || true
done
# Format changed files
for f in $FILES; do
git ls-files -m | grep -q "^$f$" && clang-format -i "$f" || true
done
# Commit changes if any
if [ -n "$(git status --porcelain)" ]; then
git add ${MODULE}
git commit -m "migrate(Lts/DDS): apply clang-tidy modernization fixes\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>" || true
echo "Committed automated clang-tidy fixes for ${MODULE}"
else
echo "No changes from clang-tidy"
fi
# Attempt to run strix to produce tests (best-effort). Honor SKIP_STRIX=1 to skip.
if [ "${SKIP_STRIX:-0}" = "1" ]; then
echo "SKIP_STRIX=1 set; skipping strix test generation"
else
if python3 -m strix --help >/dev/null 2>&1; then
echo "Running strix to generate tests (best-effort)"
# Example invocation: strix --target <binary> --out tests/
mkdir -p migration/strix-tests
# This is a placeholder; actual strix usage depends on build artifacts and symbols
echo "Stripe test generation placeholder: run strix manually against built binaries."
else
echo "strix not available; skipping test generation"
fi
fi
echo "Automated migration script finished. Review git status and run full builds."