dbapi.match: Use IUSE to validate built USE
authorZac Medico <zmedico@gentoo.org>
Sun, 5 Dec 2010 22:36:16 +0000 (14:36 -0800)
committerZac Medico <zmedico@gentoo.org>
Sun, 5 Dec 2010 22:37:37 +0000 (14:37 -0800)
pym/portage/dbapi/__init__.py

index 555125ac510e5d830ce65bc926ca4c565ec7124d..53adfbe74344b67ee50b79665b3787a8a639b4cd 100644 (file)
@@ -151,7 +151,6 @@ class dbapi(object):
                                iuse, slot, use = self.aux_get(cpv, ["IUSE", "SLOT", "USE"])
                        except KeyError:
                                continue
-                       use = use.split()
                        iuse = frozenset(x.lstrip('+-') for x in iuse.split())
                        missing_iuse = False
                        for x in atom.unevaluated_atom.use.required:
@@ -163,6 +162,12 @@ class dbapi(object):
                        if not atom.use:
                                pass
                        elif not self._use_mutable:
+                               # Use IUSE to validate USE settings for built packages,
+                               # in case the package manager that built this package
+                               # failed to do that for some reason (or in case of
+                               # data corruption).
+                               use = frozenset(x for x in use.split() if x in iuse or \
+                                       iuse_implicit_match(x))
                                missing_enabled = atom.use.missing_enabled.difference(iuse)
                                missing_disabled = atom.use.missing_disabled.difference(iuse)