From 0b2b1fa677b8afede751d255b29f32178352e0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Tue, 2 May 2006 15:42:22 +0000 Subject: [PATCH] * fix: release's are strings not integers any more --- pisi/api.py | 7 ++++--- pisi/operations.py | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 78e86c45..d8e7e649 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -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 diff --git a/pisi/operations.py b/pisi/operations.py index e8877d77..45c94337 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -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