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