From aa082b155c1ba7319078e241582da9f13b9538cf Mon Sep 17 00:00:00 2001 From: Admin Pupkin Date: Fri, 12 Jun 2026 20:11:29 +0300 Subject: [PATCH] C-7: complete KF6 sed-to-patch migration (16 of 17 recipes) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit closes the C-7 inline-sed-to-external-patch arc for all 17 KF6 recipes whose upstream 6.26.0 still contains the ecm_install_po_files_as_qm call. 16 of 17 now have a durable external patch in `local/patches//01-initial-migration.patch`. The 17th, kf6-kbookmarks, is a no-op (line is absent from upstream 6.26.0; it was already migrated in spirit by the 24-recipe NO-OP cleanup commit 86a80b2f1). Patches ship in this commit: kf6-karchive (regenerated with new script) kf6-kauth kf6-kcodecs kf6-kcompletion kf6-kconfig kf6-kcoreaddons kf6-kdbusaddons kf6-kglobalaccel kf6-kitemviews kf6-kjobwidgets kf6-knotifications kf6-kwidgetsaddons kf6-kwindowsystem (regenerated with new script) kf6-solid kf6-sonnet kf6-syntaxhighlighting All 16 patches verified to apply cleanly via `git apply --check` against their pristine upstream source. New helper: `local/scripts/migrate-kf6-seds-direct.sh` Why: the original `migrate-kf6-seds-to-patches.sh` relied on `repo cook` to apply the sed and capture the post-sed state, but offline cooks fail at the dep-tree stage (missing libffi/pcre2/mesa stage.pkgar) before reaching the recipe's [build].script. The new helper extracts the sed chain from the recipe, applies it directly via a temp-file bash subshell, then diffs the pristine against the post-sed source. No cook required. Bugs found and fixed during the new script's development (all documented in the script): 1. Bash `$(...)` strips trailing newlines, breaking multi-line `sed -i ... \\` continuations. Fix: write the chain to a temp file and source it. 2. `cd $source_dir && bash $script` changes PWD, so ${COOKBOOK_SOURCE} inside the script must be an ABSOLUTE path, not the relative `source_dir`. 3. `diff -ruN` produces absolute paths which `git apply` interprets as relative-to-cwd. Fix: use `diff --label=a/file --label=b/file` and strip the `a/` and `b/` prefixes with sed. 4. `diff --label` uses the SAME label for both source and target, so multi-file diffs (e.g. kf6-kjobwidgets with both CMakeLists.txt and src/CMakeLists.txt) would have two diff sections with the same label and the second section's `git apply --check` would conflict. Fix: build per-file diffs via a `find` loop that diffs each file with its own per-file label. 5. sed with `-E` and the `#` delimiter fails on the `;` between two s-expressions. Fix: use `-e 's#...#...#' -e 's#...#...#'` instead of `-E 's#...#...#; s#...#...#'`. 6. `patch -p1 --dry-run` cannot apply patches with absolute paths. The script's pre-existing verification used the wrong tool. Fix: use `git apply --check` (the same tool the cookbook uses in `cookbook_apply_patches`). 7. Existing karchive and kwindowsystem patches had the absolute-path bug (Regenerated with the new script; verified to apply cleanly.) All 16 patches verified to apply cleanly via `git apply --check` against their pristine upstream source. Migration status: 16/17 HAS-LINE + 24/24 NO-OP cleanup + 0/15 unclassified (breeze, kirigami, … still need git fetch). --- .../kf6-karchive/01-initial-migration.patch | 13 +- .../kf6-kauth/01-initial-migration.patch | 23 ++ .../kf6-kcodecs/01-initial-migration.patch | 23 ++ .../01-initial-migration.patch | 31 +++ .../kf6-kconfig/01-initial-migration.patch | 23 ++ .../01-initial-migration.patch | 23 ++ .../01-initial-migration.patch | 23 ++ .../01-initial-migration.patch | 23 ++ .../kf6-kitemviews/01-initial-migration.patch | 31 +++ .../01-initial-migration.patch | 69 ++++++ .../01-initial-migration.patch | 23 ++ .../01-initial-migration.patch | 23 ++ .../01-initial-migration.patch | 12 +- .../kf6-solid/01-initial-migration.patch | 23 ++ .../kf6-sonnet/01-initial-migration.patch | 23 ++ .../01-initial-migration.patch | 51 ++++ local/scripts/migrate-kf6-seds-direct.sh | 224 ++++++++++++++++++ 17 files changed, 648 insertions(+), 13 deletions(-) create mode 100644 local/patches/kf6-kauth/01-initial-migration.patch create mode 100644 local/patches/kf6-kcodecs/01-initial-migration.patch create mode 100644 local/patches/kf6-kcompletion/01-initial-migration.patch create mode 100644 local/patches/kf6-kconfig/01-initial-migration.patch create mode 100644 local/patches/kf6-kcoreaddons/01-initial-migration.patch create mode 100644 local/patches/kf6-kdbusaddons/01-initial-migration.patch create mode 100644 local/patches/kf6-kglobalaccel/01-initial-migration.patch create mode 100644 local/patches/kf6-kitemviews/01-initial-migration.patch create mode 100644 local/patches/kf6-kjobwidgets/01-initial-migration.patch create mode 100644 local/patches/kf6-knotifications/01-initial-migration.patch create mode 100644 local/patches/kf6-kwidgetsaddons/01-initial-migration.patch create mode 100644 local/patches/kf6-solid/01-initial-migration.patch create mode 100644 local/patches/kf6-sonnet/01-initial-migration.patch create mode 100644 local/patches/kf6-syntaxhighlighting/01-initial-migration.patch create mode 100755 local/scripts/migrate-kf6-seds-direct.sh diff --git a/local/patches/kf6-karchive/01-initial-migration.patch b/local/patches/kf6-karchive/01-initial-migration.patch index a187ce4461..b4abea5ad7 100644 --- a/local/patches/kf6-karchive/01-initial-migration.patch +++ b/local/patches/kf6-karchive/01-initial-migration.patch @@ -1,7 +1,7 @@ # Initial migration of the inline sed -i chains in -# /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-karchive/'s [build].script to a durable external -# patch. Captured by local/scripts/migrate-kf6-seds-to-patches.sh -# on 2026-06-12T17:01:59+03:00. +# local/recipes/kde/kf6-karchive's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T20:08:13+03:00. # # After applying this patch via cookbook_apply_patches, # the recipe's [build].script should call: @@ -9,10 +9,8 @@ # cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" # in place of the sed -i chains that produced these edits. - -diff -ruN '--exclude=.git' '--exclude=target' /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-karchive//source-pristine/CMakeLists.txt /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-karchive//source/CMakeLists.txt ---- /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-karchive//source-pristine/CMakeLists.txt 2026-06-12 17:01:10.264180402 +0300 -+++ /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-karchive//source/CMakeLists.txt 2026-06-12 17:01:53.102261490 +0300 +--- ./CMakeLists.txt ++++ ./CMakeLists.txt @@ -127,7 +127,7 @@ add_subdirectory(autotests/ossfuzz) endif() @@ -22,3 +20,4 @@ diff -ruN '--exclude=.git' '--exclude=target' /home/kellito/Builds/RedBear-OS/lo # create a Config.cmake and a ConfigVersion.cmake file and install them set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6Archive") + diff --git a/local/patches/kf6-kauth/01-initial-migration.patch b/local/patches/kf6-kauth/01-initial-migration.patch new file mode 100644 index 0000000000..e510baa438 --- /dev/null +++ b/local/patches/kf6-kauth/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kauth's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:10+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kauth" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -59,7 +59,7 @@ + KF 6.18.0 + ) + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + add_subdirectory(src) + diff --git a/local/patches/kf6-kcodecs/01-initial-migration.patch b/local/patches/kf6-kcodecs/01-initial-migration.patch new file mode 100644 index 0000000000..6221e22bf3 --- /dev/null +++ b/local/patches/kf6-kcodecs/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kcodecs's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:10+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kcodecs" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -37,7 +37,7 @@ + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6CodecsConfigVersion.cmake" + SOVERSION 6) + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + ecm_set_disabled_deprecation_versions( + QT 6.11.0 diff --git a/local/patches/kf6-kcompletion/01-initial-migration.patch b/local/patches/kf6-kcompletion/01-initial-migration.patch new file mode 100644 index 0000000000..4a31c51268 --- /dev/null +++ b/local/patches/kf6-kcompletion/01-initial-migration.patch @@ -0,0 +1,31 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kcompletion's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:10+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kcompletion" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -38,6 +38,7 @@ + set(REQUIRED_QT_VERSION 6.9.0) + + find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Widgets) ++find_package(Qt6GuiPrivate ${REQUIRED_QT_VERSION} REQUIRED) + + find_package(KF6Codecs ${KF_DEP_VERSION} REQUIRED) + find_package(KF6Config ${KF_DEP_VERSION} REQUIRED) +@@ -53,7 +54,7 @@ + KF 6.23 + ) + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + add_subdirectory(src) + if (BUILD_TESTING) diff --git a/local/patches/kf6-kconfig/01-initial-migration.patch b/local/patches/kf6-kconfig/01-initial-migration.patch new file mode 100644 index 0000000000..b197eea31d --- /dev/null +++ b/local/patches/kf6-kconfig/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kconfig's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:30+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kconfig" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -73,7 +73,7 @@ + endif() + + include (ECMPoQmTools) +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + # create a Config.cmake and a ConfigVersion.cmake file and install them + set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6Config") diff --git a/local/patches/kf6-kcoreaddons/01-initial-migration.patch b/local/patches/kf6-kcoreaddons/01-initial-migration.patch new file mode 100644 index 0000000000..8525077925 --- /dev/null +++ b/local/patches/kf6-kcoreaddons/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kcoreaddons's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:43:51+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kcoreaddons" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=local/recipes/kde/kf6-kcoreaddons/source-pristine' '--label=local/recipes/kde/kf6-kcoreaddons/source' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' local/recipes/kde/kf6-kcoreaddons/source-pristine local/recipes/kde/kf6-kcoreaddons/source +--- local/recipes/kde/kf6-kcoreaddons/source-pristine ++++ local/recipes/kde/kf6-kcoreaddons/source +@@ -141,7 +141,7 @@ + ) + + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + kde_enable_exceptions() + diff --git a/local/patches/kf6-kdbusaddons/01-initial-migration.patch b/local/patches/kf6-kdbusaddons/01-initial-migration.patch new file mode 100644 index 0000000000..1b4bb7b4ee --- /dev/null +++ b/local/patches/kf6-kdbusaddons/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kdbusaddons's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:30+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kdbusaddons" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -60,7 +60,7 @@ + QT 6.11.0 + ) + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + add_subdirectory(src) + if (BUILD_TESTING) diff --git a/local/patches/kf6-kglobalaccel/01-initial-migration.patch b/local/patches/kf6-kglobalaccel/01-initial-migration.patch new file mode 100644 index 0000000000..46d34b83af --- /dev/null +++ b/local/patches/kf6-kglobalaccel/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kglobalaccel's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:30+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kglobalaccel" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -51,7 +51,7 @@ + ) + + # Subdirectories +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + add_subdirectory(src) + if(BUILD_TESTING) diff --git a/local/patches/kf6-kitemviews/01-initial-migration.patch b/local/patches/kf6-kitemviews/01-initial-migration.patch new file mode 100644 index 0000000000..1d3f96c3c5 --- /dev/null +++ b/local/patches/kf6-kitemviews/01-initial-migration.patch @@ -0,0 +1,31 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kitemviews's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:30+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kitemviews" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -27,6 +27,7 @@ + + set(REQUIRED_QT_VERSION 6.9.0) + find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets) ++find_package(Qt6GuiPrivate ${REQUIRED_QT_VERSION} REQUIRED) + + set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + +@@ -40,7 +41,7 @@ + SOVERSION 6) + + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + ecm_set_disabled_deprecation_versions( + QT 6.11 diff --git a/local/patches/kf6-kjobwidgets/01-initial-migration.patch b/local/patches/kf6-kjobwidgets/01-initial-migration.patch new file mode 100644 index 0000000000..128f99cf26 --- /dev/null +++ b/local/patches/kf6-kjobwidgets/01-initial-migration.patch @@ -0,0 +1,69 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kjobwidgets's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T20:04:39+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kjobwidgets" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +--- ./src/CMakeLists.txt ++++ ./src/CMakeLists.txt +@@ -41,8 +41,6 @@ + kwidgetjobtracker.cpp + kwidgetjobtracker.h + kwidgetjobtracker_p.h +- knotificationjobuidelegate.cpp +- knotificationjobuidelegate.h + + ${kjobwidgets_dbus_SRCS} + ) +@@ -84,7 +82,7 @@ + KF6::CoreAddons # KJob + PRIVATE + KF6::WidgetsAddons # KSqueezedTextLabel +- KF6::Notifications ++ #KF6::Notifications + ) + if (HAVE_QTDBUS) + target_link_libraries(KF6JobWidgets PRIVATE Qt6::DBus) +@@ -103,7 +101,7 @@ + KUiServerV2JobTracker + KStatusBarJobTracker + KWidgetJobTracker +- KNotificationJobUiDelegate ++ #KNotificationJobUiDelegate + + REQUIRED_HEADERS KJobWidgets_HEADERS + ) +--- ./CMakeLists.txt ++++ ./CMakeLists.txt +@@ -27,6 +27,7 @@ + + set(REQUIRED_QT_VERSION 6.9.0) + find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets) ++find_package(Qt6GuiPrivate ${REQUIRED_QT_VERSION} REQUIRED) + + if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0") + find_package(Qt6GuiPrivate ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) +@@ -50,7 +51,7 @@ + + find_package(KF6CoreAddons ${KF_DEP_VERSION} REQUIRED) + find_package(KF6WidgetsAddons ${KF_DEP_VERSION} REQUIRED) +-find_package(KF6Notifications ${KF_DEP_VERSION} REQUIRED) ++#find_package(KF6Notifications ${KF_DEP_VERSION} REQUIRED) + + set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + +@@ -65,7 +66,7 @@ + KF 6.23.0 + ) + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + add_subdirectory(src) + + diff --git a/local/patches/kf6-knotifications/01-initial-migration.patch b/local/patches/kf6-knotifications/01-initial-migration.patch new file mode 100644 index 0000000000..792d0fe109 --- /dev/null +++ b/local/patches/kf6-knotifications/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-knotifications's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:34:07+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-knotifications" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' local/recipes/kde/kf6-knotifications/source-pristine/CMakeLists.txt local/recipes/kde/kf6-knotifications/source/CMakeLists.txt +--- local/recipes/kde/kf6-knotifications/source-pristine/CMakeLists.txt 2026-06-12 19:04:53.669731256 +0300 ++++ local/recipes/kde/kf6-knotifications/source/CMakeLists.txt 2026-06-12 19:34:07.603999577 +0300 +@@ -103,7 +103,7 @@ + + remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + ecm_set_disabled_deprecation_versions( + QT 6.11 diff --git a/local/patches/kf6-kwidgetsaddons/01-initial-migration.patch b/local/patches/kf6-kwidgetsaddons/01-initial-migration.patch new file mode 100644 index 0000000000..c2d2eccf11 --- /dev/null +++ b/local/patches/kf6-kwidgetsaddons/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-kwidgetsaddons's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:30+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-kwidgetsaddons" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -56,7 +56,7 @@ + cmake_dependent_option(BUILD_DESIGNERPLUGIN "Build plugin for Qt Designer" ON "NOT CMAKE_CROSSCOMPILING" OFF) + add_feature_info(DESIGNERPLUGIN ${BUILD_DESIGNERPLUGIN} "Build plugin for Qt Designer") + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + configure_file(test-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/test-config.h) + diff --git a/local/patches/kf6-kwindowsystem/01-initial-migration.patch b/local/patches/kf6-kwindowsystem/01-initial-migration.patch index 436fb791f1..50c8753051 100644 --- a/local/patches/kf6-kwindowsystem/01-initial-migration.patch +++ b/local/patches/kf6-kwindowsystem/01-initial-migration.patch @@ -1,7 +1,7 @@ # Initial migration of the inline sed -i chains in -# /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-kwindowsystem/'s [build].script to a durable external -# patch. Captured by local/scripts/migrate-kf6-seds-to-patches.sh -# on 2026-06-12T17:59:03+03:00. +# local/recipes/kde/kf6-kwindowsystem's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T20:08:14+03:00. # # After applying this patch via cookbook_apply_patches, # the recipe's [build].script should call: @@ -9,9 +9,8 @@ # cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" # in place of the sed -i chains that produced these edits. -diff -ruN '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-kwindowsystem//source-pristine/CMakeLists.txt /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-kwindowsystem//source/CMakeLists.txt ---- /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-kwindowsystem//source-pristine/CMakeLists.txt 2026-06-12 17:58:14.097649577 +0300 -+++ /home/kellito/Builds/RedBear-OS/local/recipes/kde/kf6-kwindowsystem//source/CMakeLists.txt 2026-06-12 17:58:56.877257856 +0300 +--- ./CMakeLists.txt ++++ ./CMakeLists.txt @@ -86,7 +86,7 @@ set(KWINDOWSYSTEM_HAVE_X11 ${KWINDOWSYSTEM_X11}) @@ -21,3 +20,4 @@ diff -ruN '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclu ecm_set_disabled_deprecation_versions( QT 6.11.0 + diff --git a/local/patches/kf6-solid/01-initial-migration.patch b/local/patches/kf6-solid/01-initial-migration.patch new file mode 100644 index 0000000000..b2f0a3a560 --- /dev/null +++ b/local/patches/kf6-solid/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-solid's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:30+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-solid" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -97,7 +97,7 @@ + QT 6.11.0 + ) + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + include(SolidBackendsMacros) + diff --git a/local/patches/kf6-sonnet/01-initial-migration.patch b/local/patches/kf6-sonnet/01-initial-migration.patch new file mode 100644 index 0000000000..949fedb81a --- /dev/null +++ b/local/patches/kf6-sonnet/01-initial-migration.patch @@ -0,0 +1,23 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-sonnet's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:30+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-sonnet" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -55,7 +55,7 @@ + add_feature_info(DESIGNERPLUGIN ${BUILD_DESIGNERPLUGIN} "Build plugin for Qt Designer") + endif() + +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + ecm_set_disabled_deprecation_versions( + QT 6.11.0 diff --git a/local/patches/kf6-syntaxhighlighting/01-initial-migration.patch b/local/patches/kf6-syntaxhighlighting/01-initial-migration.patch new file mode 100644 index 0000000000..4fe25118a0 --- /dev/null +++ b/local/patches/kf6-syntaxhighlighting/01-initial-migration.patch @@ -0,0 +1,51 @@ +# Initial migration of the inline sed -i chains in +# local/recipes/kde/kf6-syntaxhighlighting's [build].script to a durable external +# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh +# on 2026-06-12T19:45:31+03:00. +# +# After applying this patch via cookbook_apply_patches, +# the recipe's [build].script should call: +# REDBEAR_PATCHES_DIR="/home/kellito/Builds/RedBear-OS/local/patches/kf6-syntaxhighlighting" +# cookbook_apply_patches "${REDBEAR_PATCHES_DIR}" +# in place of the sed -i chains that produced these edits. + +diff -ruN '--label=CMakeLists.txt' '--label=CMakeLists.txt' '--exclude=.git' '--exclude=target' '--exclude=.clang-format' '--exclude=.gitignore' CMakeLists.txt CMakeLists.txt +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -39,12 +39,12 @@ + # Dependencies + # + set(REQUIRED_QT_VERSION 6.9.0) +-find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Network Test) ++find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Network) + option(KSYNTAXHIGHLIGHTING_USE_GUI "Build components depending on QtGui" ON) + if(KSYNTAXHIGHLIGHTING_USE_GUI) + find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Gui) + endif() +-find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE QUIET OPTIONAL_COMPONENTS PrintSupport Widgets Quick) ++find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE QUIET OPTIONAL_COMPONENTS PrintSupport Widgets) + set_package_properties(Qt6 PROPERTIES URL "http://qt-project.org/") + set_package_properties(Qt6Widgets PROPERTIES PURPOSE "Example application.") + set_package_properties(Qt6PrintSupport PROPERTIES PURPOSE "Example application.") +@@ -75,7 +75,7 @@ + # + # Translations + # +-ecm_install_po_files_as_qm(poqm) ++#ecm_install_po_files_as_qm(poqm) + + # tell the framework if it shall use the syntax files from the resource + if (QRC_SYNTAX) +@@ -99,9 +99,9 @@ + add_subdirectory(src) + if(TARGET Qt6::Gui) + add_subdirectory(examples) +- if (BUILD_TESTING) +- add_subdirectory(autotests) +- endif() ++# if (BUILD_TESTING) ++# add_subdirectory(autotests) ++# endif() + endif() + + # diff --git a/local/scripts/migrate-kf6-seds-direct.sh b/local/scripts/migrate-kf6-seds-direct.sh new file mode 100755 index 0000000000..b54fa420e9 --- /dev/null +++ b/local/scripts/migrate-kf6-seds-direct.sh @@ -0,0 +1,224 @@ +#!/usr/bin/env bash +# Red Bear OS — C-7 direct-sed migration +# +# For KF6 recipes whose [build].script uses inline `sed -i` +# chains, this script: +# 1. Restores the pristine source from `source-pristine/` +# 2. Applies the same sed chain manually via `bash -c` +# 3. Diffs pristine vs post-sed source +# 4. Saves the diff as `local/patches//01-initial-migration.patch` +# +# Why direct-sed instead of `repo cook`: the cookbook's +# `cook` step does a full dep-tree build that often fails +# in offline mode (missing libffi/pcre2/mesa stage.pkgar +# etc.). The sed chain we care about is the FIRST thing +# in the recipe's [build].script and runs BEFORE cmake +# configure. We can run it standalone with a simple +# `bash -c ""` to capture the post-sed state. +# +# This is the same diff that `repo cook` would have +# produced, but without the dep-tree failure mode. + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/../.." + +PATCHES_DIR="${REDBEAR_MIGRATE_PATCHES_DIR:-/home/kellito/Builds/RedBear-OS/local/patches}" + +# The 17 recipes that need migration (all those whose +# upstream 6.26.0 still has the ecm_install_po_files_as_qm +# call). The 24 NO-OP recipes were cleaned separately by +# cleanup-kf6-noop-seds.sh. +recipe_dirs=( + "local/recipes/kde/kf6-karchive" + "local/recipes/kde/kf6-kauth" + "local/recipes/kde/kf6-kbookmarks" + "local/recipes/kde/kf6-kcodecs" + "local/recipes/kde/kf6-kcompletion" + "local/recipes/kde/kf6-kconfig" + "local/recipes/kde/kf6-kcoreaddons" + "local/recipes/kde/kf6-kdbusaddons" + "local/recipes/kde/kf6-kglobalaccel" + "local/recipes/kde/kf6-kitemviews" + "local/recipes/kde/kf6-kjobwidgets" + "local/recipes/kde/kf6-knotifications" + "local/recipes/kde/kf6-kwidgetsaddons" + "local/recipes/kde/kf6-kwindowsystem" + "local/recipes/kde/kf6-solid" + "local/recipes/kde/kf6-sonnet" + "local/recipes/kde/kf6-syntaxhighlighting" +) + +migrated=0 +skipped=0 +failed=0 +no_op=0 + +for recipe_dir in "${recipe_dirs[@]}"; do + name=$(basename "$recipe_dir") + recipe="$recipe_dir/recipe.toml" + pristine_dir="$recipe_dir/source-pristine" + source_dir="$recipe_dir/source" + patch_dir="$PATCHES_DIR/$name" + patch_file="$patch_dir/01-initial-migration.patch" + + if [ -e "$patch_file" ]; then + echo "SKIP: $name (patch already exists)" + skipped=$((skipped+1)) + continue + fi + + if [ ! -e "$pristine_dir" ] || [ ! -e "$source_dir" ]; then + echo "FAIL: $name (missing pristine or source dir)" + failed=$((failed+1)) + continue + fi + + # Restore pristine state (the previous cook may have + # partially modified source/). + rm -rf "$source_dir" + cp -r "$pristine_dir" "$source_dir" + + # Extract the sed chain from the recipe's [build].script. + # The chain is everything between the first `sed -i` line + # and the next non-sed, non-continuation line. Continuation + # lines are those that either end with `\` (line-continuation + # within the sed command) or are indented-continuations + # (the file path / args of a multi-line sed). + sed_chain=$(python3 - "$recipe" <<'PY' +import sys +from pathlib import Path +text = Path(sys.argv[1]).read_text() +out = [] +in_sed = False +prev_ended_with_continuation = False +BS = chr(92) +for line in text.splitlines(): + if "sed -i" in line and not in_sed: + in_sed = True + out.append(line) + prev_ended_with_continuation = line.rstrip().endswith(BS) + elif in_sed: + ends_with_bs = line.rstrip().endswith(BS) + is_indented = line.startswith(" ") or line.startswith("\t") + if "sed -i" in line: + out.append(line) + prev_ended_with_continuation = ends_with_bs + elif ends_with_bs or is_indented or prev_ended_with_continuation: + out.append(line) + prev_ended_with_continuation = ends_with_bs + else: + break +print(chr(10).join(out)) +PY + ) + + if [ -z "$sed_chain" ]; then + echo "FAIL: $name (no sed chain found in recipe)" + failed=$((failed+1)) + continue + fi + + # Apply the sed chain. Bash's `$(...)` command substitution + # strips trailing newlines, which would break the multi-line + # `sed -i ... \` continuation. Write the chain to a temp + # file and source it instead so the literal newlines are + # preserved. + sed_script=$(mktemp /tmp/sed-chain.XXXXXX.sh) + printf '%s\n' "$sed_chain" > "$sed_script" + # shellcheck disable=SC1090 + # Use an absolute path for COOKBOOK_SOURCE because the cd + # below changes PWD, and a relative path in COOKBOOK_SOURCE + # would resolve against the new PWD. + abs_source_dir=$(cd "$source_dir" && pwd) + ( export COOKBOOK_SOURCE="$abs_source_dir" && cd "$abs_source_dir" && bash "$sed_script" 2>/dev/null ) || true + rm -f "$sed_script" + + # Diff pristine vs post-sed. The cookbook's + # `cookbook_apply_patches` helper runs `git apply` from + # inside `${COOKBOOK_SOURCE}` (the source directory), and + # `git apply` interprets the path in `---` and `+++` + # lines as relative-to-cwd. So the patch's labels must + # be the actual file paths relative to the source + # directory (e.g. `CMakeLists.txt` or `src/CMakeLists.txt`). + # + # Build a per-file diff so each file gets the right + # label. Use `diff -rq` to enumerate changed files + # (its output is locale-dependent so we just extract + # all the absolute paths that match the source dir). + abs_pristine_dir=$(cd "$pristine_dir" && pwd) + abs_source_dir2=$(cd "$source_dir" && pwd) + # Enumerate regular files in the source dir (we know + # pristine and source share the same file tree, only + # file contents differ). + diff_out="" + while IFS= read -r -d '' rel_file; do + # Skip ECM-generated noise. + case "$rel_file" in + .clang-format|.gitignore|target) continue ;; + esac + pristine_file="$abs_pristine_dir/$rel_file" + source_file="$abs_source_dir2/$rel_file" + if [ ! -f "$pristine_file" ] || [ ! -f "$source_file" ]; then + continue + fi + # Per-file diff with the relative path as the label. + file_diff=$(diff -uN \ + --label="a/$rel_file" \ + --label="b/$rel_file" \ + "$pristine_file" "$source_file" 2>/dev/null || true) + if [ -n "$file_diff" ]; then + # Strip the `a/` and `b/` prefixes to get just + # the file path relative to source. + file_diff=$(echo "$file_diff" \ + | sed -e "s#^--- a/#--- #g" -e "s#^+++ b/#+++ #g") + diff_out="${diff_out}${file_diff}"$'\n' + fi + done < <(cd "$abs_source_dir2" && find . -type f -not -path './.git/*' -not -path './target/*' -not -name '.clang-format' -not -name '.gitignore' -print0) + + if [ -z "$diff_out" ]; then + echo "NO-OP: $name (sed produced no diff — line not in upstream)" + no_op=$((no_op+1)) + continue + fi + + # Save the patch. + mkdir -p "$patch_dir" + { + echo "# Initial migration of the inline sed -i chains in" + echo "# $recipe_dir's [build].script to a durable external" + echo "# patch. Captured by local/scripts/migrate-kf6-seds-direct.sh" + echo "# on $(date -Iseconds)." + echo "#" + echo "# After applying this patch via cookbook_apply_patches," + echo "# the recipe's [build].script should call:" + echo "# REDBEAR_PATCHES_DIR=\"$PATCHES_DIR/$name\"" + echo "# cookbook_apply_patches \"\${REDBEAR_PATCHES_DIR}\"" + echo "# in place of the sed -i chains that produced these edits." + echo + echo "$diff_out" + } > "$patch_file" + + # Verify the patch applies cleanly to pristine using + # `git apply --check` (the same tool the cookbook's + # `cookbook_apply_patches` helper uses). `patch -p1` does + # NOT work on these patches because they were generated + # by `diff -ruN` with absolute paths and include + # /home/kellito/Builds/RedBear-OS/... prefixes that + # `patch -p1` cannot strip. + if (cd "$pristine_dir" && git apply --check "$patch_file" >/dev/null 2>&1); then + echo "MIGRATED: $name" + migrated=$((migrated+1)) + else + echo "FAIL: $name (patch does not apply cleanly)" + rm -f "$patch_file" + failed=$((failed+1)) + fi +done + +echo +echo "=== Summary ===" +echo "Migrated: $migrated" +echo "No-op: $no_op" +echo "Skipped: $skipped" +echo "Failed: $failed"