[PATCH 3/3] qt-utils.eclass: Introduce qt_get_broot_binary()

Andreas Sturmlechner <[email protected]> Wed, 08 Jul 2026 21:50:53 +0200
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
--nextPartJOW7_osbRV6kPJJyto5asA
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"; protected-headers="v1"
From: Andreas Sturmlechner <[email protected]>
To: [email protected], [email protected]
Subject: [PATCH 3/3] qt-utils.eclass: Introduce qt_get_broot_binary()
Date: Wed, 08 Jul 2026 21:50:53 +0200
Message-ID: <[email protected]>
In-Reply-To: <[email protected]>
References: <[email protected]>
MIME-Version: 1.0

Signed-off-by: Andreas Sturmlechner <[email protected]>
---
 eclass/qt-utils.eclass | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/eclass/qt-utils.eclass b/eclass/qt-utils.eclass
index 871fccde77c9..49101deb18fc 100644
--- a/eclass/qt-utils.eclass
+++ b/eclass/qt-utils.eclass
@@ -18,7 +18,8 @@ if [[ -z ${_QT_UTILS_ECLASS} ]]; then
 _QT_UTILS_ECLASS=1
 
 case ${EAPI} in
-	8|9) ;;
+	8) inherit eapi9-pipestatus ;;
+	9) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
@@ -54,7 +55,12 @@ _qt_eapi9_banned_deprecated_func() {
 # @DESCRIPTION:
 # Checks parameters for validity.
 _qt_get_check_func_call() {
-	[[ -z ${1} ]] && die "${FUNCNAME[1]}: must be passed exactly one argument"
+	case ${FUNCNAME[1]} in
+		qt_get_broot_binary)
+			[[ -z ${2} ]] && die "${FUNCNAME[1]}: must be passed exactly two arguments" ;;
+		*)
+			[[ -z ${1} ]] && die "${FUNCNAME[1]}: must be passed exactly one argument" ;;
+	esac
 	case "${1}" in
 		6) ;;
 		*) die "${FUNCNAME[1]}: Qt ${1} is not supported" ;;
@@ -80,6 +86,20 @@ qt_get_bindir() {
 	echo "$(qt_get_archdatadir 6)/bin"
 }
 
+# @FUNCTION: qt_get_broot_binary
+# @USAGE: <qt_maj_ver> <binary name>
+# @DESCRIPTION:
+# Echoes the BROOT prefixed path to a specific Qt binary, regardless whether
+# located in bindir or libexecdir.
+qt_get_broot_binary() {
+	_qt_get_check_func_call "$@"
+	local binpath=$(
+		PATH="$(qt_get_archdatadir 6)/libexec:$(qt_get_archdatadir 6)/bin" type -P "${2}" | head -n 1
+		pipestatus || die "${FUNCNAME[0]}: failed trying to detect binary: ${2}"
+	)
+	echo "${BROOT}${binpath}"
+}
+
 # @FUNCTION: qt_get_headerdir
 # @USAGE: <qt_maj_ver>
 # @DESCRIPTION:
-- 
2.55.0


--nextPartJOW7_osbRV6kPJJyto5asA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit

-----BEGIN PGP SIGNATURE-----

iQIvBAABCgCZFiEE34gXUSooizdYNDu3S5FW4z0PgBkFAmpOqh0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRERjg4MTc1MTJBMjg4QjM3NTgzNDNC
Qjc0QjkxNTZFMzNEMEY4MDE5AAoJEEuRVuM9D4AZbOQL/2PbPsV8xdrHjPXk1Yjc
/4bQP44rxEKd2zpnmKjCYTuyHt8cWMC9fQJrOCSBSxzA0aHT9anFNOhfd+3E6EvX
3Zng0f7Vv2WWZNppA57A6TxJJuUHSdq2VnGmnb8gLUmsDXsQcizdA3Gyx+fL9Cq6
y9opKBGg8N3Cg3CeNVwUUMhYva6b1A7LkZVUn1KR65N8oWJZ5JFpvuyHz1B9mdsK
m6nvj58dgmY2KAs4rkR27HQRxwAQLm7ZkQqfgVWc834qWaReruuJ48IG6C96fbo9
OWahM4crwFZ+c06vEuuF4nnKEPZGao6vG95lDQ5IzGfpGg9FUKvqJRm5wdka2JAX
f2AMNF94dM+TVnWskChzTAjO3HS53E8P8w7uplfRGvjBTziS5rNm7TVg7DeELbzz
gfgf2PR6fJ5DMTCDvttQn1BwJdgIKcjPE8znpXV/aQwPWPS7KFh3KySoCzQibBnz
gpT1UZO6tDO5E/y/t+HthP3/2CQWCwgmKv3e+CjOhaTVOA==
=x7pN
-----END PGP SIGNATURE-----

--nextPartJOW7_osbRV6kPJJyto5asA--