emerge --info: Fix USE_EXPAND display
authorZac Medico <zmedico@gentoo.org>
Fri, 19 Nov 2010 20:50:54 +0000 (12:50 -0800)
committerZac Medico <zmedico@gentoo.org>
Wed, 24 Nov 2010 02:05:11 +0000 (18:05 -0800)
This makes the USE_EXPAND variables consistent with the USE flag
settings.

pym/portage/package/ebuild/config.py

index 922116a5efff3d994573df9e6b001788839b963e..f927af4d3a6276e6686490a9339540f73c38ff8a 100644 (file)
@@ -1879,6 +1879,24 @@ class config(object):
                myflags.difference_update(self.usemask)
                self.configlist[-1]["USE"]= " ".join(sorted(myflags))
 
+               if self.mycpv is None:
+                       # Generate global USE_EXPAND variables settings that are
+                       # consistent with USE, for display by emerge --info. For
+                       # package instances, these are instead generated via
+                       # setcpv().
+                       for k in use_expand:
+                               prefix = k.lower() + '_'
+                               prefix_len = len(prefix)
+                               expand_flags = set( x[prefix_len:] for x in myflags \
+                                       if x[:prefix_len] == prefix )
+                               var_split = use_expand_dict.get(k, '').split()
+                               var_split = [ x for x in var_split if x in expand_flags ]
+                               var_split.extend(sorted(expand_flags.difference(var_split)))
+                               if var_split:
+                                       self.configlist[-1][k] = ' '.join(var_split)
+                               elif k in self:
+                                       self.configlist[-1][k] = ''
+
        @property
        def virts_p(self):
                warnings.warn("portage config.virts_p attribute " + \