summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-10-31 21:37:18 +0000
committerZac Medico <zmedico@gentoo.org>2008-10-31 21:37:18 +0000
commit6e23ac656350976f211728a3f22df29925647202 (patch)
treeae6af9b12411a473d786cdda47beda10b8a7ea76
parent8668b31fdc005d521ce991b1c7542dcc6f385452 (diff)
downloadportage-6e23ac656350976f211728a3f22df29925647202.tar.gz
portage-6e23ac656350976f211728a3f22df29925647202.tar.bz2
portage-6e23ac656350976f211728a3f22df29925647202.zip
Bug #244947 - Add basic repoman support for checking masked and forced flags
when verifying USE deps. TODO: Add repoman support in dep_check() for evaluation of conditional USE deps based on forced/masked flags. masked flags, so that repoman can also svn path=/main/trunk/; revision=11768
-rw-r--r--pym/portage/__init__.py86
-rw-r--r--pym/portage/dbapi/__init__.py16
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):