summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-03 22:34:46 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-03 22:34:46 +0000
commit58e4568b10011a5b8dcceff0221bd0cb18c0981a (patch)
tree1f4fdf7b0a149bc489a19f7df6ff83575f5bb674 /pym
parent1129a28eec2fc6215628ffd51d9b8c9b046b6f50 (diff)
downloadportage-58e4568b10011a5b8dcceff0221bd0cb18c0981a.tar.gz
portage-58e4568b10011a5b8dcceff0221bd0cb18c0981a.tar.bz2
portage-58e4568b10011a5b8dcceff0221bd0cb18c0981a.zip
Fix package selection logic so that it always properly finds the highest
available version in a new slot even though the graph already contains a matching version in a lower slot. svn path=/main/trunk/; revision=9693
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py44
1 files changed, 39 insertions, 5 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 80ddca31d..8b6ee4add 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1207,6 +1207,24 @@ class Package(object):
status = "nomerge"
self._digraph_node = (self.type_name, self.root, self.cpv, status)
+ def __lt__(self, other):
+ other_split = portage.catpkgsplit(other.cpv)
+ self_split = portage.catpkgsplit(self.cpv)
+ if other_split[:2] != self_split[:2]:
+ return False
+ if portage.pkgcmp(self_split[1:], other_split[1:]) < 0:
+ return True
+ return False
+
+ def __gt__(self, other):
+ other_split = portage.catpkgsplit(other.cpv)
+ self_split = portage.catpkgsplit(self.cpv)
+ if other_split[:2] != self_split[:2]:
+ return False
+ if portage.pkgcmp(self_split[1:], other_split[1:]) > 0:
+ return True
+ return False
+
def __eq__(self, other):
return self._digraph_node == other
def __ne__(self, other):
@@ -2562,6 +2580,8 @@ class depgraph(object):
portdb = self.roots[root].trees["porttree"].dbapi
# List of acceptable packages, ordered by type preference.
matched_packages = []
+ highest_version = None
+ atom_cp = portage.dep_getkey(atom)
existing_node = None
myeb = None
usepkgonly = "--usepkgonly" in self.myopts
@@ -2626,13 +2646,18 @@ class depgraph(object):
if not installed:
# masked by corruption
continue
+ pkg = Package(built=built, cpv=cpv, installed=installed,
+ metadata=metadata, type_name=pkg_type)
if not installed:
if myarg:
found_available_arg = True
- if not visible(pkgsettings, Package(built=built,
- cpv=cpv, installed=installed, metadata=metadata,
- type_name=pkg_type)):
+ if not visible(pkgsettings, pkg):
continue
+ if pkg.cp == atom_cp:
+ if highest_version is None:
+ highest_version = pkg
+ elif pkg > highest_version:
+ highest_version = pkg
# At this point, we've found the highest visible
# match from the current repo. Any lower versions
# from this repo are ignored, so this so the loop
@@ -2647,8 +2672,17 @@ class depgraph(object):
cpv_slot = "%s:%s" % \
(e_pkg.cpv, e_pkg.metadata["SLOT"])
if portage.dep.match_from_list(atom, [cpv_slot]):
- matched_packages.append(e_pkg)
- existing_node = e_pkg
+ if highest_version and \
+ e_pkg.cp == atom_cp and \
+ e_pkg < highest_version and \
+ e_pkg.slot_atom != highest_version.slot_atom:
+ # There is a higher version available in a
+ # different slot, so this existing node is
+ # irrelevant.
+ pass
+ else:
+ matched_packages.append(e_pkg)
+ existing_node = e_pkg
break
# Compare built package to current config and
# reject the built package if necessary.