summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/dbapi/__init__.py100
1 files changed, 53 insertions, 47 deletions
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index e386faae5..96e85cecd 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -155,64 +155,70 @@ class dbapi(object):
2) Check enabled/disabled flag states.
"""
- iuse_implicit_match = self.settings._iuse_implicit_match
+ aux_keys = ["IUSE", "SLOT", "USE"]
for cpv in cpv_iter:
try:
- iuse, slot, use = self.aux_get(cpv, ["IUSE", "SLOT", "USE"], myrepo=atom.repo)
+ metadata = dict(zip(aux_keys,
+ self.aux_get(cpv, aux_keys, myrepo=atom.repo)))
except KeyError:
continue
- iuse = frozenset(x.lstrip('+-') for x in iuse.split())
- missing_iuse = False
- for x in atom.unevaluated_atom.use.required:
- if x not in iuse and not iuse_implicit_match(x):
- missing_iuse = True
- break
- if missing_iuse:
+
+ if not self._match_use(atom, cpv, metadata):
continue
- 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)
-
- if atom.use.enabled:
- if atom.use.enabled.intersection(missing_disabled):
- continue
- need_enabled = atom.use.enabled.difference(use)
+
+ yield cpv
+
+ def _match_use(self, atom, cpv, metadata):
+ iuse_implicit_match = self.settings._iuse_implicit_match
+ iuse = frozenset(x.lstrip('+-') for x in metadata["IUSE"].split())
+
+ for x in atom.unevaluated_atom.use.required:
+ if x not in iuse and not iuse_implicit_match(x):
+ return False
+
+ if atom.use is None:
+ 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 metadata["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)
+
+ if atom.use.enabled:
+ if atom.use.enabled.intersection(missing_disabled):
+ return False
+ need_enabled = atom.use.enabled.difference(use)
+ if need_enabled:
+ need_enabled = need_enabled.difference(missing_enabled)
if need_enabled:
- need_enabled = need_enabled.difference(missing_enabled)
- if need_enabled:
- continue
+ return False
- if atom.use.disabled:
- if atom.use.disabled.intersection(missing_enabled):
- continue
- need_disabled = atom.use.disabled.intersection(use)
+ if atom.use.disabled:
+ if atom.use.disabled.intersection(missing_enabled):
+ return False
+ need_disabled = atom.use.disabled.intersection(use)
+ if need_disabled:
+ need_disabled = need_disabled.difference(missing_disabled)
if need_disabled:
- need_disabled = need_disabled.difference(missing_disabled)
- if need_disabled:
- continue
- else:
- # Check masked and forced flags for repoman.
- mysettings = getattr(self, 'settings', None)
- if mysettings is not None and not mysettings.local_config:
+ return False
- pkg = "%s:%s" % (cpv, slot)
- usemask = mysettings._getUseMask(pkg)
- if usemask.intersection(atom.use.enabled):
- continue
+ elif not self.settings.local_config:
+ # Check masked and forced flags for repoman.
+ pkg = "%s:%s" % (cpv, metadata["SLOT"])
+ usemask = self.settings._getUseMask(pkg)
+ if usemask.intersection(atom.use.enabled):
+ return False
- useforce = mysettings._getUseForce(pkg).difference(usemask)
- if useforce.intersection(atom.use.disabled):
- continue
+ useforce = self.settings._getUseForce(pkg).difference(usemask)
+ if useforce.intersection(atom.use.disabled):
+ return False
- yield cpv
+ return True
def invalidentry(self, mypath):
if '/-MERGING-' in mypath: