diff options
author | Zac Medico <zmedico@gentoo.org> | 2013-02-26 16:27:40 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2013-02-26 16:27:40 -0800 |
commit | 207554dd7d2796f1fa4da41725154d17048a194d (patch) | |
tree | a0058ab9ee8420ec2f92552a68ab0fc88927f1e0 | |
parent | EventLoop: qemu-user epoll quirk, bug #451326 (diff) | |
download | portage-207554dd7d2796f1fa4da41725154d17048a194d.tar.gz portage-207554dd7d2796f1fa4da41725154d17048a194d.tar.bz2 portage-207554dd7d2796f1fa4da41725154d17048a194d.zip |
config: unset LINGUAS if appropriate, bug #459350
-rw-r--r-- | pym/portage/package/ebuild/config.py | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index fb7b741d2..2ac59f090 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1183,8 +1183,11 @@ class config(object): the previously calculated USE settings. """ - def __init__(self, use, usemask, iuse_implicit, + def __init__(self, settings, unfiltered_use, + use, usemask, iuse_implicit, use_expand_split, use_expand_dict): + self._settings = settings + self._unfiltered_use = unfiltered_use self._use = use self._usemask = usemask self._iuse_implicit = iuse_implicit @@ -1239,13 +1242,32 @@ class config(object): # 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. + # The special '*' token is understood by ebuild.sh, which + # will unset the variable so that things like LINGUAS work + # properly (see bug #459350). if has_wildcard: - # ebuild.sh will see this and unset the variable so - # that things like LINGUAS work properly value = '*' else: if has_iuse: - value = '' + already_set = False + # Skip the first 'env' configdict, in order to + # avoid infinite recursion here, since that dict's + # __getitem__ calls the current __getitem__. + for d in self._settings.lookuplist[1:]: + if key in d: + already_set = True + break + + if not already_set: + for x in self._unfiltered_use: + if x[:prefix_len] == prefix: + already_set = True + break + + if already_set: + value = '' + else: + value = '*' else: # It's not in IUSE, so just allow the variable content # to pass through if it is defined somewhere. This @@ -1501,6 +1523,7 @@ class config(object): # be done for every setcpv() call since practically every # 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()) @@ -1585,7 +1608,8 @@ class config(object): # comparison instead of startswith(). use_expand_split = set(x.lower() for \ x in self.get('USE_EXPAND', '').split()) - lazy_use_expand = self._lazy_use_expand(use, self.usemask, + lazy_use_expand = self._lazy_use_expand( + self, unfiltered_use, use, self.usemask, portage_iuse, use_expand_split, self._use_expand_dict) use_expand_iuses = {} |