From 7c38e75dd8460f7a1ddafce7bd9d3f9a87d0c4e9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 5 Aug 2010 19:35:37 -0700 Subject: Bug #331271 - Fix USE_EXPAND wildcards so that the USE="linguas_* -linguas_en_US" case is handled correctly. --- pym/portage/package/ebuild/config.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index bfff1cc44..ba3e91c97 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -2273,6 +2273,9 @@ class config(object): # For optimal performance, use slice # comparison instead of startswith(). + iuse = self.configdict["pkg"].get("IUSE") + if iuse is not None: + iuse = [x.lstrip("+-") for x in iuse.split()] myflags = set() for curdb in self.uvlist: cur_use_expand = [x for x in use_expand if x in curdb] @@ -2301,7 +2304,24 @@ class config(object): myflags.discard(x[1:]) continue - myflags.add(x) + if iuse is not None and x[-2:] == '_*': + # Expand wildcards here, so that cases like + # USE="linguas_* -linguas_en_US" work correctly. + prefix = x[:-1] + prefix_len = len(prefix) + has_iuse = False + for y in iuse: + if y[:prefix_len] == prefix: + has_iuse = True + myflags.add(y) + if not has_iuse: + # There are no matching IUSE, so allow the + # wildcard to pass through. This allows + # linguas_* to trigger unset LINGUAS in + # cases when no linguas_ flags are in IUSE. + myflags.add(x) + else: + myflags.add(x) for var in cur_use_expand: var_lower = var.lower() -- cgit v1.2.3-1-g7c22