- fix upgrade problem (#489)

This commit is contained in:
Barış Metin
2005-09-27 13:26:26 +00:00
parent d864b06a9c
commit 78166a1cf6
2 changed files with 14 additions and 4 deletions
+10 -3
View File
@@ -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,\
+4 -1
View File
@@ -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)