- fix upgrade problem (#489)
This commit is contained in:
+10
-3
@@ -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,\
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user