diff options
-rw-r--r-- | pym/portage/__init__.py | 86 | ||||
-rw-r--r-- | pym/portage/dbapi/__init__.py | 16 |
2 files changed, 65 insertions, 37 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 3e3bc1773..68b7a35ca 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -2001,45 +2001,13 @@ class config(object): if defaults != self.configdict["defaults"].get("USE",""): self.configdict["defaults"]["USE"] = defaults has_changed = True - useforce = [] - pos = 0 - for i in xrange(len(self.profiles)): - cpdict = self.puseforce_list[i].get(cp, None) - if cpdict: - keys = cpdict.keys() - while keys: - best_match = best_match_to_list(cpv_slot, keys) - if best_match: - keys.remove(best_match) - useforce.insert(pos, cpdict[best_match]) - else: - break - del keys - if self.useforce_list[i]: - useforce.insert(pos, self.useforce_list[i]) - pos = len(useforce) - useforce = set(stack_lists(useforce, incremental=True)) + + useforce = self._getUseForce(cpv_slot) if useforce != self.useforce: self.useforce = useforce has_changed = True - usemask = [] - pos = 0 - for i in xrange(len(self.profiles)): - cpdict = self.pusemask_list[i].get(cp, None) - if cpdict: - keys = cpdict.keys() - while keys: - best_match = best_match_to_list(cpv_slot, keys) - if best_match: - keys.remove(best_match) - usemask.insert(pos, cpdict[best_match]) - else: - break - del keys - if self.usemask_list[i]: - usemask.insert(pos, self.usemask_list[i]) - pos = len(usemask) - usemask = set(stack_lists(usemask, incremental=True)) + + usemask = self._getUseMask(cpv_slot) if usemask != self.usemask: self.usemask = usemask has_changed = True @@ -2207,6 +2175,52 @@ class config(object): iuse_implicit.add("bootstrap") return iuse_implicit + def _getUseMask(self, pkg): + cp = getattr(pkg, "cp", None) + if cp is None: + cp = dep_getkey(pkg) + usemask = [] + pos = 0 + for i in xrange(len(self.profiles)): + cpdict = self.pusemask_list[i].get(cp, None) + if cpdict: + keys = cpdict.keys() + while keys: + best_match = best_match_to_list(pkg, keys) + if best_match: + keys.remove(best_match) + usemask.insert(pos, cpdict[best_match]) + else: + break + del keys + if self.usemask_list[i]: + usemask.insert(pos, self.usemask_list[i]) + pos = len(usemask) + return set(stack_lists(usemask, incremental=True)) + + def _getUseForce(self, pkg): + cp = getattr(pkg, "cp", None) + if cp is None: + cp = dep_getkey(pkg) + useforce = [] + pos = 0 + for i in xrange(len(self.profiles)): + cpdict = self.puseforce_list[i].get(cp, None) + if cpdict: + keys = cpdict.keys() + while keys: + best_match = best_match_to_list(pkg, keys) + if best_match: + keys.remove(best_match) + useforce.insert(pos, cpdict[best_match]) + else: + break + del keys + if self.useforce_list[i]: + useforce.insert(pos, self.useforce_list[i]) + pos = len(useforce) + return set(stack_lists(useforce, incremental=True)) + def _getMaskAtom(self, cpv, metadata): """ Take a package and return a matching package.mask atom, or None if no diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index 0900fcfa8..af0e63320 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -150,7 +150,7 @@ class dbapi(object): self._iuse_implicit = self.settings._get_implicit_iuse() for cpv in cpv_iter: try: - iuse, use = self.aux_get(cpv, ["IUSE", "USE"]) + iuse, slot, use = self.aux_get(cpv, ["IUSE", "SLOT", "USE"]) except KeyError: continue use = use.split() @@ -169,6 +169,20 @@ class dbapi(object): continue if atom.use.disabled.intersection(use): continue + else: + # Check masked and forced flags for repoman. + mysettings = getattr(self, "mysettings", None) + if mysettings is not None and not mysettings.local_config: + + pkg = "%s:%s" % (cpv, slot) + usemask = mysettings._getUseMask(pkg) + if usemask.intersection(atom.use.enabled): + continue + + useforce = mysettings._getUseForce(pkg).difference(usemask) + if useforce.intersection(atom.use.disabled): + continue + yield cpv def invalidentry(self, mypath): |