* fix: release's are strings not integers any more

This commit is contained in:
Eray Özkural
2006-05-02 15:42:22 +00:00
parent 2f51731d6f
commit 0b2b1fa677
2 changed files with 9 additions and 7 deletions
+4 -3
View File
@@ -46,6 +46,7 @@ from pisi.files import Files
from pisi.file import File
import pisi.search
import pisi.lockeddbshelve as shelve
from pisi.version import Version
class Error(pisi.Error):
pass
@@ -146,13 +147,14 @@ def list_upgradable():
ignore_build = ctx.get_option('ignore_build_no')
A = ctx.installdb.list_installed()
# filter packages that are not upgradable
Ap = []
for x in A:
(version, release, build) = ctx.installdb.get_version(x)
pkg = ctx.packagedb.get_package(x)
if ignore_build or (not build):
if release < pkg.release:
if ignore_build or (not build) or (not pkg.build):
if Version(release) < Version(pkg.release):
Ap.append(x)
elif build < pkg.build:
Ap.append(x)
@@ -161,7 +163,6 @@ def list_upgradable():
#ctx.ui.info('Package %s cannot be upgraded. ' % x)
return Ap
def package_graph(A, ignore_installed = False):
"""Construct a package relations graph, containing
all dependencies of packages A, if ignore_installed
+5 -4
View File
@@ -36,6 +36,7 @@ from pisi.index import Index
import pisi.cli
import pisi.atomicoperations as atomicoperations
import pisi.ui as ui
from pisi.version import Version
class Error(pisi.Error):
pass
@@ -334,7 +335,7 @@ def upgrade_pkg_names(A = []):
pkg = ctx.packagedb.get_package(x)
if ignore_build or (not build) or (not pkg.build):
if release < pkg.release:
if Version(release) < Version(pkg.release):
Ap.append(x)
else:
ctx.ui.info(_('Package %s is already at the latest release %s.')
@@ -354,7 +355,7 @@ def upgrade_pkg_names(A = []):
ctx.ui.debug('A = %s' % str(A))
if not ctx.config.get_option('ignore_dependency'):
G_f, order = plan_upgrade(A)
G_f, order = plan_upgrade(A, ignore_build)
else:
G_f = None
order = A
@@ -376,7 +377,7 @@ def upgrade_pkg_names(A = []):
for install in install_ops:
install.install(True)
def plan_upgrade(A):
def plan_upgrade(A, ignore_build = False):
# try to construct a pisi graph of packages to
# install / reinstall
@@ -398,7 +399,7 @@ def plan_upgrade(A):
rep_pkg.build)
if ignore_build or (not b) or (not bp):
# if we can't look at build
if r >= rp: # installed already new
if Version(r) >= Version(rp): # installed already new
return False
elif b and bp and b >= bp:
return False