commit:     adcabc001024f6398625145e99261f8e216c0e2e
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 26 18:36:29 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jul 27 19:04:48 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=adcabc00

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

ED = 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 <grobian <AT> gentoo.org>

 bin/ebuild-helpers/doins | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 6c6be31bb..a5fc224a9 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -42,7 +42,7 @@ if ! ___eapi_has_prefix_variables; then
        export ED="${D}"
 fi
 
-if [[ ${_E_INSDESTTREE_#${ED}} != "${_E_INSDESTTREE_}" ]]; then
+if [[ ${_E_INSDESTTREE_#${D}} != "${_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 +50,16 @@ if [[ ${_E_INSDESTTREE_#${ED}} != "${_E_INSDESTTREE_}" ]]; 
then
        __helpers_die "${helper} used with \${D} or \${ED}"
        exit 1
 fi
+if [[ -n ${EPREFIX} && \
+               ${_E_INSDESTTREE_#${EPREFIX}} != "${_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
 
 if ___eapi_doins_and_newins_preserve_symlinks; then
        DOINS_ARGS+=( --preserve_symlinks )

Reply via email to