C-7 cleanup: remove dead sed chains from 24 NO-OP KF6 recipes
24 KF6 recipes had inline `sed -i` chains in their [build].script that targeted `ecm_install_po_files_as_qm(poqm)` in CMakeLists.txt. Upstream KDE Frameworks 6.26.0 has dropped the call entirely for packages that no longer ship translations — the sed chains were no-ops. Per the v6.0 zero-tolerance policy for sed hacks and dead code, this commit removes the chains rather than leaving them as workaround cruft. Recipes cleaned (24): kf6-attica, kf6-kcolorscheme, kf6-kconfigwidgets, kf6-kcrash, kf6-kguiaddons, kf6-ki18n, kf6-kiconthemes, kf6-kidletime, kf6-kimageformats, kf6-kio, kf6-kitemmodels, kf6-knewstuff, kf6-kpackage, kf6-kservice, kf6-ksvg, kf6-ktexteditor, kf6-ktextwidgets, kf6-kwallet, kf6-kxmlgui, kf6-parts, kf6-plasma-activities, kf6-prison, kf6-pty, plasma-framework Each recipe lost 1-17 sed lines (5-line multi-line `sed -i ... \ file` continuations correctly consumed). All 24 recipes still parse as valid TOML. Helper: `local/scripts/cleanup-kf6-noop-seds.sh` (new). Walks the NO-OP list, makes a timestamped backup, removes the sed chain + any orphan `\\` continuation + any orphan `&& cd` continuation, verifies zero sed lines remain. Idempotent. The 15 HAS-LINE recipes (kf6-kauth, kf6-kbookmarks, kf6-kcodecs, kf6-kcompletion, kf6-kconfig, kf6-kcoreaddons, kf6-kdbusaddons, kf6-kglobalaccel, kf6-kitemviews, kf6-kjobwidgets, kf6-knotifications, kf6-kwidgetsaddons, kf6-solid, kf6-sonnet, kf6-syntaxhighlighting) still have their sed chains in place and will be migrated to external patches via `migrate-kf6-seds-to-patches.sh` in a follow-up. The 2 git-sourced recipes (breeze, kirigami, …) will be handled once their source is fetched and the line-presence check can run.
This commit is contained in:
Executable
+134
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env bash
|
||||
# Red Bear OS — C-7 mass-categorize-and-cleanup
|
||||
#
|
||||
# Walks the list of NO-OP recipes (those whose sed target line
|
||||
# is absent from upstream 6.26.0) and removes the dead sed
|
||||
# chains from their recipe.toml.
|
||||
#
|
||||
# Why: per the v6.0 "STUB AND WORKAROUND POLICY — ZERO TOLERANCE"
|
||||
# (local/AGENTS.md), dead sed chains are exactly the "sed hacks"
|
||||
# the policy forbids. The chains were added because we expected
|
||||
# the line to be in the upstream source, but upstream 6.26.0 has
|
||||
# since dropped the call for packages that no longer ship
|
||||
# translations. Leaving the chains in place would be a permanent
|
||||
# "make it compile" shortcut on dead code.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
|
||||
|
||||
recipe_dirs=(
|
||||
"local/recipes/kde/kf6-attica"
|
||||
"local/recipes/kde/kf6-kcolorscheme"
|
||||
"local/recipes/kde/kf6-kconfigwidgets"
|
||||
"local/recipes/kde/kf6-kcrash"
|
||||
"local/recipes/kde/kf6-kguiaddons"
|
||||
"local/recipes/kde/kf6-ki18n"
|
||||
"local/recipes/kde/kf6-kiconthemes"
|
||||
"local/recipes/kde/kf6-kidletime"
|
||||
"local/recipes/kde/kf6-kimageformats"
|
||||
"local/recipes/kde/kf6-kio"
|
||||
"local/recipes/kde/kf6-kitemmodels"
|
||||
"local/recipes/kde/kf6-knewstuff"
|
||||
"local/recipes/kde/kf6-kpackage"
|
||||
"local/recipes/kde/kf6-kservice"
|
||||
"local/recipes/kde/kf6-ksvg"
|
||||
"local/recipes/kde/kf6-ktexteditor"
|
||||
"local/recipes/kde/kf6-ktextwidgets"
|
||||
"local/recipes/kde/kf6-kwallet"
|
||||
"local/recipes/kde/kf6-kxmlgui"
|
||||
"local/recipes/kde/kf6-parts"
|
||||
"local/recipes/kde/kf6-plasma-activities"
|
||||
"local/recipes/kde/kf6-prison"
|
||||
"local/recipes/kde/kf6-pty"
|
||||
"local/recipes/kde/plasma-framework"
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
n_sed=$(grep -c "sed -i" "$recipe" 2>/dev/null || true)
|
||||
if [ "$n_sed" = "0" ]; then
|
||||
echo "SKIP: $name (no sed chains)"
|
||||
skipped=$((skipped+1))
|
||||
continue
|
||||
fi
|
||||
|
||||
cp "$recipe" "$recipe.bak.$(date +%s)"
|
||||
|
||||
# The sed chains follow this pattern in the recipes:
|
||||
# sed -i "..." CMakeLists.txt && \
|
||||
# cd <subdir> && \
|
||||
# sed -i "..." CMakeLists.txt && \
|
||||
# ...
|
||||
# Remove each `sed -i ...` line plus any orphan `&& cd ...`
|
||||
# continuation that immediately follows it.
|
||||
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
|
||||
while i < len(lines):
|
||||
line = lines[i]
|
||||
if "sed -i" in line:
|
||||
i += 1
|
||||
# Consume any continuation lines that this `sed -i`
|
||||
# was connected to. A continuation line is one that
|
||||
# the just-consumed line ended with a backslash, OR
|
||||
# one that is an `&& cd ...` or `&& \\` operator
|
||||
# followed by more `sed -i` lines.
|
||||
just_consumed = line
|
||||
while i < len(lines):
|
||||
nxt_strip = lines[i].strip()
|
||||
if just_consumed.rstrip("\n").rstrip().endswith("\\"):
|
||||
just_consumed = lines[i]
|
||||
i += 1
|
||||
continue
|
||||
if nxt_strip.startswith("&&") and (" cd " in nxt_strip or nxt_strip.startswith("&&\\")):
|
||||
just_consumed = lines[i]
|
||||
i += 1
|
||||
continue
|
||||
break
|
||||
continue
|
||||
out.append(line)
|
||||
i += 1
|
||||
|
||||
recipe_path.write_text("".join(out))
|
||||
PY
|
||||
|
||||
n_after=$(grep -c "sed -i" "$recipe" 2>/dev/null || true)
|
||||
n_backslash_orphans=$(grep -c "\\\\$" "$recipe" 2>/dev/null || true)
|
||||
if [ "$n_after" != "0" ]; then
|
||||
echo "FAIL: $name still has $n_after sed lines after cleanup"
|
||||
failed=$((failed+1))
|
||||
continue
|
||||
fi
|
||||
if [ "$n_backslash_orphans" -gt 0 ]; then
|
||||
echo "WARN: $name has $n_backslash_orphans trailing backslashes (may be ok)"
|
||||
fi
|
||||
|
||||
echo "CLEAN: $name ($n_sed sed lines removed)"
|
||||
cleaned=$((cleaned+1))
|
||||
done
|
||||
|
||||
echo
|
||||
echo "=== Summary ==="
|
||||
echo "Cleaned: $cleaned"
|
||||
echo "Skipped: $skipped"
|
||||
echo "Failed: $failed"
|
||||
Reference in New Issue
Block a user