portage.dbapi.dbapi._match_use(): Use _emerge.Package.Package._iuse.get_real_flag().
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Fri, 7 Jun 2013 20:41:28 +0000 (22:41 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Fri, 7 Jun 2013 20:41:28 +0000 (22:41 +0200)
It fixes support for USE aliases in:
  best_version
  has_version
  emerge --keep-going
  emerge --resume

pym/portage/dbapi/__init__.py

index ab4306d7025cb1b49b9e34c25889a44e59859eaf..f954bad94664094635bc7e9bf73fb164c1e75169 100644 (file)
@@ -204,10 +204,11 @@ class dbapi(object):
                        iuse_implicit_match = self.settings._iuse_effective_match
                else:
                        iuse_implicit_match = self.settings._iuse_implicit_match
-               iuse = frozenset(x.lstrip('+-') for x in metadata["IUSE"].split())
+               usealiases = self.settings._use_manager.getUseAliases(self._pkg_str(cpv, metadata["repository"]))
+               iuse = Package._iuse(None, metadata["IUSE"].split(), iuse_implicit_match, usealiases, metadata["EAPI"])
 
                for x in atom.unevaluated_atom.use.required:
-                       if x not in iuse and not iuse_implicit_match(x):
+                       if iuse.get_real_flag(x) is None:
                                return False
 
                if atom.use is None:
@@ -220,27 +221,24 @@ class dbapi(object):
                        # data corruption). The enabled flags must be consistent
                        # with implicit IUSE, in order to avoid potential
                        # inconsistencies in USE dep matching (see bug #453400).
-                       use = frozenset(x for x in metadata["USE"].split()
-                               if x in iuse or iuse_implicit_match(x))
-                       missing_enabled = frozenset(x for x in
-                               atom.use.missing_enabled if not
-                               (x in iuse or iuse_implicit_match(x)))
-                       missing_disabled = frozenset(x for x in
-                               atom.use.missing_disabled if not
-                               (x in iuse or iuse_implicit_match(x)))
-
-                       if atom.use.enabled:
-                               if any(x in atom.use.enabled for x in missing_disabled):
+                       use = frozenset(x for x in metadata["USE"].split() if iuse.get_real_flag(x) is not None)
+                       missing_enabled = frozenset(x for x in atom.use.missing_enabled if iuse.get_real_flag(x) is None)
+                       missing_disabled = frozenset(x for x in atom.use.missing_disabled if iuse.get_real_flag(x) is None)
+                       enabled = frozenset((iuse.get_real_flag(x) or x) for x in atom.use.enabled)
+                       disabled = frozenset((iuse.get_real_flag(x) or x) for x in atom.use.disabled)
+
+                       if enabled:
+                               if any(x in enabled for x in missing_disabled):
                                        return False
-                               need_enabled = atom.use.enabled.difference(use)
+                               need_enabled = enabled.difference(use)
                                if need_enabled:
                                        if any(x not in missing_enabled for x in need_enabled):
                                                return False
 
-                       if atom.use.disabled:
-                               if any(x in atom.use.disabled for x in missing_enabled):
+                       if disabled:
+                               if any(x in disabled for x in missing_enabled):
                                        return False
-                               need_disabled = atom.use.disabled.intersection(use)
+                               need_disabled = disabled.intersection(use)
                                if need_disabled:
                                        if any(x not in missing_disabled for x in need_disabled):
                                                return False
@@ -266,15 +264,11 @@ class dbapi(object):
 
                        # Check unsatisfied use-default deps
                        if atom.use.enabled:
-                               missing_disabled = frozenset(x for x in
-                                       atom.use.missing_disabled if not
-                                       (x in iuse or iuse_implicit_match(x)))
+                               missing_disabled = frozenset(x for x in atom.use.missing_disabled if iuse.get_real_flag(x) is None)
                                if any(x in atom.use.enabled for x in missing_disabled):
                                        return False
                        if atom.use.disabled:
-                               missing_enabled = frozenset(x for x in
-                                       atom.use.missing_enabled if not
-                                       (x in iuse or iuse_implicit_match(x)))
+                               missing_enabled = frozenset(x for x in atom.use.missing_enabled if iuse.get_real_flag(x) is None)
                                if any(x in atom.use.disabled for x in missing_enabled):
                                        return False