aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/portage/package/ebuild/config.py')
-rw-r--r--lib/portage/package/ebuild/config.py52
1 files changed, 31 insertions, 21 deletions
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
index 320d9f6c0..37c5c6656 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -294,6 +294,7 @@ class config(object):
self.configlist = [
self.configdict['env.d'],
self.configdict['repo'],
+ self.configdict['features'],
self.configdict['pkginternal'],
self.configdict['globals'],
self.configdict['defaults'],
@@ -461,7 +462,7 @@ class config(object):
# back up our incremental variables:
self.configdict={}
self._use_expand_dict = {}
- # configlist will contain: [ env.d, globals, defaults, conf, pkg, backupenv, env ]
+ # configlist will contain: [ env.d, globals, features, defaults, conf, pkg, backupenv, env ]
self.configlist.append({})
self.configdict["env.d"] = self.configlist[-1]
@@ -469,6 +470,9 @@ class config(object):
self.configdict["repo"] = self.configlist[-1]
self.configlist.append({})
+ self.configdict["features"] = self.configlist[-1]
+
+ self.configlist.append({})
self.configdict["pkginternal"] = self.configlist[-1]
# env_d will be None if profile.env doesn't exist.
@@ -868,7 +872,7 @@ class config(object):
# reasonable defaults; this is important as without USE_ORDER,
# USE will always be "" (nothing set)!
if "USE_ORDER" not in self:
- self["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal:repo:env.d"
+ self["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal:features:repo:env.d"
self.backup_changes("USE_ORDER")
if "CBUILD" not in self and "CHOST" in self:
@@ -1292,6 +1296,7 @@ class config(object):
del self._penv[:]
self.configdict["pkg"].clear()
self.configdict["pkginternal"].clear()
+ self.configdict["features"].clear()
self.configdict["repo"].clear()
self.configdict["defaults"]["USE"] = \
" ".join(self.make_defaults_use)
@@ -1452,6 +1457,7 @@ class config(object):
cp = cpv_getkey(mycpv)
cpv_slot = self.mycpv
pkginternaluse = ""
+ feature_use = []
iuse = ""
pkg_configdict = self.configdict["pkg"]
previous_iuse = pkg_configdict.get("IUSE")
@@ -1650,6 +1656,24 @@ class config(object):
if has_changed:
self.reset(keeping_pkg=1)
+ if explicit_iuse is None:
+ explicit_iuse = frozenset(x.lstrip("+-") for x in iuse.split())
+ if eapi_attrs.iuse_effective:
+ iuse_implicit_match = self._iuse_effective_match
+ else:
+ iuse_implicit_match = self._iuse_implicit_match
+
+ if "test" in explicit_iuse or iuse_implicit_match("test"):
+ if "test" in self.features:
+ feature_use.append("test")
+
+ feature_use = " ".join(feature_use)
+ if feature_use != self.configdict["features"].get("USE", ""):
+ self.configdict["features"]["USE"] = feature_use
+ # TODO: can we avoid that?
+ self.reset(keeping_pkg=1)
+ has_changed = True
+
env_configdict = self.configdict['env']
# Ensure that "pkg" values are always preferred over "env" values.
@@ -1677,11 +1701,8 @@ class config(object):
# package has different IUSE.
use = set(self["USE"].split())
unfiltered_use = frozenset(use)
- if explicit_iuse is None:
- explicit_iuse = frozenset(x.lstrip("+-") for x in iuse.split())
if eapi_attrs.iuse_effective:
- iuse_implicit_match = self._iuse_effective_match
portage_iuse = set(self._iuse_effective)
portage_iuse.update(explicit_iuse)
if built_use is not None:
@@ -1693,7 +1714,6 @@ class config(object):
self.configdict["pkg"]["IUSE_EFFECTIVE"] = \
" ".join(sorted(portage_iuse))
else:
- iuse_implicit_match = self._iuse_implicit_match
portage_iuse = self._get_implicit_iuse()
portage_iuse.update(explicit_iuse)
@@ -1729,21 +1749,17 @@ class config(object):
self.get("EBUILD_FORCE_TEST") == "1"
if "test" in explicit_iuse or iuse_implicit_match("test"):
- if "test" not in self.features:
- use.discard("test")
- elif restrict_test or \
+ if "test" in self.features:
+ if ebuild_force_test and "test" in self.usemask:
+ self.usemask = \
+ frozenset(x for x in self.usemask if x != "test")
+ if restrict_test or \
("test" in self.usemask and not ebuild_force_test):
# "test" is in IUSE and USE=test is masked, so execution
# of src_test() probably is not reliable. Therefore,
# temporarily disable FEATURES=test just for this package.
self["FEATURES"] = " ".join(x for x in self.features \
if x != "test")
- use.discard("test")
- else:
- use.add("test")
- if ebuild_force_test and "test" in self.usemask:
- self.usemask = \
- frozenset(x for x in self.usemask if x != "test")
if eapi_attrs.feature_flag_targetroot and \
("targetroot" in explicit_iuse or iuse_implicit_match("targetroot")):
@@ -1900,12 +1916,6 @@ class config(object):
iuse_implicit.add("build")
iuse_implicit.add("bootstrap")
- # Controlled by FEATURES=test. Make this implicit, so handling
- # of FEATURES=test is consistent regardless of explicit IUSE.
- # Users may use use.mask/package.use.mask to control
- # FEATURES=test for all ebuilds, regardless of explicit IUSE.
- iuse_implicit.add("test")
-
return iuse_implicit
def _getUseMask(self, pkg, stable=None):