depgraph: tweak USE match logic for bug 345979
authorZac Medico <zmedico@gentoo.org>
Sat, 27 Nov 2010 06:18:05 +0000 (22:18 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 27 Nov 2010 06:35:32 +0000 (22:35 -0800)
This should fix handling of some corner cases in which use.force
or use.mask might not have been handled correctly, and removes some
redundant IUSE related checks.

pym/_emerge/depgraph.py

index bc3c1028cb98df8c72e799e9fdea16daa9ed4e6f..fecadd3c1e7ace00c70c05cf8ec9eca2a578b56a 100644 (file)
@@ -2951,37 +2951,41 @@ class depgraph(object):
                                                else:
                                                        use = self._pkg_use_enabled(pkg)
 
+                                               use_match = True
+                                               can_adjust_use = not pkg.built
+
                                                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:
-                                                                               if not pkg.use.mask.intersection(need_enabled):
-                                                                                       # Be careful about masked flags, since they
-                                                                                       # typically aren't adjustable by the user.
-                                                                                       packages_with_invalid_use_config.append(pkg)
-                                                                       continue
+                                                                       use_match = False
+                                                                       if can_adjust_use:
+                                                                               if pkg.use.mask.intersection(need_enabled):
+                                                                                       can_adjust_use = False
 
                                                if atom.use.disabled:
                                                        need_disabled = atom.use.disabled.intersection(use)
                                                        if need_disabled:
-                                                               if not pkg.built:
-                                                                       if not pkg.use.force.difference(
-                                                                               pkg.use.mask).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
+                                                               need_disabled = need_disabled.difference(
+                                                                       atom.use.missing_disabled.difference(pkg.iuse.all))
+                                                               if need_disabled:
+                                                                       use_match = False
+                                                                       if can_adjust_use:
+                                                                               if pkg.use.force.difference(
+                                                                                       pkg.use.mask).intersection(need_disabled):
+                                                                                       can_adjust_use = False
+
+                                               if can_adjust_use:
+                                                       # Above we must ensure that this package has
+                                                       # absolutely no use.force, use.mask, or IUSE
+                                                       # issues that the user typically can't make
+                                                       # adjustments to solve (see bug #345979).
+                                                       packages_with_invalid_use_config.append(pkg)
+
+                                               if not use_match:
+                                                       continue
 
                                        elif atom.unevaluated_atom.use:
                                                #Make sure we don't miss a 'missing IUSE'.