From 0b46c4a70699f645aaa96f68e019523538424fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Mon, 8 Mar 2010 09:26:07 +0000 Subject: [PATCH] index: If the build numbers are same, use the release number. Pisi was selecting "icon-naming-utils-0.8.90-7-1.pisi" when both icon-naming-utils-0.8.90-7-1.pisi icon-naming-utils-0.8.90-8-1.pisi files exist in the same directory. With this commit, it chooses the one with greater release number. --- pisi/util.py | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/pisi/util.py b/pisi/util.py index f038239c..6dfc3bf9 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -640,21 +640,35 @@ def filter_latest_packages(package_paths): name, version = parse_package_name(os.path.basename(path[:-len(ctx.const.package_suffix)])) if latest.has_key(name): - l_version = pisi.version.Version(latest[name][2]) - r_version = pisi.version.Version(version) + l_version, l_release, l_build = split_version(latest[name][2]) + r_version, r_release, r_build = split_version(version) - # Bug 6352 - # If version format changes in repo and a repo also keeps the old packages (bad.bad.bad.) - # than only use the build nos - if l_version.build and r_version.build: - if l_version.build < r_version.build: - latest[name] = (root, name, version) - else: - if l_version < r_version: - latest[name] = (root, name, version) - else: - if version: - latest[name] = (root, name, version) + try: + l_release = int(l_release) + r_release = int(r_release) + + l_build = int(l_build) if l_build else None + r_build = int(r_build) if r_build else None + + except ValueError: + continue + + if l_build and r_build: + if l_build > r_build: + continue + + elif l_release > r_release: + continue + + elif l_release == r_release: + l_version = pisi.version.Version(l_version) + r_version = pisi.version.Version(r_version) + + if l_version > r_version: + continue + + if version: + latest[name] = (root, name, version) return map(lambda x:"%s/%s-%s.pisi" % x, latest.values())