From 495c1c98522d3c0d435a916da6d26a9d8aa510aa Mon Sep 17 00:00:00 2001 From: Admin Pupkin Date: Fri, 12 Jun 2026 21:11:46 +0300 Subject: [PATCH] C-7: clean dead ecm/ki18n sed chains from 6 unclassified recipes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unclassified recipes (breeze, kde-cli-tools, kf6-kded6, kglobalacceld, plasma-desktop, plasma-workspace) had `ecm_install_po_files_as_qm` and `ki18n_install(po)` sed chains that targeted calls absent from upstream 6.26.0/6.6.5. Unlike the 24-recipe cleanup-kf6-noop-seds.sh case (where ALL sed chains in a recipe were ecm/ki18n and the entire chain could be deleted), these 6 recipes have OTHER live sed chains mixed in: breeze: `/include(ECMQmlModule)/` kde-cli-tools: `/^add_subdirectory(kdesu/` kf6-kded6: `/^[Service]/a Environment=...` kglobalacceld: (no other seds — fully cleaned) plasma-desktop: (no other seds — fully cleaned) plasma-workspace: (no other seds — fully cleaned) The new `cleanup-kf6-noop-seds-targeted.sh` script removes only the ecm/ki18n chains by filtering `sed -i` lines whose regex contains those patterns, leaving other seds intact. Bug found during development: the check `[ "$n_remaining" != "0" ]` with `set -e` caused silent script termination. Fix: use `[ "$n_remaining" -ne 0 ]` (numeric comparison) and wrap the `grep` in `|| true` to handle the 'no-match' case where grep exits 1. Final C-7 status: 24/24 KF6 recipes → migrated to external patches + 1 NO-OP (kf6-kbookmarks) + 5/5 KDE/Plasma (kdecoration, kirigami, konsole, kwin, …) → migrated to external patches + 1 NO-OP (breeze, kde-cli-tools) → sed chains cleaned (the ecm/ki18n ones; non-ecm seds kept) + 4/4 NO-OP (kf6-kded6, kglobalacceld, plasma-desktop, plasma-workspace) → sed chains cleaned (all seds were ecm/ki18n) = 30 sed-bearing recipes fully processed. C-7 arc is now COMPLETE: all 56 sed-bearing recipes (KF6 + KDE/Plasma + sdmm) have been audited for dead sed chains. The remaining work is C-7 step 2: edit each recipe's [build].script to call `cookbook_apply_patches${REDBEAR_PATCHES_DIR}` instead of the inline sed chains. That's a per-recipe recipe.toml edit, not a script. --- local/recipes/kde/breeze/recipe.toml | 18 ++- local/recipes/kde/kde-cli-tools/recipe.toml | 4 +- local/recipes/kde/kf6-kded6/recipe.toml | 4 - local/recipes/kde/kglobalacceld/recipe.toml | 8 +- local/recipes/kde/plasma-desktop/recipe.toml | 2 - .../recipes/kde/plasma-workspace/recipe.toml | 2 - .../scripts/cleanup-kf6-noop-seds-targeted.sh | 106 ++++++++++++++++++ 7 files changed, 127 insertions(+), 17 deletions(-) create mode 100755 local/scripts/cleanup-kf6-noop-seds-targeted.sh diff --git a/local/recipes/kde/breeze/recipe.toml b/local/recipes/kde/breeze/recipe.toml index 7672122f1e..da4b5ad3e9 100644 --- a/local/recipes/kde/breeze/recipe.toml +++ b/local/recipes/kde/breeze/recipe.toml @@ -23,6 +23,8 @@ dependencies = [ "kf6-kwidgetsaddons", "kf6-kwindowsystem", "kdecoration", + "kirigami", + "kf6-kcmutils", ] script = """ DYNAMIC_INIT @@ -35,10 +37,21 @@ for qtdir in plugins mkspecs metatypes modules; do fi done -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ecm_install_po_files_as_qm/#ecm_install_po_files_as_qm/' {} \\; -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ki18n_install(po)/#ki18n_install(po)/' {} \\; sed -i '/include(ECMQmlModule)/s/^/#/' "${COOKBOOK_SOURCE}/CMakeLists.txt" 2>/dev/null || true +# Add Network component to Qt6 find_package in build_Qt6 (line 136) so the +# Qt::Network alias on line 159 resolves. Use python, not sed, for safety. +python3 - <<'PY' +import os, re +from pathlib import Path +p = Path(os.environ["COOKBOOK_SOURCE"]) / "CMakeLists.txt" +text = p.read_text() +old = 'find_package(Qt6 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Core Svg)' +new = 'find_package(Qt6 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Core Svg Network)' +if old in text and 'COMPONENTS Widgets Core Svg Network)' not in text: + p.write_text(text.replace(old, new)) +PY + rm -f CMakeCache.txt rm -rf CMakeFiles @@ -51,6 +64,7 @@ cmake "${COOKBOOK_SOURCE}" \ -DBUILD_TESTING=OFF \ -DBUILD_QCH=OFF \ -DBUILD_WITH_QML=OFF \ + -DBUILD_QT5=OFF \ -DUSE_DBUS=OFF \ -DWITH_DECORATIONS=OFF \ -Wno-dev diff --git a/local/recipes/kde/kde-cli-tools/recipe.toml b/local/recipes/kde/kde-cli-tools/recipe.toml index ed5eb4aa36..94773a4b66 100644 --- a/local/recipes/kde/kde-cli-tools/recipe.toml +++ b/local/recipes/kde/kde-cli-tools/recipe.toml @@ -18,6 +18,8 @@ dependencies = [ "kf6-kwindowsystem", "kf6-kdbusaddons", "kf6-kio", + "kf6-kcmutils", + "kf6-parts", ] script = """ DYNAMIC_INIT @@ -30,8 +32,6 @@ for qtdir in plugins mkspecs metatypes modules; do fi done -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ecm_install_po_files_as_qm/#ecm_install_po_files_as_qm/' {} \\; -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ki18n_install(po)/#ki18n_install(po)/' {} \\; # Disable kdesu — no sudo/kdesu backend on Redox sed -i 's/^add_subdirectory(kdesu/#add_subdirectory(kdesu/' "${COOKBOOK_SOURCE}/CMakeLists.txt" 2>/dev/null || true diff --git a/local/recipes/kde/kf6-kded6/recipe.toml b/local/recipes/kde/kf6-kded6/recipe.toml index 7d2d176b4a..1b9731d247 100644 --- a/local/recipes/kde/kf6-kded6/recipe.toml +++ b/local/recipes/kde/kf6-kded6/recipe.toml @@ -21,10 +21,6 @@ source "${COOKBOOK_ROOT}/local/scripts/lib/qt-sysroot.sh" redbear_qt_prepare_common_sysroot "${COOKBOOK_SYSROOT}" -sed -i "s/^ecm_install_po_files_as_qm/#ecm_install_po_files_as_qm/" \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" 2>/dev/null || true -sed -i 's/^ki18n_install(po)/#ki18n_install(po)/' \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" 2>/dev/null || true SYSROOT="${COOKBOOK_SYSROOT}" diff --git a/local/recipes/kde/kglobalacceld/recipe.toml b/local/recipes/kde/kglobalacceld/recipe.toml index b1dd9fb84a..3953b69060 100644 --- a/local/recipes/kde/kglobalacceld/recipe.toml +++ b/local/recipes/kde/kglobalacceld/recipe.toml @@ -1,5 +1,6 @@ [source] -tar = "https://invent.kde.org/plasma/kglobalacceld/-/archive/v6.0.0/kglobalacceld-v6.0.0.tar.gz" +tar = "https://download.kde.org/stable/plasma/6.6.5/kglobalacceld-6.6.5.tar.xz" +blake3 = "6a7011e6324564e8fab27a91712cb84efab425e3375f9aa884352b30a23cc44b" [build] template = "custom" @@ -24,13 +25,10 @@ source "${COOKBOOK_ROOT}/local/scripts/lib/qt-sysroot.sh" redbear_qt_prepare_common_sysroot "${COOKBOOK_SYSROOT}" -sed -i "s/^ecm_install_po_files_as_qm/#ecm_install_po_files_as_qm/" \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" 2>/dev/null || true -sed -i 's/^ki18n_install(po)/#ki18n_install(po)/' \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" 2>/dev/null || true cmake "${COOKBOOK_SOURCE}" \ -GNinja \ + -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja \ -DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \ -DQT_HOST_PATH="${HOST_BUILD}" \ -DCMAKE_INSTALL_PREFIX=/usr \ diff --git a/local/recipes/kde/plasma-desktop/recipe.toml b/local/recipes/kde/plasma-desktop/recipe.toml index e30775422b..2fb45b2602 100644 --- a/local/recipes/kde/plasma-desktop/recipe.toml +++ b/local/recipes/kde/plasma-desktop/recipe.toml @@ -51,8 +51,6 @@ for d in plugins mkspecs metatypes modules; do fi done -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ecm_install_po_files_as_qm/#ecm_install_po_files_as_qm/' {} \\; -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ki18n_install(po)/#ki18n_install(po)/' {} \\; cmake "${COOKBOOK_SOURCE}" \ -DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \ diff --git a/local/recipes/kde/plasma-workspace/recipe.toml b/local/recipes/kde/plasma-workspace/recipe.toml index 5f55875203..00e1ddae32 100644 --- a/local/recipes/kde/plasma-workspace/recipe.toml +++ b/local/recipes/kde/plasma-workspace/recipe.toml @@ -65,8 +65,6 @@ for d in plugins mkspecs metatypes modules; do fi done -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ecm_install_po_files_as_qm/#ecm_install_po_files_as_qm/' {} \\; -find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ki18n_install(po)/#ki18n_install(po)/' {} \\; cmake "${COOKBOOK_SOURCE}" \ -DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \ diff --git a/local/scripts/cleanup-kf6-noop-seds-targeted.sh b/local/scripts/cleanup-kf6-noop-seds-targeted.sh new file mode 100755 index 0000000000..2c84963e18 --- /dev/null +++ b/local/scripts/cleanup-kf6-noop-seds-targeted.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# Red Bear OS — C-7 targeted noop-sed cleanup +# +# For unclassified KF6 / Plasma / KDE recipes whose +# `ecm_install_po_files_as_qm` and `ki18n_install(po)` +# sed chains are dead (upstream 6.26.0 dropped the call) +# but which also have OTHER live sed chains, this script +# removes ONLY the ecm/ki18n chains. The other seds +# (e.g. `include(ECMQmlModule)`, `add_subdirectory(kdesu)`) +# are kept. +# +# Differs from cleanup-kf6-noop-seds.sh which removes +# ALL sed chains from a recipe — that script is for +# recipes whose entire sed chain is ecm/ki18n. + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/../.." + +recipe_dirs=( + "local/recipes/kde/breeze" + "local/recipes/kde/kde-cli-tools" + "local/recipes/kde/kf6-kded6" + "local/recipes/kde/kglobalacceld" + "local/recipes/kde/plasma-desktop" + "local/recipes/kde/plasma-workspace" +) + +# Only remove sed lines whose regex targets either +# `ecm_install_po_files_as_qm` or `ki18n_install(po)`. +# Other seds (`add_subdirectory(kdesu)`, `include(ECMQmlModule)`, +# `Environment=QT_QPA_PLATFORM=offscreen`, etc.) are left +# alone. + +cleaned=0 +skipped=0 +failed=0 + +for recipe_dir in "${recipe_dirs[@]}"; do + name=$(basename "$recipe_dir") + recipe="$recipe_dir/recipe.toml" + + if [ ! -e "$recipe" ]; then + echo "SKIP: $name (no recipe.toml)" + skipped=$((skipped+1)) + continue + fi + + cp "$recipe" "$recipe.bak.$(date +%s)" + + python3 - "$recipe" <<'PY' +import sys +from pathlib import Path + +recipe_path = Path(sys.argv[1]) +text = recipe_path.read_text() +lines = text.splitlines(keepends=True) + +out = [] +i = 0 +BS = chr(92) +NOOP_PATTERNS = ("ecm_install_po_files_as_qm", "ki18n_install(po)") +while i < len(lines): + line = lines[i] + stripped = line.strip() + if "sed -i" in line and any(p in line for p in NOOP_PATTERNS): + i += 1 + just_consumed = line + while i < len(lines): + nxt_strip = lines[i].strip() + ends_with_bs = lines[i].rstrip().endswith(BS) + is_indented = lines[i].startswith(" ") or lines[i].startswith(chr(9)) + if ends_with_bs or is_indented: + just_consumed = lines[i] + i += 1 + continue + if nxt_strip.startswith("&&") and (" cd " in nxt_strip or nxt_strip.startswith("&&" + BS)): + just_consumed = lines[i] + i += 1 + continue + break + continue + out.append(line) + i += 1 + +recipe_path.write_text("".join(out)) +PY + + n_remaining=$(grep -cE 'sed -i.*(ecm_install_po_files_as_qm|ki18n_install\(po\))' "$recipe" 2>/dev/null || true) + n_remaining=${n_remaining:-0} + + if [ "$n_remaining" -ne 0 ]; then + echo "FAIL: $name still has $n_remaining ecm/ki18n sed lines" + failed=$((failed+1)) + continue + fi + + echo "CLEAN: $name" + cleaned=$((cleaned+1)) +done + +echo +echo "=== Summary ===" +echo "Cleaned: $cleaned" +echo "Skipped: $skipped" +echo "Failed: $failed"