summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-30 23:46:08 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-30 23:46:08 +0000
commit0ab17a249aa27220c00dad07c7c94f90b617ccd0 (patch)
tree6f7443763491859b6a2a70a36a5c7dd4cea0cbb0 /pym
parentb91006f024eac5921e72a1736e48c34618e23dbf (diff)
downloadportage-0ab17a249aa27220c00dad07c7c94f90b617ccd0.tar.gz
portage-0ab17a249aa27220c00dad07c7c94f90b617ccd0.tar.bz2
portage-0ab17a249aa27220c00dad07c7c94f90b617ccd0.zip
Fix PackageSet.findAtomForPackage() to find the most specific atom since
it can affect behavior when deciding whether or not to add a slot atom to the world file. svn path=/main/trunk/; revision=10511
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/sets/base.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/pym/portage/sets/base.py b/pym/portage/sets/base.py
index 2ae4723fb..d9f2a8d91 100644
--- a/pym/portage/sets/base.py
+++ b/pym/portage/sets/base.py
@@ -105,10 +105,19 @@ class PackageSet(object):
None if there are no matches. This matches virtual arguments against
the PROVIDE metadata. This can raise an InvalidDependString exception
if an error occurs while parsing PROVIDE."""
- try:
- return self.iterAtomsForPackage(pkg).next()
- except StopIteration:
- return None
+
+ # Atoms matched via PROVIDE must be temporarily transformed since
+ # match_from_list() only works correctly when atom.cp == pkg.cp.
+ rev_transform = {}
+ for atom in self.iterAtomsForPackage(pkg):
+ if atom.cp == pkg.cp:
+ rev_transform[atom] = atom
+ else:
+ rev_transform[Atom(atom.replace(atom.cp, pkg.cp, 1))] = atom
+ best_match = best_match_to_list(pkg, rev_transform.iterkeys())
+ if best_match:
+ return rev_transform[best_match]
+ return None
def iterAtomsForPackage(self, pkg):
"""