For bug #148702, use the * token to trigger wildcard expansion of IUSE. This adds...
authorZac Medico <zmedico@gentoo.org>
Sat, 9 Jun 2007 23:06:19 +0000 (23:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 9 Jun 2007 23:06:19 +0000 (23:06 -0000)
svn path=/main/trunk/; revision=6784

bin/ebuild.sh
pym/portage/__init__.py

index fcfbe5430cc42dd9b90c4ea50d936871a2ef9ea5..164b2a0df6bc71fd995366d3dc5d6e50efb9b8dc 100755 (executable)
@@ -1512,6 +1512,11 @@ if [ "${EBUILD_PHASE}" != "depend" ]; then
        done
        export IUSE=${iuse_temp}
        unset iuse_temp
+       # unset USE_EXPAND variables that contain only the special "*" token
+       for x in ${USE_EXPAND} ; do
+               [ "${!x}" == "*" ] && unset ${x}
+       done
+       unset x
        # Lock the dbkey variables after the global phase
        declare -r DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE DESCRIPTION
        declare -r KEYWORDS INHERITED IUSE PDEPEND PROVIDE
index 7e1d200f502b40e6394c46d37b3ee94caa4beba7..8bf342248170c6f078c9e65ee5f7a5dc45eab931 100644 (file)
@@ -2035,6 +2035,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)
@@ -2045,23 +2047,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"):