summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-06-04 10:16:05 -0700
committerZac Medico <zmedico@gentoo.org>2010-06-04 10:16:05 -0700
commit1745705cd58c380e0f213d572777fe841a1e0f41 (patch)
treee56a9c351952d1e39a97a311cc51604da469c44d
parentecdb5e5648f1797763c2e5568e6c755498105640 (diff)
downloadportage-1745705cd58c380e0f213d572777fe841a1e0f41.tar.gz
portage-1745705cd58c380e0f213d572777fe841a1e0f41.tar.bz2
portage-1745705cd58c380e0f213d572777fe841a1e0f41.zip
When organizing remote binhost metadata into a cpv -> metadata map,
check for multiple packages with identical CPV values, and prefer the package with latest BUILD_TIME value.
-rw-r--r--pym/portage/dbapi/bintree.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index cc53d45a5..d5e2feaf7 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -778,8 +778,32 @@ class binarytree(object):
# file, but that's alright.
if pkgindex:
self._remotepkgs = {}
+
+ # Organize remote package list as a cpv -> metadata map.
+ # If multiple packages have identical CPV values, prefer
+ # the package with latest BUILD_TIME value.
+ remotepkgs = self._remotepkgs
for d in pkgindex.packages:
- self._remotepkgs[d["CPV"]] = d
+ cpv = d["CPV"]
+
+ btime = d.get('BUILD_TIME', '')
+ try:
+ btime = int(btime)
+ except ValueError:
+ btime = None
+ if btime:
+ other_d = remotepkgs.get(cpv)
+ if other_d is not None:
+ other_btime = other_d.get('BUILD_TIME', '')
+ try:
+ other_btime = int(other_btime)
+ except ValueError:
+ other_btime = None
+ if other_btime and other_btime > btime:
+ continue
+
+ remotepkgs[cpv] = d
+
self._remote_has_index = True
self._remote_base_uri = pkgindex.header.get("URI", base_url)
self.__remotepkgs = {}