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

Author: zmedico
Date: 2008-05-30 23:53:13 +0000 (Fri, 30 May 2008)
New Revision: 10512

Modified:
   main/branches/2.1.2/bin/emerge
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. (trunk r10511)


Modified: main/branches/2.1.2/bin/emerge
===================================================================
--- main/branches/2.1.2/bin/emerge	2008-05-30 23:46:08 UTC (rev 10511)
+++ main/branches/2.1.2/bin/emerge	2008-05-30 23:53:13 UTC (rev 10512)
@@ -818,11 +818,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[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):
 		"""
 		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:53 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:53 [gentoo-commits] portage r10512 - main/branches/2.1.2/bin 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