summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-18 04:04:40 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-18 04:04:40 +0000
commitbbff2d84b034435756500be72ce167445f0f411c (patch)
treeb713d7185812536986649e242ba357dd17bf6c8c
parent50a6109655dce0438d870b7afd2e1f6540211e96 (diff)
downloadportage-bbff2d84b034435756500be72ce167445f0f411c.tar.gz
portage-bbff2d84b034435756500be72ce167445f0f411c.tar.bz2
portage-bbff2d84b034435756500be72ce167445f0f411c.zip
Bug #176467 - Filter out USE flags that aren't part of IUSE.
Some flags are considered to be implicit members of IUSE: * Flags derived from ARCH * Flags derived from USE_EXPAND_HIDDEN variables * Forced flags, such as those from {,package}use.force svn path=/main/trunk/; revision=8944
-rw-r--r--pym/portage/__init__.py40
1 files changed, 35 insertions, 5 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index f3da78877..9e2f424ce 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2381,11 +2381,41 @@ class config(object):
# USE_EXPAND context.
pass
- # Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch.
- if self.configdict["defaults"].has_key("ARCH"):
- if self.configdict["defaults"]["ARCH"]:
- if self.configdict["defaults"]["ARCH"] not in usesplit:
- usesplit.insert(0,self.configdict["defaults"]["ARCH"])
+ arch = self.configdict["defaults"].get("ARCH")
+ if arch and arch not in usesplit:
+ usesplit.append(arch)
+
+ # Filter out USE flags that aren't part of IUSE. Some
+ # flags are considered to be implicit members of IUSE:
+ #
+ # * Flags derived from ARCH
+ # * Flags derived from USE_EXPAND_HIDDEN variables
+ # * Forced flags, such as those from {,package}use.force
+
+ if self.mycpv:
+ iuse_implicit = set(iuse)
+
+ # Flags derived from ARCH.
+ if arch:
+ iuse_implicit.add(arch)
+
+ # Flags derived from USE_EXPAND_HIDDEN variables
+ # such as ELIBC, KERNEL, and USERLAND.
+ use_expand_hidden = self.get("USE_EXPAND_HIDDEN", "").split()
+ if use_expand_hidden:
+ use_expand_hidden = re.compile("^(%s)_.*" % \
+ ("|".join(x.lower() for x in use_expand_hidden)))
+ for x in usesplit:
+ if use_expand_hidden.match(x):
+ iuse_implicit.add(x)
+
+ # Flags that have been forced.
+ iuse_implicit.update(x for x in self.useforce \
+ if x not in self.usemask)
+
+ usesplit = [x for x in usesplit if \
+ x in iuse_implicit and \
+ x not in self.usemask]
usesplit.sort()
self.configlist[-1]["USE"]= " ".join(usesplit)