diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-30 23:53:13 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-30 23:53:13 +0000 |
commit | 6887a42fea71a30e410ad439ca25752a3d372f4c (patch) | |
tree | 8b613d57c94bac576d595a20f5594e40a2930158 | |
parent | df8d7c3a2a75c15905177c2b8418704968f20aa7 (diff) | |
download | portage-6887a42fea71a30e410ad439ca25752a3d372f4c.tar.gz portage-6887a42fea71a30e410ad439ca25752a3d372f4c.tar.bz2 portage-6887a42fea71a30e410ad439ca25752a3d372f4c.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. (trunk r10511)
svn path=/main/branches/2.1.2/; revision=10512
-rwxr-xr-x | bin/emerge | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/emerge b/bin/emerge index ef970e4cf..72955612f 100755 --- a/bin/emerge +++ b/bin/emerge @@ -818,10 +818,19 @@ class InternalPackageSet(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[portage_dep.Atom(atom.replace(atom.cp, pkg.cp, 1))] = atom + best_match = portage.best_match_to_list(pkg, rev_transform.iterkeys()) + if best_match: + return rev_transform[best_match] + return None def iterAtomsForPackage(self, pkg): """ |