Bug: https://bugs.gentoo.org/373349
Bug: https://bugs.gentoo.org/373351
---
 bin/eapi.sh                            |  4 ++++
 bin/phase-functions.sh                 |  6 ++++--
 pym/portage/eapi.py                    | 11 +++++++++++
 pym/portage/package/ebuild/config.py   |  5 +++++
 pym/portage/package/ebuild/doebuild.py |  8 ++++----
 5 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 569b8a0de..665b6f13e 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -38,6 +38,10 @@ ___eapi_has_RDEPEND_DEPEND_fallback() {
        [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }
 
+___eapi_has_PORTDIR_ECLASSDIR() {
+       [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6)$ ]]
+}
+
 # HELPERS PRESENCE
 
 ___eapi_has_dohard() {
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index d95012d6b..017dc132b 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -12,7 +12,7 @@ PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
        PDEPEND PROVIDE RDEPEND REPOSITORY RESTRICT SLOT SRC_URI"
 
 PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
-       EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \
+       EBUILD_SH_ARGS EMERGE_FROM FILESDIR MERGE_TYPE \
        PM_EBUILD_HOOK_DIR \
        PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC  \
        PORTAGE_BINPKG_FILE PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE \
@@ -30,7 +30,6 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE 
EBUILD_PHASE_FUNC \
        PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
        PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
        PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \
-       PORTDIR \
        REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
        __PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS"
 
@@ -106,6 +105,9 @@ __filter_readonly_variables() {
        if ___eapi_has_prefix_variables; then
                filtered_vars+=" ED EPREFIX EROOT"
        fi
+       if ___eapi_has_PORTDIR_ECLASSDIR; then
+               filtered_vars+=" PORTDIR ECLASSDIR"
+       fi
 
        if has --filter-sandbox $* ; then
                filtered_vars="${filtered_vars} SANDBOX_.*"
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index 092780ded..5613fb5d2 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -47,6 +47,14 @@ def eapi_exports_replace_vars(eapi):
 def eapi_exports_EBUILD_PHASE_FUNC(eapi):
        return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi")
 
+def eapi_exports_PORTDIR(eapi):
+       return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
+                       "5", "5-progress", "6")
+
+def eapi_exports_ECLASSDIR(eapi):
+       return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
+                       "5", "5-progress", "6")
+
 def eapi_exports_REPOSITORY(eapi):
        return eapi in ("4-python", "5-progress")
 
@@ -105,6 +113,7 @@ def eapi_empty_groups_always_true(eapi):
 
 _eapi_attrs = collections.namedtuple('_eapi_attrs',
        'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
+       'exports_PORTDIR exports_ECLASSDIR '
        'feature_flag_test feature_flag_targetroot '
        'hdepend iuse_defaults iuse_effective posixish_locale '
        'repo_deps required_use required_use_at_most_one_of slot_operator 
slot_deps '
@@ -134,6 +143,8 @@ def _get_eapi_attrs(eapi):
                dots_in_use_flags = (eapi is None or 
eapi_allows_dots_in_use_flags(eapi)),
                empty_groups_always_true = (eapi is not None and 
eapi_empty_groups_always_true(eapi)),
                exports_EBUILD_PHASE_FUNC = (eapi is None or 
eapi_exports_EBUILD_PHASE_FUNC(eapi)),
+               exports_PORTDIR = (eapi is not None and 
eapi_exports_PORTDIR(eapi)),
+               exports_ECLASSDIR = (eapi is not None and 
eapi_exports_ECLASSDIR(eapi)),
                feature_flag_test = True,
                feature_flag_targetroot = (eapi is not None and 
eapi_has_targetroot(eapi)),
                hdepend = (eapi is not None and eapi_has_hdepend(eapi)),
diff --git a/pym/portage/package/ebuild/config.py 
b/pym/portage/package/ebuild/config.py
index 432520ba8..10250cf46 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -2799,6 +2799,11 @@ class config(object):
                                else:
                                        raise AssertionError("C locale did not 
pass the test!")
 
+               if not eapi_attrs.exports_PORTDIR:
+                       mydict.pop("PORTDIR", None)
+               if not eapi_attrs.exports_ECLASSDIR:
+                       mydict.pop("ECLASSDIR", None)
+
                try:
                        builddir = mydict["PORTAGE_BUILDDIR"]
                        distdir = mydict["DISTDIR"]
diff --git a/pym/portage/package/ebuild/doebuild.py 
b/pym/portage/package/ebuild/doebuild.py
index 8c8f373bf..ca241aefb 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -57,10 +57,10 @@ from portage.data import portage_gid, portage_uid, secpass, 
\
 from portage.dbapi.porttree import _parse_uri_map
 from portage.dep import Atom, check_required_use, \
        human_readable_required_use, paren_enclose, use_reduce
-from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \
-       eapi_exports_replace_vars, eapi_exports_REPOSITORY, \
-       eapi_has_required_use, eapi_has_src_prepare_and_src_configure, \
-       eapi_has_pkg_pretend, _get_eapi_attrs
+from portage.eapi import (eapi_exports_KV, eapi_exports_merge_type,
+       eapi_exports_replace_vars, eapi_exports_REPOSITORY,
+       eapi_has_required_use, eapi_has_src_prepare_and_src_configure,
+       eapi_has_pkg_pretend, _get_eapi_attrs)
 from portage.elog import elog_process, _preload_elog_modules
 from portage.elog.messages import eerror, eqawarn
 from portage.exception import (DigestException, FileNotFound,
-- 
2.16.2


Reply via email to