diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-06-09 23:09:15 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-06-09 23:09:15 +0000 |
commit | 48f5b7eae5a9e8bca89958a36b0c8204b2659f59 (patch) | |
tree | ac9cdd0f43e3c0f92f2488c58f4ed1d99f4c36b0 /pym/portage.py | |
parent | e16e16a6e561e59328d74eee6eb857c924c62f20 (diff) | |
download | portage-48f5b7eae5a9e8bca89958a36b0c8204b2659f59.tar.gz portage-48f5b7eae5a9e8bca89958a36b0c8204b2659f59.tar.bz2 portage-48f5b7eae5a9e8bca89958a36b0c8204b2659f59.zip |
For bug #148702, use the * token to trigger wildcard expansion of IUSE. This adds flexibility and prevents flags from being enabled unexpectedly. (trunk r6784)
svn path=/main/branches/2.1.2/; revision=6785
Diffstat (limited to 'pym/portage.py')
-rw-r--r-- | pym/portage.py | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/pym/portage.py b/pym/portage.py index 21861eac3..f34ff5887 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1961,6 +1961,8 @@ class config: # Use the calculated USE flags to regenerate the USE_EXPAND flags so # that they are consistent. + iuse = self.configdict["pkg"].get("IUSE","").split() + iuse = set([ x.lstrip("+-") for x in iuse ]) for var in use_expand: prefix = var.lower() + "_" prefix_len = len(prefix) @@ -1971,23 +1973,34 @@ class config: # like LINGUAS. var_split = [ x for x in var_split if x in expand_flags ] var_split.extend(expand_flags.difference(var_split)) - if var_split or var in self: + if (var_split or var in self) and \ + "*" not in var_split: # Don't export empty USE_EXPAND vars unless the user config # exports them as empty. This is required for vars such as # LINGUAS, where unset and empty have different meanings. self[var] = " ".join(var_split) - else: - # if unset, we enable everything in IUSE that's not masked - iuse = self.configdict["pkg"].get("IUSE") - if iuse: - var_split = [] - for x in iuse.split(): - x = x.lstrip("+-") - if x.startswith(prefix) and x not in self.usemask: - var_split.append(x[prefix_len:]) - usesplit.append(x) - if var_split: - self[var] = " ".join(var_split) + elif "*" in var_split: + # * means to enable everything in IUSE that's not masked + filtered_split = [] + for x in var_split: + if x == "*": + continue + if (prefix + x) in iuse: + filtered_split.append(x) + var_split = filtered_split + for x in iuse: + if x.startswith(prefix) and x not in self.usemask: + suffix = x[prefix_len:] + if suffix in var_split: + continue + var_split.append(suffix) + usesplit.append(x) + if var_split: + self[var] = " ".join(var_split) + elif var in self: + # ebuild.sh will see this and unset the variable so + # that things like LINGUAS work properly + self[var] = "*" # Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch. if self.configdict["defaults"].has_key("ARCH"): |