public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10511 - main/trunk/pym/portage/sets
@ 2008-05-30 23:46 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-05-30 23:46 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-05-30 23:46:08 +0000 (Fri, 30 May 2008)
New Revision: 10511

Modified:
   main/trunk/pym/portage/sets/base.py
Log:
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.


Modified: main/trunk/pym/portage/sets/base.py
===================================================================
--- main/trunk/pym/portage/sets/base.py	2008-05-30 21:20:11 UTC (rev 10510)
+++ main/trunk/pym/portage/sets/base.py	2008-05-30 23:46:08 UTC (rev 10511)
@@ -105,11 +105,20 @@
 		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):
 		"""
 		Find all matching atoms for a given package. This matches virtual

-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-30 23:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-30 23:46 [gentoo-commits] portage r10511 - main/trunk/pym/portage/sets Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox