conflict check before install
This commit is contained in:
+2
-2
@@ -237,7 +237,7 @@ def get_install_order(packages):
|
||||
@param packages: list of package names -> list_of_strings
|
||||
"""
|
||||
install_order = pisi.operations.install.plan_install_pkg_names
|
||||
i_graph, order = install_order(packages, ignore_package_conflicts=True)
|
||||
i_graph, order = install_order(packages)
|
||||
return order
|
||||
|
||||
def get_remove_order(packages):
|
||||
@@ -267,7 +267,7 @@ def get_base_upgrade_order(packages):
|
||||
@param packages: list of package names -> list_of_strings
|
||||
"""
|
||||
upgrade_order = pisi.operations.upgrade.upgrade_base
|
||||
order = upgrade_order(packages, ignore_package_conflicts=True)
|
||||
order = upgrade_order(packages)
|
||||
return list(order)
|
||||
|
||||
def get_conflicts(packages):
|
||||
|
||||
@@ -60,7 +60,7 @@ def check_conflicts(order, packagedb):
|
||||
conflicts)
|
||||
|
||||
if not ctx.ui.confirm(_('Remove the following conflicting packages?')):
|
||||
raise Exception(_("Conflicts remain"))
|
||||
raise Exception(_("Conflicting packages should be removed to continue"))
|
||||
|
||||
return list(C)
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ def install_pkg_names(A, reinstall = False):
|
||||
installs"""
|
||||
|
||||
installdb = pisi.db.installdb.InstallDB()
|
||||
packagedb = pisi.db.packagedb.PackageDB()
|
||||
|
||||
A = [str(x) for x in A] #FIXME: why do we still get unicode input here? :/ -- exa
|
||||
# A was a list, remove duplicates
|
||||
@@ -83,6 +84,10 @@ def install_pkg_names(A, reinstall = False):
|
||||
|
||||
ignore_dep = ctx.config.get_option('ignore_dependency')
|
||||
|
||||
conflicts = []
|
||||
if not ctx.get_option('ignore_package_conflicts'):
|
||||
conflicts = operations.helper.check_conflicts(order, packagedb)
|
||||
|
||||
paths = []
|
||||
for x in order:
|
||||
ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x)+1, len(order)), "yellow"))
|
||||
@@ -93,6 +98,9 @@ def install_pkg_names(A, reinstall = False):
|
||||
if ctx.get_option('fetch_only'):
|
||||
return
|
||||
|
||||
if conflicts:
|
||||
operations.remove.remove_conflicting_packages(conflicts)
|
||||
|
||||
for path in paths:
|
||||
ctx.ui.info(util.colorize(_("Installing %d / %d") % (paths.index(path)+1, len(paths)), "yellow"))
|
||||
install_op = atomicoperations.Install(path)
|
||||
@@ -210,7 +218,7 @@ in the respective order to satisfy extra dependencies:
|
||||
|
||||
return True
|
||||
|
||||
def plan_install_pkg_names(A, ignore_package_conflicts = False):
|
||||
def plan_install_pkg_names(A):
|
||||
# try to construct a pisi graph of packages to
|
||||
# install / reinstall
|
||||
|
||||
@@ -242,8 +250,4 @@ def plan_install_pkg_names(A, ignore_package_conflicts = False):
|
||||
G_f.write_graphviz(sys.stdout)
|
||||
order = G_f.topological_sort()
|
||||
order.reverse()
|
||||
if not ctx.get_option('ignore_package_conflicts') and not ignore_package_conflicts:
|
||||
conflicts = operations.helper.check_conflicts(order, packagedb)
|
||||
if conflicts:
|
||||
operations.remove.remove_conflicting_packages(conflicts)
|
||||
return G_f, order
|
||||
|
||||
@@ -149,6 +149,10 @@ def upgrade_pkg_names(A = [], repo=None):
|
||||
|
||||
ctx.ui.notify(ui.packagestogo, order = order)
|
||||
|
||||
conflicts = []
|
||||
if not ctx.get_option('ignore_package_conflicts'):
|
||||
conflicts = operations.helper.check_conflicts(order, packagedb)
|
||||
|
||||
paths = []
|
||||
for x in order:
|
||||
ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x)+1, len(order)), "yellow"))
|
||||
@@ -159,10 +163,8 @@ def upgrade_pkg_names(A = [], repo=None):
|
||||
if ctx.get_option('fetch_only'):
|
||||
return
|
||||
|
||||
if not ctx.get_option('ignore_package_conflicts'):
|
||||
conflicts = operations.helper.check_conflicts(order, packagedb)
|
||||
if conflicts:
|
||||
operations.remove.remove_conflicting_packages(conflicts)
|
||||
if conflicts:
|
||||
operations.remove.remove_conflicting_packages(conflicts)
|
||||
|
||||
operations.remove.remove_replaced_packages(replaces.keys())
|
||||
operations.remove.remove_obsoleted_packages()
|
||||
@@ -231,7 +233,7 @@ def plan_upgrade(A):
|
||||
order.reverse()
|
||||
return G_f, order
|
||||
|
||||
def upgrade_base(A = set(), ignore_package_conflicts = False):
|
||||
def upgrade_base(A = set()):
|
||||
installdb = pisi.db.installdb.InstallDB()
|
||||
componentdb = pisi.db.componentdb.ComponentDB()
|
||||
ignore_build = ctx.get_option('ignore_build_no')
|
||||
@@ -242,7 +244,7 @@ def upgrade_base(A = set(), ignore_package_conflicts = False):
|
||||
if extra_installs:
|
||||
ctx.ui.warning(_('Safety switch: Following packages in system.base will be installed: ') +
|
||||
util.strlist(extra_installs))
|
||||
G_f, install_order = operations.install.plan_install_pkg_names(extra_installs, ignore_package_conflicts)
|
||||
G_f, install_order = operations.install.plan_install_pkg_names(extra_installs)
|
||||
extra_upgrades = filter(lambda x: is_upgradable(x, ignore_build), systembase - set(install_order))
|
||||
upgrade_order = []
|
||||
if extra_upgrades:
|
||||
|
||||
Reference in New Issue
Block a user