From a81590a42a83e53fb95ab945524ab3c4f5192d22 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:08 +0000 Subject: [PATCH] api: Do not use Version class for full package versions --- pisi/api.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 0d04e13b..30e21d34 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -923,19 +923,30 @@ def clearCache(all=False): latest = {} for f in pkgList: try: - name, version = util.parse_package_name(f) - if latest.has_key(name): - if Version(latest[name]) < Version(version): - latest[name] = version - else: - if version: - latest[name] = version + name, full_version = util.parse_package_name(f) + version, release, build = pisi.util.split_version(full_version) + + version = Version(version) + release = int(release) + if build: + build = int(build) + + if name in latest: + lversion, lrelease, lbuild = latest[name] + if lbuild and build: + if lbuild > build: + continue + elif lrelease > release: + continue + + latest[name] = full_version, release, build + except: pass latestVersions = [] for pkg in latest: - latestVersions.append("%s-%s" % (pkg, latest[pkg])) + latestVersions.append("%s-%s" % (pkg, latest[pkg][0])) oldVersions = list(set(pkgList) - set(latestVersions)) return oldVersions, latestVersions