commit:     67b745829deb9b52ba81bc4aa38316026699866d
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 12 23:08:35 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Dec 14 21:32:35 2024 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=67b74582

ecm.eclass: Unexporting phase functions run by xdg.eclass

Starts with consumers requesting >=KFMIN-6.9.0.

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 eclass/ecm.eclass | 57 ++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass
index d15cf81087..7c0ba85b03 100644
--- a/eclass/ecm.eclass
+++ b/eclass/ecm.eclass
@@ -46,17 +46,13 @@ fi
 # @DESCRIPTION:
 # By default, for all CATEGORIES except kde-frameworks, assume we are building
 # a GUI application. Add dependency on kde-frameworks/breeze-icons or
-# kde-frameworks/oxygen-icons and run the xdg.eclass routines for pkg_preinst,
-# pkg_postinst and pkg_postrm. If set to "true", do nothing.
+# kde-frameworks/oxygen-icons. With KFMIN lower than 6.9.0, inherit xdg.eclass,
+# run pkg_preinst, pkg_postinst and pkg_postrm. If set to "true", do nothing.
 : "${ECM_NONGUI:=false}"
 if [[ ${CATEGORY} == kde-frameworks ]]; then
        ECM_NONGUI=true
 fi
 
-if [[ ${ECM_NONGUI} = false ]] ; then
-       inherit xdg
-fi
-
 # @ECLASS_VARIABLE: ECM_KDEINSTALLDIRS
 # @DESCRIPTION:
 # Assume the package is using KDEInstallDirs macro and switch
@@ -180,6 +176,10 @@ if [[ ${CATEGORY} = kde-frameworks ]]; then
 fi
 : "${KFMIN:=5.116.0}"
 
+if ver_test ${KFMIN} -lt 6.9 && [[ ${ECM_NONGUI} == false ]]; then
+       inherit xdg
+fi
+
 # @ECLASS_VARIABLE: _KFSLOT
 # @INTERNAL
 # @DESCRIPTION:
@@ -759,46 +759,59 @@ ecm_src_install() {
        done
 }
 
+if [[ ${EAPI} == 8 ]]; then
+# @FUNCTION: _ecm_nongui_deprecated
+# @INTERNAL
+# @DESCRIPTION:
+# Carryall for ecm_pkg_preinst, ecm_pkg_postinst and ecm_pkg_postrm.
+_ecm_nongui_deprecated() {
+       if ver_test ${KFMIN} -ge 6.9; then
+               eqawarn "QA notice: ecm_pkg_${1} has become a no-op."
+               eqawarn "It is no longer being exported with KFMIN >=6.9.0."
+       else
+               case ${ECM_NONGUI} in
+                       false) xdg_pkg_${1} ;;
+                       *) ;;
+               esac
+       fi
+}
+
 # @FUNCTION: ecm_pkg_preinst
 # @DESCRIPTION:
 # Sets up environment variables required in ecm_pkg_postinst.
+# Phase function is only exported if KFMIN is <6.9.0.
 ecm_pkg_preinst() {
        debug-print-function ${FUNCNAME} "$@"
-
-       case ${ECM_NONGUI} in
-               false) xdg_pkg_preinst ;;
-               *) ;;
-       esac
+       _ecm_nongui_deprecated preinst
 }
 
 # @FUNCTION: ecm_pkg_postinst
 # @DESCRIPTION:
 # Updates the various XDG caches (icon, desktop, mime) if necessary.
+# Phase function is only exported if KFMIN is <6.9.0.
 ecm_pkg_postinst() {
        debug-print-function ${FUNCNAME} "$@"
-
-       case ${ECM_NONGUI} in
-               false) xdg_pkg_postinst ;;
-               *) ;;
-       esac
+       _ecm_nongui_deprecated postinst
 }
 
 # @FUNCTION: ecm_pkg_postrm
 # @DESCRIPTION:
 # Updates the various XDG caches (icon, desktop, mime) if necessary.
+# Phase function is only exported if KFMIN is <6.9.0.
 ecm_pkg_postrm() {
        debug-print-function ${FUNCNAME} "$@"
-
-       case ${ECM_NONGUI} in
-               false) xdg_pkg_postrm ;;
-               *) ;;
-       esac
+       _ecm_nongui_deprecated postrm
 }
+fi
+
+fi
 
+if ver_test ${KFMIN} -lt 6.9; then
+       EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
 fi
 
 if [[ -v ${KDE_GCC_MINIMAL} ]]; then
        EXPORT_FUNCTIONS pkg_pretend
 fi
 
-EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test src_install 
pkg_preinst pkg_postinst pkg_postrm
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test src_install

Reply via email to