commit:     c8a52e17017058394ea35394ebfae0e049c8779c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 20 19:48:43 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jun 20 20:21:29 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c8a52e17

Fix exposing evaluated PROPERTIES & RESTRICT in EAPI 8

Reorder the code to prevent eclass PROPERTIES & RESTRICT logic from
overriding the processed values gotten from PORTAGE_PROPERTIES
and PORTAGE_RESTRICT.  Otherwise, code in Portage misbehaves due to
unexpected USE-conditionals in PROPERTIES/RESTRICT.

Bug: https://bugs.gentoo.org/796959
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/733
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/ebuild.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 2c3b985a9..904fdf54e 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -653,13 +653,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
                        shopt -u failglob
                fi
 
-               if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
-                       PROPERTIES=${PORTAGE_PROPERTIES}
-                       RESTRICT=${PORTAGE_RESTRICT}
-                       [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \
-                       rm "$PORTAGE_BUILDDIR/.ebuild_changed"
-               fi
-
                [ "${EAPI+set}" = set ] || EAPI=0
 
                # export EAPI for helpers (especially since we unset it above)
@@ -688,6 +681,13 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
                unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND
                unset E_BDEPEND E_PROPERTIES E_RESTRICT __INHERITED_QA_CACHE
 
+               if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
+                       PROPERTIES=${PORTAGE_PROPERTIES}
+                       RESTRICT=${PORTAGE_RESTRICT}
+                       [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \
+                       rm "$PORTAGE_BUILDDIR/.ebuild_changed"
+               fi
+
                # alphabetically ordered by $EBUILD_PHASE value
                case ${EAPI} in
                        0|1)

Reply via email to