1 |
--- |
2 |
bin/ebuild.sh | 30 ++++++++++++++----- |
3 |
pym/_emerge/depgraph.py | 57 +++++++++++++++++++++--------------- |
4 |
pym/_emerge/main.py | 1 - |
5 |
pym/portage/__init__.py | 4 +-- |
6 |
pym/portage/dbapi/bintree.py | 6 ++-- |
7 |
pym/portage/dbapi/porttree.py | 2 +- |
8 |
pym/portage/dbapi/vartree.py | 1 + |
9 |
pym/portage/eapi.py | 9 +++++- |
10 |
pym/portage/package/ebuild/config.py | 14 +++++++-- |
11 |
9 files changed, 85 insertions(+), 39 deletions(-) |
12 |
|
13 |
diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
14 |
index 79da2b5..a376d2f 100755 |
15 |
--- a/bin/ebuild.sh |
16 |
+++ b/bin/ebuild.sh |
17 |
@@ -215,6 +215,7 @@ inherit() { |
18 |
local B_DEPEND |
19 |
local B_RDEPEND |
20 |
local B_PDEPEND |
21 |
+ local B_HDEPEND |
22 |
while [ "$1" ]; do |
23 |
location="${ECLASSDIR}/${1}.eclass" |
24 |
olocation="" |
25 |
@@ -257,20 +258,21 @@ inherit() { |
26 |
EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}" |
27 |
fi |
28 |
|
29 |
- #We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND |
30 |
+ #We need to back up the values of *DEPEND to B_*DEPEND |
31 |
#(if set).. and then restore them after the inherit call. |
32 |
|
33 |
#turn off glob expansion |
34 |
set -f |
35 |
|
36 |
# Retain the old data and restore it later. |
37 |
- unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND |
38 |
+ unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND B_HDEPEND |
39 |
[ "${IUSE+set}" = set ] && B_IUSE="${IUSE}" |
40 |
[ "${REQUIRED_USE+set}" = set ] && B_REQUIRED_USE="${REQUIRED_USE}" |
41 |
[ "${DEPEND+set}" = set ] && B_DEPEND="${DEPEND}" |
42 |
[ "${RDEPEND+set}" = set ] && B_RDEPEND="${RDEPEND}" |
43 |
[ "${PDEPEND+set}" = set ] && B_PDEPEND="${PDEPEND}" |
44 |
- unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND |
45 |
+ [ "${HDEPEND+set}" = set ] && B_HDEPEND="${HDEPEND}" |
46 |
+ unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND HDEPEND |
47 |
#turn on glob expansion |
48 |
set +f |
49 |
|
50 |
@@ -286,6 +288,7 @@ inherit() { |
51 |
[ "${DEPEND+set}" = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}" |
52 |
[ "${RDEPEND+set}" = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}" |
53 |
[ "${PDEPEND+set}" = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}" |
54 |
+ [ "${HDEPEND+set}" = set ] && E_HDEPEND+="${E_HDEPEND:+ }${HDEPEND}" |
55 |
|
56 |
[ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}" |
57 |
[ "${B_IUSE+set}" = set ] || unset IUSE |
58 |
@@ -302,6 +305,9 @@ inherit() { |
59 |
[ "${B_PDEPEND+set}" = set ] && PDEPEND="${B_PDEPEND}" |
60 |
[ "${B_PDEPEND+set}" = set ] || unset PDEPEND |
61 |
|
62 |
+ [ "${B_HDEPEND+set}" = set ] && HDEPEND="${B_HDEPEND}" |
63 |
+ [ "${B_HDEPEND+set}" = set ] || unset HDEPEND |
64 |
+ |
65 |
#turn on glob expansion |
66 |
set +f |
67 |
|
68 |
@@ -528,8 +534,9 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then |
69 |
# In order to ensure correct interaction between ebuilds and |
70 |
# eclasses, they need to be unset before this process of |
71 |
# interaction begins. |
72 |
- unset EAPI DEPEND RDEPEND PDEPEND INHERITED IUSE REQUIRED_USE \ |
73 |
- ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND |
74 |
+ unset EAPI DEPEND RDEPEND PDEPEND HDEPEND INHERITED IUSE REQUIRED_USE \ |
75 |
+ ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \ |
76 |
+ E_HDEPEND |
77 |
|
78 |
if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then |
79 |
source "$EBUILD" || die "error sourcing ebuild" |
80 |
@@ -560,9 +567,10 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then |
81 |
DEPEND+="${DEPEND:+ }${E_DEPEND}" |
82 |
RDEPEND+="${RDEPEND:+ }${E_RDEPEND}" |
83 |
PDEPEND+="${PDEPEND:+ }${E_PDEPEND}" |
84 |
+ HDEPEND+="${HDEPEND:+ }${E_HDEPEND}" |
85 |
REQUIRED_USE+="${REQUIRED_USE:+ }${E_REQUIRED_USE}" |
86 |
|
87 |
- unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \ |
88 |
+ unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND E_HDEPEND \ |
89 |
__INHERITED_QA_CACHE |
90 |
|
91 |
# alphabetically ordered by $EBUILD_PHASE value |
92 |
@@ -664,9 +672,17 @@ if [[ $EBUILD_PHASE = depend ]] ; then |
93 |
|
94 |
auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE |
95 |
DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI |
96 |
- PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04 |
97 |
+ PROPERTIES DEFINED_PHASES HDEPEND UNUSED_04 |
98 |
UNUSED_03 UNUSED_02 UNUSED_01" |
99 |
|
100 |
+ case "$EAPI" in |
101 |
+ 5-hdepend) |
102 |
+ ;; |
103 |
+ *) |
104 |
+ unset HDEPEND |
105 |
+ ;; |
106 |
+ esac |
107 |
+ |
108 |
# The extra $(echo) commands remove newlines. |
109 |
if [ -n "${dbkey}" ] ; then |
110 |
> "${dbkey}" |
111 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
112 |
index 9da202c..dca1a74 100644 |
113 |
--- a/pym/_emerge/depgraph.py |
114 |
+++ b/pym/_emerge/depgraph.py |
115 |
@@ -24,7 +24,7 @@ from portage.dep import Atom, best_match_to_list, extract_affecting_use, \ |
116 |
_repo_separator |
117 |
from portage.dep._slot_operator import ignore_built_slot_operator_deps |
118 |
from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use, \ |
119 |
- _get_eapi_attrs |
120 |
+ _get_eapi_attrs, eapi_has_hdepend |
121 |
from portage.exception import (InvalidAtom, InvalidDependString, |
122 |
PackageNotFound, PortageException) |
123 |
from portage.output import colorize, create_color_func, \ |
124 |
@@ -504,7 +504,7 @@ class depgraph(object): |
125 |
|
126 |
pkg_tree_map = RootConfig.pkg_tree_map |
127 |
|
128 |
- _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] |
129 |
+ _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND", "HDEPEND"] |
130 |
|
131 |
def __init__(self, settings, trees, myopts, myparams, spinner, |
132 |
frozen_config=None, backtrack_parameters=BacktrackParameter(), allow_backtracking=False): |
133 |
@@ -537,10 +537,6 @@ class depgraph(object): |
134 |
preload_installed_pkgs = \ |
135 |
"--nodeps" not in self._frozen_config.myopts |
136 |
|
137 |
- if self._frozen_config.myopts.get("--root-deps") is not None and \ |
138 |
- myroot != self._frozen_config.target_root: |
139 |
- continue |
140 |
- |
141 |
fake_vartree = self._frozen_config.trees[myroot]["vartree"] |
142 |
if not fake_vartree.dbapi: |
143 |
# This needs to be called for the first depgraph, but not for |
144 |
@@ -1685,7 +1681,7 @@ class depgraph(object): |
145 |
removal_action = "remove" in self._dynamic_config.myparams |
146 |
|
147 |
edepend={} |
148 |
- depkeys = ["DEPEND","RDEPEND","PDEPEND"] |
149 |
+ depkeys = ["DEPEND","RDEPEND","PDEPEND","HDEPEND"] |
150 |
for k in depkeys: |
151 |
edepend[k] = metadata[k] |
152 |
|
153 |
@@ -1713,31 +1709,44 @@ class depgraph(object): |
154 |
# Removal actions never traverse ignored buildtime |
155 |
# dependencies, so it's safe to discard them early. |
156 |
edepend["DEPEND"] = "" |
157 |
+ edepend["HDEPEND"] = "" |
158 |
ignore_build_time_deps = True |
159 |
|
160 |
+ ignore_depend_deps = ignore_build_time_deps |
161 |
+ ignore_hdepend_deps = ignore_build_time_deps |
162 |
+ |
163 |
if removal_action: |
164 |
depend_root = myroot |
165 |
else: |
166 |
- depend_root = self._frozen_config._running_root.root |
167 |
- root_deps = self._frozen_config.myopts.get("--root-deps") |
168 |
- if root_deps is not None: |
169 |
- if root_deps is True: |
170 |
- depend_root = myroot |
171 |
- elif root_deps == "rdeps": |
172 |
- ignore_build_time_deps = True |
173 |
+ if eapi_has_hdepend(pkg.metadata['EAPI']): |
174 |
+ depend_root = myroot |
175 |
+ else: |
176 |
+ depend_root = self._frozen_config._running_root.root |
177 |
+ root_deps = self._frozen_config.myopts.get("--root-deps") |
178 |
+ if root_deps is not None: |
179 |
+ if root_deps is True: |
180 |
+ depend_root = myroot |
181 |
+ elif root_deps == "rdeps": |
182 |
+ ignore_depend_deps = True |
183 |
|
184 |
# If rebuild mode is not enabled, it's safe to discard ignored |
185 |
# build-time dependencies. If you want these deps to be traversed |
186 |
# in "complete" mode then you need to specify --with-bdeps=y. |
187 |
- if ignore_build_time_deps and \ |
188 |
- not self._rebuild.rebuild: |
189 |
- edepend["DEPEND"] = "" |
190 |
- |
191 |
+ if not self._rebuild.rebuild: |
192 |
+ if ignore_depend_deps: |
193 |
+ edepend["DEPEND"] = "" |
194 |
+ if ignore_hdepend_deps: |
195 |
+ edepend["HDEPEND"] = "" |
196 |
+ |
197 |
deps = ( |
198 |
(depend_root, edepend["DEPEND"], |
199 |
self._priority(buildtime=True, |
200 |
- optional=(pkg.built or ignore_build_time_deps), |
201 |
- ignored=ignore_build_time_deps)), |
202 |
+ optional=(pkg.built or ignore_depend_deps), |
203 |
+ ignored=ignore_depend_deps)), |
204 |
+ (self._frozen_config._running_root.root, edepend["HDEPEND"], |
205 |
+ self._priority(buildtime=True, |
206 |
+ optional=(pkg.built or ignore_hdepend_deps), |
207 |
+ ignored=ignore_hdepend_deps)), |
208 |
(myroot, edepend["RDEPEND"], |
209 |
self._priority(runtime=True)), |
210 |
(myroot, edepend["PDEPEND"], |
211 |
@@ -2838,7 +2847,7 @@ class depgraph(object): |
212 |
return [pkg.slot_atom for pkg in greedy_pkgs] |
213 |
|
214 |
blockers = {} |
215 |
- blocker_dep_keys = ["DEPEND", "PDEPEND", "RDEPEND"] |
216 |
+ blocker_dep_keys = ["DEPEND", "PDEPEND", "RDEPEND", "HDEPEND"] |
217 |
for pkg in greedy_pkgs + [highest_pkg]: |
218 |
dep_str = " ".join(pkg.metadata[k] for k in blocker_dep_keys) |
219 |
try: |
220 |
@@ -3099,7 +3108,7 @@ class depgraph(object): |
221 |
|
222 |
if target_atom is not None and isinstance(node, Package): |
223 |
affecting_use = set() |
224 |
- for dep_str in "DEPEND", "RDEPEND", "PDEPEND": |
225 |
+ for dep_str in "DEPEND", "RDEPEND", "PDEPEND", "HDEPEND": |
226 |
try: |
227 |
affecting_use.update(extract_affecting_use( |
228 |
node.metadata[dep_str], target_atom, |
229 |
@@ -3183,10 +3192,12 @@ class depgraph(object): |
230 |
dep_strings.add(node.metadata["DEPEND"]) |
231 |
dep_strings.add(node.metadata["RDEPEND"]) |
232 |
dep_strings.add(node.metadata["PDEPEND"]) |
233 |
+ dep_strings.add(node.metadata["HDEPEND"]) |
234 |
else: |
235 |
for priority in priorities: |
236 |
if priority.buildtime: |
237 |
dep_strings.add(node.metadata["DEPEND"]) |
238 |
+ dep_strings.add(node.metadata["HDEPEND"]) |
239 |
if priority.runtime: |
240 |
dep_strings.add(node.metadata["RDEPEND"]) |
241 |
if priority.runtime_post: |
242 |
@@ -4129,7 +4140,7 @@ class depgraph(object): |
243 |
if pkg not in self._dynamic_config.digraph.nodes: |
244 |
return False |
245 |
|
246 |
- for key in "DEPEND", "RDEPEND", "PDEPEND", "LICENSE": |
247 |
+ for key in "DEPEND", "RDEPEND", "PDEPEND", "HDEPEND", "LICENSE": |
248 |
dep = pkg.metadata[key] |
249 |
old_val = set(portage.dep.use_reduce(dep, pkg.use.enabled, is_valid_flag=pkg.iuse.is_valid_flag, flat=True)) |
250 |
new_val = set(portage.dep.use_reduce(dep, new_use, is_valid_flag=pkg.iuse.is_valid_flag, flat=True)) |
251 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
252 |
index d19b795..c3e9646 100644 |
253 |
--- a/pym/_emerge/main.py |
254 |
+++ b/pym/_emerge/main.py |
255 |
@@ -977,7 +977,6 @@ def parse_opts(tmpcmdline, silent=False): |
256 |
"type" : "choice", |
257 |
"choices" : true_y_or_n |
258 |
}, |
259 |
- |
260 |
} |
261 |
|
262 |
from optparse import OptionParser |
263 |
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py |
264 |
index 30c7e72..695f1ea 100644 |
265 |
--- a/pym/portage/__init__.py |
266 |
+++ b/pym/portage/__init__.py |
267 |
@@ -414,7 +414,7 @@ def abssymlink(symlink, target=None): |
268 |
|
269 |
_doebuild_manifest_exempt_depend = 0 |
270 |
|
271 |
-_testing_eapis = frozenset(["4-python", "4-slot-abi", "5-progress"]) |
272 |
+_testing_eapis = frozenset(["4-python", "4-slot-abi", "5-progress", "5-hdepend"]) |
273 |
_deprecated_eapis = frozenset(["4_pre1", "3_pre2", "3_pre1", "5_pre1", "5_pre2"]) |
274 |
|
275 |
def _eapi_is_deprecated(eapi): |
276 |
@@ -472,7 +472,7 @@ auxdbkeys = ( |
277 |
'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', |
278 |
'KEYWORDS', 'INHERITED', 'IUSE', 'REQUIRED_USE', |
279 |
'PDEPEND', 'PROVIDE', 'EAPI', |
280 |
- 'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04', |
281 |
+ 'PROPERTIES', 'DEFINED_PHASES', 'HDEPEND', 'UNUSED_04', |
282 |
'UNUSED_03', 'UNUSED_02', 'UNUSED_01', |
283 |
) |
284 |
auxdbkeylen=len(auxdbkeys) |
285 |
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py |
286 |
index 7f09436..921f51d 100644 |
287 |
--- a/pym/portage/dbapi/bintree.py |
288 |
+++ b/pym/portage/dbapi/bintree.py |
289 |
@@ -75,6 +75,7 @@ class bindbapi(fakedbapi): |
290 |
["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS", |
291 |
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", |
292 |
"RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES", |
293 |
+ "HDEPEND", |
294 |
]) |
295 |
self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys) |
296 |
self._aux_cache = {} |
297 |
@@ -304,11 +305,11 @@ class binarytree(object): |
298 |
["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI", |
299 |
"IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", |
300 |
"PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES", |
301 |
- "BASE_URI"] |
302 |
+ "BASE_URI", "HDEPEND"] |
303 |
self._pkgindex_aux_keys = list(self._pkgindex_aux_keys) |
304 |
self._pkgindex_use_evaluated_keys = \ |
305 |
("LICENSE", "RDEPEND", "DEPEND", |
306 |
- "PDEPEND", "PROPERTIES", "PROVIDE") |
307 |
+ "PDEPEND", "PROPERTIES", "PROVIDE", "HDEPEND") |
308 |
self._pkgindex_header_keys = set([ |
309 |
"ACCEPT_KEYWORDS", "ACCEPT_LICENSE", |
310 |
"ACCEPT_PROPERTIES", "CBUILD", |
311 |
@@ -330,6 +331,7 @@ class binarytree(object): |
312 |
"SLOT" : "0", |
313 |
"USE" : "", |
314 |
"DEFINED_PHASES" : "", |
315 |
+ "HDEPEND" : "", |
316 |
} |
317 |
self._pkgindex_inherited_keys = ["CHOST", "repository"] |
318 |
|
319 |
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py |
320 |
index 0cb290f..b6b3d00 100644 |
321 |
--- a/pym/portage/dbapi/porttree.py |
322 |
+++ b/pym/portage/dbapi/porttree.py |
323 |
@@ -189,7 +189,7 @@ class portdbapi(dbapi): |
324 |
self._aux_cache_keys = set( |
325 |
["DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE", |
326 |
"PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", |
327 |
- "RESTRICT", "SLOT", "DEFINED_PHASES", "REQUIRED_USE"]) |
328 |
+ "RESTRICT", "SLOT", "DEFINED_PHASES", "REQUIRED_USE", "HDEPEND"]) |
329 |
|
330 |
self._aux_cache = {} |
331 |
self._broken_ebuilds = set() |
332 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
333 |
index 7d6d6a8..0822883 100644 |
334 |
--- a/pym/portage/dbapi/vartree.py |
335 |
+++ b/pym/portage/dbapi/vartree.py |
336 |
@@ -164,6 +164,7 @@ class vardbapi(dbapi): |
337 |
"EAPI", "HOMEPAGE", "IUSE", "KEYWORDS", |
338 |
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", |
339 |
"repository", "RESTRICT" , "SLOT", "USE", "DEFINED_PHASES", |
340 |
+ "HDEPEND", |
341 |
]) |
342 |
self._aux_cache_obj = None |
343 |
self._aux_cache_filename = os.path.join(self._eroot, |
344 |
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py |
345 |
index b12d81d..7c45843 100644 |
346 |
--- a/pym/portage/eapi.py |
347 |
+++ b/pym/portage/eapi.py |
348 |
@@ -83,9 +83,15 @@ def eapi_supports_stable_use_forcing_and_masking(eapi): |
349 |
def eapi_allows_directories_on_profile_level_and_repository_level(eapi): |
350 |
return eapi in ("4-python", "5-progress") |
351 |
|
352 |
+def eapi_has_hdepend(eapi): |
353 |
+ return eapi in ("5-hdepend",) |
354 |
+ |
355 |
+def eapi_has_targetroot(eapi): |
356 |
+ return eapi in ("5-hdepend",) |
357 |
+ |
358 |
_eapi_attrs = collections.namedtuple('_eapi_attrs', |
359 |
'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC ' |
360 |
- 'feature_flag_test iuse_defaults iuse_effective ' |
361 |
+ 'feature_flag_test feature_flag_targetroot iuse_defaults iuse_effective ' |
362 |
'repo_deps required_use required_use_at_most_one_of slot_operator slot_deps ' |
363 |
'src_uri_arrows strong_blocks use_deps use_dep_defaults') |
364 |
|
365 |
@@ -112,6 +118,7 @@ def _get_eapi_attrs(eapi): |
366 |
dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)), |
367 |
exports_EBUILD_PHASE_FUNC = (eapi is None or eapi_exports_EBUILD_PHASE_FUNC(eapi)), |
368 |
feature_flag_test = True, |
369 |
+ feature_flag_targetroot = eapi_has_targetroot(eapi), |
370 |
iuse_defaults = (eapi is None or eapi_has_iuse_defaults(eapi)), |
371 |
iuse_effective = (eapi is not None and eapi_has_iuse_effective(eapi)), |
372 |
repo_deps = (eapi is None or eapi_has_repo_deps(eapi)), |
373 |
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py |
374 |
index 894d14c..4992292 100644 |
375 |
--- a/pym/portage/package/ebuild/config.py |
376 |
+++ b/pym/portage/package/ebuild/config.py |
377 |
@@ -33,7 +33,8 @@ from portage.dbapi.porttree import portdbapi |
378 |
from portage.dbapi.vartree import vartree |
379 |
from portage.dep import Atom, isvalidatom, match_from_list, use_reduce, _repo_separator, _slot_separator |
380 |
from portage.eapi import eapi_exports_AA, eapi_exports_merge_type, \ |
381 |
- eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs |
382 |
+ eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs, \ |
383 |
+ eapi_has_targetroot |
384 |
from portage.env.loaders import KeyValuePairFileLoader |
385 |
from portage.exception import InvalidDependString, PortageException |
386 |
from portage.localization import _ |
387 |
@@ -63,7 +64,7 @@ if sys.hexversion >= 0x3000000: |
388 |
_feature_flags_cache = {} |
389 |
|
390 |
def _get_feature_flags(eapi_attrs): |
391 |
- cache_key = (eapi_attrs.feature_flag_test,) |
392 |
+ cache_key = (eapi_attrs.feature_flag_test, eapi_attrs.feature_flag_targetroot) |
393 |
flags = _feature_flags_cache.get(cache_key) |
394 |
if flags is not None: |
395 |
return flags |
396 |
@@ -71,6 +72,8 @@ def _get_feature_flags(eapi_attrs): |
397 |
flags = [] |
398 |
if eapi_attrs.feature_flag_test: |
399 |
flags.append("test") |
400 |
+ if eapi_attrs.feature_flag_targetroot: |
401 |
+ flags.append("targetroot") |
402 |
|
403 |
flags = frozenset(flags) |
404 |
_feature_flags_cache[cache_key] = flags |
405 |
@@ -1503,6 +1506,13 @@ class config(object): |
406 |
self.usemask = \ |
407 |
frozenset(x for x in self.usemask if x != "test") |
408 |
|
409 |
+ if ("targetroot" in explicit_iuse or iuse_implicit_match("targetroot")) and \ |
410 |
+ eapi_has_targetroot(eapi): |
411 |
+ if self["ROOT"] != "/": |
412 |
+ use.add("targetroot") |
413 |
+ else: |
414 |
+ use.discard("targetroot") |
415 |
+ |
416 |
# Allow _* flags from USE_EXPAND wildcards to pass through here. |
417 |
use.difference_update([x for x in use \ |
418 |
if (x not in explicit_iuse and \ |
419 |
-- |
420 |
1.7.12 |