diff --git a/local/scripts/sync-recipe-source.sh b/local/scripts/sync-recipe-source.sh index 1fff431c3d..1d6f0f5036 100755 --- a/local/scripts/sync-recipe-source.sh +++ b/local/scripts/sync-recipe-source.sh @@ -57,7 +57,20 @@ resolve(){ local t="${1%/}" # strip trailing slash # stale stamp must never mask the real version and skip a needed rebase. src_version(){ local s="$1" [ -f "$s/.cmake.conf" ] && { local v; v=$(ver_of "$(grep -m1 QT_REPO_MODULE_VERSION "$s/.cmake.conf")"); [ -n "$v" ] && { echo "$v"; return; }; } - [ -f "$s/CMakeLists.txt" ] && { local v; v=$(grep -m1 -E 'set\(KF_VERSION|project\([A-Za-z0-9_]+ VERSION [0-9]' "$s/CMakeLists.txt" 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1); [ -n "$v" ] && { echo "$v"; return; }; } + if [ -f "$s/CMakeLists.txt" ]; then + # KDE Frameworks (KF_VERSION), Plasma (PROJECT_VERSION), or a literal + # project(Name VERSION X.Y.Z). + local v; v=$(grep -m1 -E 'set\((KF_VERSION|PROJECT_VERSION)|project\([A-Za-z0-9_]+ VERSION [0-9]' "$s/CMakeLists.txt" 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) + # KDE Gear (konsole etc.): version split across RELEASE_SERVICE_VERSION_*. + if [ -z "$v" ] && grep -q RELEASE_SERVICE_VERSION_MAJOR "$s/CMakeLists.txt" 2>/dev/null; then + local a b c + a=$(grep -m1 RELEASE_SERVICE_VERSION_MAJOR "$s/CMakeLists.txt" | grep -oE '[0-9]+' | head -1) + b=$(grep -m1 RELEASE_SERVICE_VERSION_MINOR "$s/CMakeLists.txt" | grep -oE '[0-9]+' | head -1) + c=$(grep -m1 RELEASE_SERVICE_VERSION_MICRO "$s/CMakeLists.txt" | grep -oE '[0-9]+' | head -1) + [ -n "$a" ] && v="$a.$b.$c" + fi + [ -n "$v" ] && { echo "$v"; return; } + fi [ -f "$s/.redbear-src-version" ] && { ver_of "$(cat "$s/.redbear-src-version")"; return; } echo "" } diff --git a/local/scripts/test-versioning-machinery.sh b/local/scripts/test-versioning-machinery.sh index 40d5e3e66d..dfcb30208d 100755 --- a/local/scripts/test-versioning-machinery.sh +++ b/local/scripts/test-versioning-machinery.sh @@ -257,6 +257,21 @@ out="$($SYNC --check "local/recipes/eng_res/" 2>&1)" assert_not_contains "E22 full path with trailing slash resolves (not 'not found')" "$out" "not found" rm -rf "$d" +echo "=== E23 Plasma PROJECT_VERSION + Gear RELEASE_SERVICE markers ===" +d="$(mk_recipe plasmastyle "https://x/plasma/6.7.2/breeze-6.7.2.tar.xz" -)"; mkdir -p "$d/source" +printf 'cmake_minimum_required(VERSION 3.16)\nset(PROJECT_VERSION "6.3.4")\n' >"$d/source/CMakeLists.txt" +out="$($VERIFY 2>&1)"; rc=$? +assert_eq "E23 Plasma source 6.3.4 vs url 6.7.2 -> FAIL (PROJECT_VERSION read)" "$rc" "1" +printf 'cmake_minimum_required(VERSION 3.16)\nset(PROJECT_VERSION "6.7.2")\n' >"$d/source/CMakeLists.txt" +out="$($VERIFY --quiet 2>&1)"; rc=$? +assert_eq "E23 Plasma consistent 6.7.2 -> PASS" "$rc" "0" +rm -rf "$d" +d="$(mk_recipe gearstyle "https://x/konsole-26.04.3.tar.xz" -)"; mkdir -p "$d/source" +printf 'set(RELEASE_SERVICE_VERSION_MAJOR "24")\nset(RELEASE_SERVICE_VERSION_MINOR "08")\nset(RELEASE_SERVICE_VERSION_MICRO "3")\n' >"$d/source/CMakeLists.txt" +out="$($VERIFY 2>&1)"; rc=$? +assert_eq "E23 Gear source 24.08.3 vs url 26.04.3 -> FAIL (RELEASE_SERVICE read)" "$rc" "1" +rm -rf "$d" + echo "" echo "================ RESULT ================" echo " PASS: $PASS FAIL: $FAIL" diff --git a/local/scripts/verify-external-source-versions.sh b/local/scripts/verify-external-source-versions.sh index 30f4205c16..c12d711a0c 100755 --- a/local/scripts/verify-external-source-versions.sh +++ b/local/scripts/verify-external-source-versions.sh @@ -82,7 +82,15 @@ while IFS= read -r recipe; do sver="$(ver_of "$(grep -m1 QT_REPO_MODULE_VERSION "$dir/source/.cmake.conf" 2>/dev/null)")" fi if [ -z "$sver" ] && [ -f "$dir/source/CMakeLists.txt" ]; then - sver="$(grep -m1 -E 'set\(KF_VERSION|project\([A-Za-z0-9_]+ VERSION [0-9]' "$dir/source/CMakeLists.txt" 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)" + # KF (KF_VERSION), Plasma (PROJECT_VERSION), literal project(... VERSION x) + sver="$(grep -m1 -E 'set\((KF_VERSION|PROJECT_VERSION)|project\([A-Za-z0-9_]+ VERSION [0-9]' "$dir/source/CMakeLists.txt" 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)" + # KDE Gear split RELEASE_SERVICE_VERSION_* (konsole etc.) + if [ -z "$sver" ] && grep -q RELEASE_SERVICE_VERSION_MAJOR "$dir/source/CMakeLists.txt" 2>/dev/null; then + a="$(grep -m1 RELEASE_SERVICE_VERSION_MAJOR "$dir/source/CMakeLists.txt" | grep -oE '[0-9]+' | head -1)" + b="$(grep -m1 RELEASE_SERVICE_VERSION_MINOR "$dir/source/CMakeLists.txt" | grep -oE '[0-9]+' | head -1)" + c="$(grep -m1 RELEASE_SERVICE_VERSION_MICRO "$dir/source/CMakeLists.txt" | grep -oE '[0-9]+' | head -1)" + [ -n "$a" ] && sver="$a.$b.$c" + fi fi if [ -z "$sver" ] && [ -f "$dir/source/.redbear-src-version" ]; then sver="$(ver_of "$(cat "$dir/source/.redbear-src-version" 2>/dev/null)")"