Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10511 - main/trunk/pym/portage/sets
Date: Fri, 30 May 2008 23:46:15
Message-Id: E1K2EIT-0003Wq-AM@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-05-30 23:46:08 +0000 (Fri, 30 May 2008)
3 New Revision: 10511
4
5 Modified:
6 main/trunk/pym/portage/sets/base.py
7 Log:
8 Fix PackageSet.findAtomForPackage() to find the most specific atom since
9 it can affect behavior when deciding whether or not to add a slot atom to
10 the world file.
11
12
13 Modified: main/trunk/pym/portage/sets/base.py
14 ===================================================================
15 --- main/trunk/pym/portage/sets/base.py 2008-05-30 21:20:11 UTC (rev 10510)
16 +++ main/trunk/pym/portage/sets/base.py 2008-05-30 23:46:08 UTC (rev 10511)
17 @@ -105,11 +105,20 @@
18 None if there are no matches. This matches virtual arguments against
19 the PROVIDE metadata. This can raise an InvalidDependString exception
20 if an error occurs while parsing PROVIDE."""
21 - try:
22 - return self.iterAtomsForPackage(pkg).next()
23 - except StopIteration:
24 - return None
25
26 + # Atoms matched via PROVIDE must be temporarily transformed since
27 + # match_from_list() only works correctly when atom.cp == pkg.cp.
28 + rev_transform = {}
29 + for atom in self.iterAtomsForPackage(pkg):
30 + if atom.cp == pkg.cp:
31 + rev_transform[atom] = atom
32 + else:
33 + rev_transform[Atom(atom.replace(atom.cp, pkg.cp, 1))] = atom
34 + best_match = best_match_to_list(pkg, rev_transform.iterkeys())
35 + if best_match:
36 + return rev_transform[best_match]
37 + return None
38 +
39 def iterAtomsForPackage(self, pkg):
40 """
41 Find all matching atoms for a given package. This matches virtual
42
43 --
44 gentoo-commits@l.g.o mailing list