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