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

Ionen Wolkens <[email protected]> Mon, 13 Jul 2026 19:09:09 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <alVwFYZbJmqEjq2c@eversor>
--ZdPiamEO6SpNVzrW
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 13, 2026 at 06:39:14PM -0400, Ionen Wolkens wrote:
> On Mon, Jul 13, 2026 at 11:16:58PM +0100, James Le Cuirot wrote:
> > 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 <bi=
nary>' 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 validit=
y.
> > >  _qt_get_check_func_call() {
> > > -	[[ $# -ne 1 ]] && die "${FUNCNAME[1]}: must be passed exactly one a=
rgument"
> > > +	[[ ${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=
 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"
> > >  }
> > > =20
> > > +# @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=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}"
> >=20
> > I think "type -P" only ever returns one result unless you also specify =
-a.
>=20
> Huh, I wonder what gave me that impression... I'm the one that told

Actually figured out why, it's because of that time I did:

  type -P possible-name-1 possible-name-2 possible-name-3

Where it'll return all matches, and wanted to keep only the first match.
The impression kind of stuck with me I guess :)

> asturm about that (so my bad), but I normally don't check for multiple
> lines and should've known this already. Think I got confused with
> something else.
>=20
> I'll go ahead and swap these for a normal `die` myself without going
> through ML again.
>=20
> >=20
> > > +}
> > > +
> > >  # @FUNCTION: qt_get_headerdir
> > >  # @USAGE: <qt_maj_ver>
> > >  # @DESCRIPTION:
>=20
>=20
>=20
> --=20
> ionen



--=20
ionen

--ZdPiamEO6SpNVzrW
Content-Type: application/pgp-signature; name=signature.asc

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

iQFPBAABCAA5FiEEx3SLh1HBoPy/yLVYskQGsLCsQzQFAmpVcBUbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELJEBrCwrEM0R8EH/0f5dOTpcU5Exw22yFOU
XbCgOtdlBf0MtusNZvZtmFoLp26mscIG3Gj16dPLDiHX11YFlXYmKOOtb2qIaXtw
WIbGcvCERdQM9CJcAY+XAQpROeZzx2YiKT5CQI9wMJfwizWqPJ8aVDJPEgHRRueN
fwR0CtOrFl1T3DL+rNZ9LJqTVWtcYdaZ+lCOzQiWPfVFffqU1RgaMGWRl3zL9CiP
N3sfR78FlBqxFa/9902VX4XMSZnpujKZrrvKXXrRUioQXXhCno+3JgYzY49xEJw5
jR3OsITTqdr7dvGDVvs9V+HhQ/Cy09DvyO9KTPAmdBW5Oz0BytYNgfn4NSgPrMRi
S/M=
=/3yR
-----END PGP SIGNATURE-----

--ZdPiamEO6SpNVzrW--