- pisi up for replace
This commit is contained in:
+1
-1
@@ -163,7 +163,7 @@ def list_available(repo = None):
|
|||||||
return set(ctx.packagedb.list_packages(repo = repo))
|
return set(ctx.packagedb.list_packages(repo = repo))
|
||||||
|
|
||||||
def list_upgradable():
|
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):
|
def package_graph(A, repo = pisi.itembyrepodb.installed, ignore_installed = False):
|
||||||
"""Construct a package relations graph.
|
"""Construct a package relations graph.
|
||||||
|
|||||||
+10
-4
@@ -376,12 +376,13 @@ def upgrade_pkg_names(A = []):
|
|||||||
ignore_build = ctx.get_option('ignore_build_no')
|
ignore_build = ctx.get_option('ignore_build_no')
|
||||||
security_only = ctx.get_option('security_only')
|
security_only = ctx.get_option('security_only')
|
||||||
|
|
||||||
|
replaced = []
|
||||||
|
replaces = ctx.packagedb.get_replaces()
|
||||||
|
|
||||||
if not A:
|
if not A:
|
||||||
# if A is empty, then upgrade all packages
|
# if A is empty, then upgrade all packages
|
||||||
A = ctx.installdb.list_installed()
|
A = ctx.installdb.list_installed()
|
||||||
|
|
||||||
replaced = []
|
|
||||||
|
|
||||||
A_0 = A = set(A)
|
A_0 = A = set(A)
|
||||||
|
|
||||||
Ap = []
|
Ap = []
|
||||||
@@ -389,6 +390,11 @@ def upgrade_pkg_names(A = []):
|
|||||||
if x.endswith(ctx.const.package_suffix):
|
if x.endswith(ctx.const.package_suffix):
|
||||||
ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))
|
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):
|
if not ctx.installdb.is_installed(x):
|
||||||
ctx.ui.info(_('Package %s is not installed.') % x, True)
|
ctx.ui.info(_('Package %s is not installed.') % x, True)
|
||||||
continue
|
continue
|
||||||
@@ -417,7 +423,7 @@ def upgrade_pkg_names(A = []):
|
|||||||
ctx.ui.info(_('Package %s is already at the latest build %s.')
|
ctx.ui.info(_('Package %s is already at the latest build %s.')
|
||||||
% (pkg.name, pkg.build), True)
|
% (pkg.name, pkg.build), True)
|
||||||
|
|
||||||
|
|
||||||
A = set(Ap)
|
A = set(Ap)
|
||||||
|
|
||||||
if len(A)==0:
|
if len(A)==0:
|
||||||
@@ -451,7 +457,7 @@ def upgrade_pkg_names(A = []):
|
|||||||
if ctx.get_option('dry_run'):
|
if ctx.get_option('dry_run'):
|
||||||
return
|
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?')):
|
if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class PackageDB(object):
|
|||||||
def which_repo(self, name, txn = None):
|
def which_repo(self, name, txn = None):
|
||||||
return self.d.which_repo(name, txn=txn)
|
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):
|
def get_replaces(self, repo = None):
|
||||||
pairs = {}
|
pairs = {}
|
||||||
for pkg_name in self.drp.list(repo):
|
for pkg_name in self.drp.list(repo):
|
||||||
|
|||||||
Reference in New Issue
Block a user