* 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 from pisi.file import File
import pisi.search import pisi.search
import pisi.lockeddbshelve as shelve import pisi.lockeddbshelve as shelve
from pisi.version import Version
class Error(pisi.Error): class Error(pisi.Error):
pass pass
@@ -146,13 +147,14 @@ def list_upgradable():
ignore_build = ctx.get_option('ignore_build_no') ignore_build = ctx.get_option('ignore_build_no')
A = ctx.installdb.list_installed() A = ctx.installdb.list_installed()
# filter packages that are not upgradable # filter packages that are not upgradable
Ap = [] Ap = []
for x in A: for x in A:
(version, release, build) = ctx.installdb.get_version(x) (version, release, build) = ctx.installdb.get_version(x)
pkg = ctx.packagedb.get_package(x) pkg = ctx.packagedb.get_package(x)
if ignore_build or (not build): if ignore_build or (not build) or (not pkg.build):
if release < pkg.release: if Version(release) < Version(pkg.release):
Ap.append(x) Ap.append(x)
elif build < pkg.build: elif build < pkg.build:
Ap.append(x) Ap.append(x)
@@ -161,7 +163,6 @@ def list_upgradable():
#ctx.ui.info('Package %s cannot be upgraded. ' % x) #ctx.ui.info('Package %s cannot be upgraded. ' % x)
return Ap return Ap
def package_graph(A, ignore_installed = False): def package_graph(A, ignore_installed = False):
"""Construct a package relations graph, containing """Construct a package relations graph, containing
all dependencies of packages A, if ignore_installed 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.cli
import pisi.atomicoperations as atomicoperations import pisi.atomicoperations as atomicoperations
import pisi.ui as ui import pisi.ui as ui
from pisi.version import Version
class Error(pisi.Error): class Error(pisi.Error):
pass pass
@@ -334,7 +335,7 @@ def upgrade_pkg_names(A = []):
pkg = ctx.packagedb.get_package(x) pkg = ctx.packagedb.get_package(x)
if ignore_build or (not build) or (not pkg.build): if ignore_build or (not build) or (not pkg.build):
if release < pkg.release: if Version(release) < Version(pkg.release):
Ap.append(x) Ap.append(x)
else: else:
ctx.ui.info(_('Package %s is already at the latest release %s.') 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)) ctx.ui.debug('A = %s' % str(A))
if not ctx.config.get_option('ignore_dependency'): if not ctx.config.get_option('ignore_dependency'):
G_f, order = plan_upgrade(A) G_f, order = plan_upgrade(A, ignore_build)
else: else:
G_f = None G_f = None
order = A order = A
@@ -376,7 +377,7 @@ def upgrade_pkg_names(A = []):
for install in install_ops: for install in install_ops:
install.install(True) install.install(True)
def plan_upgrade(A): def plan_upgrade(A, ignore_build = False):
# try to construct a pisi graph of packages to # try to construct a pisi graph of packages to
# install / reinstall # install / reinstall
@@ -398,7 +399,7 @@ def plan_upgrade(A):
rep_pkg.build) rep_pkg.build)
if ignore_build or (not b) or (not bp): if ignore_build or (not b) or (not bp):
# if we can't look at build # if we can't look at build
if r >= rp: # installed already new if Version(r) >= Version(rp): # installed already new
return False return False
elif b and bp and b >= bp: elif b and bp and b >= bp:
return False return False