Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH eapi6-pt2 v3 5/5] Do not export PORTDIR & ECLASSDIR in EAPI 7
Date: Sun, 11 Mar 2018 09:18:01
Message-Id: 20180311091731.9062-5-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH eapi6-pt2 v3 1/5] Allow package.*, use.* directories in EAPI 7 by "Michał Górny"
1 Bug: https://bugs.gentoo.org/373349
2 Bug: https://bugs.gentoo.org/373351
3 ---
4 bin/eapi.sh | 4 ++++
5 bin/phase-functions.sh | 6 ++++--
6 pym/portage/eapi.py | 11 +++++++++++
7 pym/portage/package/ebuild/config.py | 5 +++++
8 pym/portage/package/ebuild/doebuild.py | 8 ++++----
9 5 files changed, 28 insertions(+), 6 deletions(-)
10
11 diff --git a/bin/eapi.sh b/bin/eapi.sh
12 index 569b8a0de..665b6f13e 100644
13 --- a/bin/eapi.sh
14 +++ b/bin/eapi.sh
15 @@ -38,6 +38,10 @@ ___eapi_has_RDEPEND_DEPEND_fallback() {
16 [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
17 }
18
19 +___eapi_has_PORTDIR_ECLASSDIR() {
20 + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6)$ ]]
21 +}
22 +
23 # HELPERS PRESENCE
24
25 ___eapi_has_dohard() {
26 diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
27 index d95012d6b..017dc132b 100644
28 --- a/bin/phase-functions.sh
29 +++ b/bin/phase-functions.sh
30 @@ -12,7 +12,7 @@ PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
31 PDEPEND PROVIDE RDEPEND REPOSITORY RESTRICT SLOT SRC_URI"
32
33 PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
34 - EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \
35 + EBUILD_SH_ARGS EMERGE_FROM FILESDIR MERGE_TYPE \
36 PM_EBUILD_HOOK_DIR \
37 PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
38 PORTAGE_BINPKG_FILE PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE \
39 @@ -30,7 +30,6 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
40 PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
41 PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
42 PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \
43 - PORTDIR \
44 REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
45 __PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS"
46
47 @@ -106,6 +105,9 @@ __filter_readonly_variables() {
48 if ___eapi_has_prefix_variables; then
49 filtered_vars+=" ED EPREFIX EROOT"
50 fi
51 + if ___eapi_has_PORTDIR_ECLASSDIR; then
52 + filtered_vars+=" PORTDIR ECLASSDIR"
53 + fi
54
55 if has --filter-sandbox $* ; then
56 filtered_vars="${filtered_vars} SANDBOX_.*"
57 diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
58 index 092780ded..5613fb5d2 100644
59 --- a/pym/portage/eapi.py
60 +++ b/pym/portage/eapi.py
61 @@ -47,6 +47,14 @@ def eapi_exports_replace_vars(eapi):
62 def eapi_exports_EBUILD_PHASE_FUNC(eapi):
63 return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi")
64
65 +def eapi_exports_PORTDIR(eapi):
66 + return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
67 + "5", "5-progress", "6")
68 +
69 +def eapi_exports_ECLASSDIR(eapi):
70 + return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
71 + "5", "5-progress", "6")
72 +
73 def eapi_exports_REPOSITORY(eapi):
74 return eapi in ("4-python", "5-progress")
75
76 @@ -105,6 +113,7 @@ def eapi_empty_groups_always_true(eapi):
77
78 _eapi_attrs = collections.namedtuple('_eapi_attrs',
79 'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
80 + 'exports_PORTDIR exports_ECLASSDIR '
81 'feature_flag_test feature_flag_targetroot '
82 'hdepend iuse_defaults iuse_effective posixish_locale '
83 'repo_deps required_use required_use_at_most_one_of slot_operator slot_deps '
84 @@ -134,6 +143,8 @@ def _get_eapi_attrs(eapi):
85 dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)),
86 empty_groups_always_true = (eapi is not None and eapi_empty_groups_always_true(eapi)),
87 exports_EBUILD_PHASE_FUNC = (eapi is None or eapi_exports_EBUILD_PHASE_FUNC(eapi)),
88 + exports_PORTDIR = (eapi is not None and eapi_exports_PORTDIR(eapi)),
89 + exports_ECLASSDIR = (eapi is not None and eapi_exports_ECLASSDIR(eapi)),
90 feature_flag_test = True,
91 feature_flag_targetroot = (eapi is not None and eapi_has_targetroot(eapi)),
92 hdepend = (eapi is not None and eapi_has_hdepend(eapi)),
93 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
94 index 432520ba8..10250cf46 100644
95 --- a/pym/portage/package/ebuild/config.py
96 +++ b/pym/portage/package/ebuild/config.py
97 @@ -2799,6 +2799,11 @@ class config(object):
98 else:
99 raise AssertionError("C locale did not pass the test!")
100
101 + if not eapi_attrs.exports_PORTDIR:
102 + mydict.pop("PORTDIR", None)
103 + if not eapi_attrs.exports_ECLASSDIR:
104 + mydict.pop("ECLASSDIR", None)
105 +
106 try:
107 builddir = mydict["PORTAGE_BUILDDIR"]
108 distdir = mydict["DISTDIR"]
109 diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
110 index 8c8f373bf..ca241aefb 100644
111 --- a/pym/portage/package/ebuild/doebuild.py
112 +++ b/pym/portage/package/ebuild/doebuild.py
113 @@ -57,10 +57,10 @@ from portage.data import portage_gid, portage_uid, secpass, \
114 from portage.dbapi.porttree import _parse_uri_map
115 from portage.dep import Atom, check_required_use, \
116 human_readable_required_use, paren_enclose, use_reduce
117 -from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \
118 - eapi_exports_replace_vars, eapi_exports_REPOSITORY, \
119 - eapi_has_required_use, eapi_has_src_prepare_and_src_configure, \
120 - eapi_has_pkg_pretend, _get_eapi_attrs
121 +from portage.eapi import (eapi_exports_KV, eapi_exports_merge_type,
122 + eapi_exports_replace_vars, eapi_exports_REPOSITORY,
123 + eapi_has_required_use, eapi_has_src_prepare_and_src_configure,
124 + eapi_has_pkg_pretend, _get_eapi_attrs)
125 from portage.elog import elog_process, _preload_elog_modules
126 from portage.elog.messages import eerror, eqawarn
127 from portage.exception import (DigestException, FileNotFound,
128 --
129 2.16.2