[PATCH] doins: fix D check, add EPREFIX check

Fabian Groffen <[email protected]> Mon, 25 Jul 2022 17:11:19 +0200
Newsgroups gmane.linux.gentoo.portage.devel
Organization Gentoo Foundation, Inc.
Message-ID <[email protected]>
--iKAI+nlOw7fSn2VB
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

bin/ebuild-helpers/doins: fix D check, add EPREFIX check

ED =3D D/EPREFIX, so checking for ED includes EPREFIX, which when this is
absent fails to check for D.  Simply check for D instead, which catches
both the case for D and ED.

Add check for usage of EPREFIX, like for using D with helpers.

Signed-off-by: Fabian Groffen <[email protected]>

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 24fe48121..4315a038f 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -42,7 +42,7 @@ if ! ___eapi_has_prefix_variables; then
 	export ED=3D"${D}"
 fi
=20
-if [[ ${_E_INSDESTTREE_#${ED}} !=3D "${_E_INSDESTTREE_}" ]]; then
+if [[ ${_E_INSDESTTREE_#${D}} !=3D "${_E_INSDESTTREE_}" ]]; then
 	__vecho "-------------------------------------------------------" 1>&2
 	__vecho "You should not use \${D} or \${ED} with helpers." 1>&2
 	__vecho "  --> ${_E_INSDESTTREE_}" 1>&2
@@ -50,6 +51,16 @@ if [[ ${_E_INSDESTTREE_#${ED}} !=3D "${_E_INSDESTTREE_}"=
 ]]; then
 	__helpers_die "${helper} used with \${D} or \${ED}"
 	exit 1
 fi
+if [[ -n ${EPREFIX} && \
+		${_E_INSDESTTREE_#${EPREFIX}} !=3D "${_E_INSDESTTREE_}" ]];
+then
+	__vecho "-------------------------------------------------------" 1>&2
+	__vecho "You should not use \${EPREFIX} with helpers." 1>&2
+	__vecho "  --> ${_E_INSDESTTREE_}" 1>&2
+	__vecho "-------------------------------------------------------" 1>&2
+	__helpers_die "${helper} used with \${EPREFIX}"
+	exit 1
+fi
=20
 if ___eapi_doins_and_newins_preserve_symlinks; then
 	DOINS_ARGS+=3D( --preserve_symlinks )

--=20
Fabian Groffen
Gentoo on a different level

--iKAI+nlOw7fSn2VB
Content-Type: application/pgp-signature; name="signature.asc"

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

iQEzBAABCgAdFiEELUvHd/Gtp7LaU1vuzpXahU5EQpMFAmLespcACgkQzpXahU5E
QpOi5wgAhUJ0aTEuujg3aelkkcWO+cz4lh+6Db0ebVN64N+68SIGXgoaHwPh2ELt
XbEBrBF3NCgxVo3u3iAwN2wIT2tEvIXKvjwxboKDUjwWprpUAfIiOONf71YVJdo6
HZiGIbf/+TUKSGGxaUq3J6cvqkLn8tak6ogzFcPO4v2eOpHPGD8xwifC3D0YOobK
13cwBsU/F0IOUxLCElZcPP7jzVXLwyXkTjCE6MkdzrOJehkZdha5NYFM81ZPpld5
xOB3m2v/HWYNz4/SgPv6AxpQKFRP5KDbNSnjVWLP8Fweu+r2C3rJhoYM+HHTxTVT
ntdzMkN6A5qn0sjPSWamcTBRM/1lvA==
=p+7s
-----END PGP SIGNATURE-----

--iKAI+nlOw7fSn2VB--