Handle the case that was intended to be fixed by r11702 (which got reverted).
authorZac Medico <zmedico@gentoo.org>
Mon, 20 Oct 2008 18:21:42 +0000 (18:21 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 20 Oct 2008 18:21:42 +0000 (18:21 -0000)
svn path=/main/trunk/; revision=11705

pym/_emerge/__init__.py

index 03ee50ecac86f356ae4946ed83daeed247dc07d7..0cca793d52740aa6a897312b04363c7c95d10dc1 100644 (file)
@@ -5677,6 +5677,22 @@ class depgraph(object):
                                        if pkg.cp == cp]
                                break
 
+               # If the installed version is in a different slot and it is higher than
+               # the highest available visible package, _iter_atoms_for_pkg() may fail
+               # to properly match the available package with a corresponding argument
+               # atom. Detect this case and correct it here.
+               if not selective and len(matched_packages) > 1 and \
+                       matched_packages[-1].installed and \
+                       matched_packages[-1].slot_atom != \
+                       matched_packages[-2].slot_atom and \
+                       matched_packages[-1] > matched_packages[-2]:
+                       pkg = matched_packages[-2]
+                       if pkg.root == self.target_root and \
+                               self._set_atoms.findAtomForPackage(pkg):
+                               # Select the available package instead
+                               # of the installed package.
+                               matched_packages.pop()
+
                if len(matched_packages) > 1:
                        bestmatch = portage.best(
                                [pkg.cpv for pkg in matched_packages])