[PATCH v2 4/5] qt-utils.eclass: Introduce qt_get_broot_binary()

Andreas Sturmlechner <[email protected]> Sat, 11 Jul 2026 11:57:55 +0200
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
--nextPart5Ih8ClNVQ-yHEVsxQ7L3xw
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 v2 4/5] qt-utils.eclass: Introduce qt_get_broot_binary()
Date: Sat, 11 Jul 2026 11:57:55 +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 | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/eclass/qt-utils.eclass b/eclass/qt-utils.eclass
index ba425a9db777..588904446bf8 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
 
@@ -36,7 +37,7 @@ _qt_eapi9_banned_deprecated_func() {
 
 	case ${FUNCNAME[1]} in
 		qt6_get_bindir|qt6_get_libexecdir)
-			_deprecated_use_instead ${FUNCNAME[1]} "${FUNCNAME[1]/qt6/qt} 6"
+			_deprecated_use_instead ${FUNCNAME[1]} "qt_get_broot_binary 6 <binary>' or '${FUNCNAME[1]/qt6/qt} 6"
 			[[ ${FUNCNAME[1]} == qt6_get_bindir ]] &&
 				eqawarn "    IMPORTANT: qt_get_bindir no longer prepends EPREFIX," &&
 				eqawarn "               which likely was wrong to begin with."
@@ -55,7 +56,13 @@ _qt_eapi9_banned_deprecated_func() {
 # @DESCRIPTION:
 # Checks parameters of public, parent qt_get_* functions for validity.
 _qt_get_check_func_call() {
-	[[ $# -ne 1 ]] && die "${FUNCNAME[1]}: must be passed exactly one argument"
+	[[ ${FUNCNAME[2]} == qt_get_* ]] && return # don't check twice
+	case ${FUNCNAME[1]} in
+		qt_get_broot_binary)
+			[[ $# -ne 2 ]] && die "${FUNCNAME[1]}: must be passed exactly two arguments" ;;
+		*)
+			[[ $# -ne 1 ]] && die "${FUNCNAME[1]}: must be passed exactly one argument" ;;
+	esac
 	case ${1} in
 		6) ;;
 		*) die "${FUNCNAME[1]}: Qt ${1} is not supported" ;;
@@ -90,6 +97,18 @@ qt_get_bindir() {
 	echo "$(_qt_get_archdatadir "$@")/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 "$@"
+	PATH=${BROOT}$(qt_get_libexecdir ${1}):${BROOT}$(qt_get_bindir ${1}) \
+		type -P "${2}" | head -n 1
+	pipestatus || die "${FUNCNAME[0]}: failed trying to detect binary: ${2}"
+}
+
 # @FUNCTION: qt_get_headerdir
 # @USAGE: <qt_maj_ver>
 # @DESCRIPTION:
-- 
2.55.0


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

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

iQIvBAABCgCZFiEE34gXUSooizdYNDu3S5FW4z0PgBkFAmpSE6MbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRERjg4MTc1MTJBMjg4QjM3NTgzNDNC
Qjc0QjkxNTZFMzNEMEY4MDE5AAoJEEuRVuM9D4AZsdcL+wW49CvrnmcC1Eotl/06
vBjx4dNOqD7vbjLjoP/x+IOGSL8uZJaeES7enxRZ6Mm4zicPU2IOco88AjevdzyE
BLkcSMWqSEmU390t78/7t7h7MIhBSUZ+Q5pyJfY+svKhh4Pf+1SDuZ/GtSyp2hf3
SfiuB4Q1xaY+dF2AO+2gHErufztvXe3NWJebLO48stWi8n/UZgAm+9OovHbDgPam
9274W8D3UUl5AftyeTnqAmpGPy6VvpBrGLy6IUrltpSQCL6K5/K6T1qFgdBD8CW3
vCK5NLCDlJlqttU4WpWpxUnEjn0/6ax/fr7peSGDRDvh6TXOtuDgUMkZF3VYmqmM
MxvzxIDlksDpQdL1XkLdqJyIL/h8mqz1+tgshXMXj8qKnaM/o6BfNUavw4xVPivT
9WmCJb2307PMZLPRLFbLex1W/hNBCuH9t7svfa0BUUAT/4epyol5fy6hk9XBF7uf
scCl7BuPYFlPGxR49ct2PiHYRawt1J2nAb/oCigtmTqQaw==
=BJIY
-----END PGP SIGNATURE-----

--nextPart5Ih8ClNVQ-yHEVsxQ7L3xw--