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

James Le Cuirot <[email protected]> Mon, 13 Jul 2026 23:16:58 +0100
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
--=-nHaxUhIBxCCpGZHgfEMV
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sat, 2026-07-11 at 11:57 +0200, Andreas Sturmlechner wrote:
> Signed-off-by: Andreas Sturmlechner <[email protected]>
> ---
>  eclass/qt-utils.eclass | 25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
>=20
> 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=3D1
> =20
>  case ${EAPI} in
> -	8|9) ;;
> +	8) inherit eapi9-pipestatus ;;
> +	9) ;;
>  	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
>  esac
> =20
> @@ -36,7 +37,7 @@ _qt_eapi9_banned_deprecated_func() {
> =20
>  	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]} =3D=3D 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 argum=
ent"
> +	[[ ${FUNCNAME[2]} =3D=3D 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 arg=
uments" ;;
> +		*)
> +			[[ $# -ne 1 ]] && die "${FUNCNAME[1]}: must be passed exactly one arg=
ument" ;;
> +	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"
>  }
> =20
> +# @FUNCTION: qt_get_broot_binary
> +# @USAGE: <qt_maj_ver> <binary name>
> +# @DESCRIPTION:
> +# Echoes the BROOT prefixed path to a specific Qt binary, regardless whe=
ther
> +# located in bindir or libexecdir.
> +qt_get_broot_binary() {
> +	_qt_get_check_func_call "$@"
> +	PATH=3D${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}=
"

I think "type -P" only ever returns one result unless you also specify -a.

> +}
> +
>  # @FUNCTION: qt_get_headerdir
>  # @USAGE: <qt_maj_ver>
>  # @DESCRIPTION:

--=-nHaxUhIBxCCpGZHgfEMV
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

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

iQEDBAAWCgCrFiEE6qETVs4yu3Lfuc3XsNCJZ6jP87QFAmpVY9obFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFQUExMTM1NkNFMzJCQjcyREZCOUNE
RDdCMEQwODk2N0E4Q0ZGM0I0ERxjaGV3aUBnZW50b28ub3JnAAoJELDQiWeoz/O0
dVAA/RpAouMeF0YMdmhkEY0u/92suQaeIHSZTiRerlGBXgIUAPwL/qRwXgyVPbKK
yD/WHENXz7pRAyd68xdKx5FkVb0+Bw==
=K4FQ
-----END PGP SIGNATURE-----

--=-nHaxUhIBxCCpGZHgfEMV--