Fix interaction of use.mask/force with use deps.
authorZac Medico <zmedico@gentoo.org>
Sat, 20 Nov 2010 16:58:28 +0000 (08:58 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 20 Nov 2010 16:58:28 +0000 (08:58 -0800)
This should fix the package selection issue bug #345979 which
triggers invalid "masked by: [nothing]" messages.

pym/_emerge/depgraph.py

index f21d66d2b3f5eaf20025cabac96c0da29c1a7a63..cf1addf6a528c97fa03967f671adbf6b71da4575 100644 (file)
@@ -2983,16 +2983,40 @@ class depgraph(object):
                                                else:
                                                        use = self._pkg_use_enabled(pkg)
 
-                                               if atom.use.enabled.difference(use) and \
-                                                       atom.use.enabled.difference(use).difference(atom.use.missing_enabled.difference(pkg.iuse.all)):
-                                                       if not pkg.built:
-                                                               packages_with_invalid_use_config.append(pkg)
-                                                       continue
-                                               if atom.use.disabled.intersection(use) or \
-                                                       atom.use.disabled.difference(pkg.iuse.all).difference(atom.use.missing_disabled):
-                                                       if not pkg.built:
-                                                               packages_with_invalid_use_config.append(pkg)
-                                                       continue
+                                               if atom.use.enabled:
+                                                       need_enabled = atom.use.enabled.difference(use)
+                                                       if need_enabled:
+                                                               need_enabled = need_enabled.difference(
+                                                                       atom.use.missing_enabled.difference(pkg.iuse.all))
+                                                               if need_enabled:
+                                                                       if not pkg.built:
+                                                                               pkgsettings.setcpv(pkg)
+                                                                               if not pkgsettings.usemask.difference(need_enabled):
+                                                                                       # Be careful about masked flags, since they
+                                                                                       # typically aren't adjustable by the user.
+                                                                                       packages_with_invalid_use_config.append(pkg)
+                                                                       continue
+
+                                               if atom.use.disabled:
+                                                       need_disabled = atom.use.disabled.intersection(use)
+                                                       if need_disabled:
+                                                               if not pkg.built:
+                                                                       pkgsettings.setcpv(pkg)
+                                                                       if not pkgsettings.useforce.difference(
+                                                                               pkgsettings.usemask).intersection(need_disabled):
+                                                                               # Be careful about forced flags, since they
+                                                                               # typically aren't adjustable by the user.
+                                                                               packages_with_invalid_use_config.append(pkg)
+                                                               continue
+
+                                                       need_disabled = atom.use.disabled.difference(
+                                                               pkg.iuse.all).difference(atom.use.missing_disabled)
+                                                       if need_disabled:
+                                                               # Don't add this to packages_with_invalid_use_config
+                                                               # since missing_disabled indicates an IUSE issue, and
+                                                               # IUSE cannot be adjusted by the user.
+                                                               continue
+
                                        elif atom.unevaluated_atom.use:
                                                #Make sure we don't miss a 'missing IUSE'.
                                                if pkg.iuse.get_missing_iuse(atom.unevaluated_atom.use.required):