From 78166a1cf60f60d34b408ec1369020b807c4d1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Tue, 27 Sep 2005 13:26:26 +0000 Subject: [PATCH] - fix upgrade problem (#489) --- pisi/api.py | 13 ++++++++++--- tests/versiontests.py | 5 ++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 4b78d3a4..c659210c 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -280,11 +280,18 @@ def upgrade_pkg_names(A): continue (version, release, build) = ctx.installdb.get_version(x) pkg = packagedb.get_package(x) - if ignore_build or (not build): + + # First check version. If they are same, check release. Again + # if releases are same and checking buildno is premitted, + # check build number. + if version < pkg.version: + Ap.append(x) + elif version == pkg.version: if release < pkg.release: Ap.append(x) - elif build < pkg.build: - Ap.append(x) + if release == pkg.release and build and not ignore_build: + if build < pkg.build: + Ap.append(x) else: #ctx.ui.info('Package %s cannot be upgraded. ' % x) ctx.ui.info('Package %s is already at its latest version %s,\ diff --git a/tests/versiontests.py b/tests/versiontests.py index 19250b62..ce6e3ae1 100644 --- a/tests/versiontests.py +++ b/tests/versiontests.py @@ -47,6 +47,9 @@ class VersionTestCase(unittest.TestCase): self.assert_(v1 > v2) self.assert_(v1 < v3) self.assert_(v2 < v3) - + + v1 = version.Version("pisi-1.0_alpha1") + v2 = version.Version("pisi-1.0_alpha2") + self.assert_(v2 > v1) suite = unittest.makeSuite(VersionTestCase)