- pisi up for replace

This commit is contained in:
Faik Uygur
2007-07-02 07:58:32 +00:00
parent f255616059
commit 1a51484cd1
3 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ def list_available(repo = None):
return set(ctx.packagedb.list_packages(repo = repo))
def list_upgradable():
return filter(pisi.operations.is_upgradable, ctx.installdb.list_installed())
return filter(pisi.operations.is_upgradable, ctx.installdb.list_installed()) + ctx.packagedb.get_replaces().keys()
def package_graph(A, repo = pisi.itembyrepodb.installed, ignore_installed = False):
"""Construct a package relations graph.
+10 -4
View File
@@ -376,12 +376,13 @@ def upgrade_pkg_names(A = []):
ignore_build = ctx.get_option('ignore_build_no')
security_only = ctx.get_option('security_only')
replaced = []
replaces = ctx.packagedb.get_replaces()
if not A:
# if A is empty, then upgrade all packages
A = ctx.installdb.list_installed()
replaced = []
A_0 = A = set(A)
Ap = []
@@ -389,6 +390,11 @@ def upgrade_pkg_names(A = []):
if x.endswith(ctx.const.package_suffix):
ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))
if x in replaces.keys():
Ap.append(replaces[x])
replaced.append(x)
continue
if not ctx.installdb.is_installed(x):
ctx.ui.info(_('Package %s is not installed.') % x, True)
continue
@@ -417,7 +423,7 @@ def upgrade_pkg_names(A = []):
ctx.ui.info(_('Package %s is already at the latest build %s.')
% (pkg.name, pkg.build), True)
A = set(Ap)
if len(A)==0:
@@ -451,7 +457,7 @@ def upgrade_pkg_names(A = []):
if ctx.get_option('dry_run'):
return
if set(order) - A_0:
if set(order) - A_0 - set(replaces.values()):
if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
return False
+1
View File
@@ -67,6 +67,7 @@ class PackageDB(object):
def which_repo(self, name, txn = None):
return self.d.which_repo(name, txn=txn)
# replacesdb holds the info about the replaced packages (ex. gaim -> pidgin)
def get_replaces(self, repo = None):
pairs = {}
for pkg_name in self.drp.list(repo):