From 365fa59c64ab36987917230e4097b2d75507ff9c Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Sun, 22 Oct 2006 19:05:26 +0000 Subject: [PATCH] * postpone removing conflicts for upgrade operation until fetching of all the packages finishes and before the actual installation begins. This keeps the system stable while fetching the packages. xorg -> xorg-server case. there is also a new scenario added for testing this bug. fixes #3732 --- pisi/operations.py | 26 ++++++++++++++++++------- scenarios/bug3732scen.py | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 scenarios/bug3732scen.py diff --git a/pisi/operations.py b/pisi/operations.py index eaf55b45..cda9085c 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -174,7 +174,9 @@ in the respective order to satisfy extra dependencies: G_f.write_graphviz(sys.stdout) order = G_f.topological_sort() if not ctx.get_option('ignore_package_conflicts'): - check_conflicts(order, packagedb) + conflicts = check_conflicts(order, packagedb) + if conflicts: + remove_conflicting_packages(conflicts) order.reverse() ctx.ui.info(_('Installation order: ') + util.strlist(order) ) @@ -221,6 +223,10 @@ def calculate_conflicts(order, packagedb): return (C, D, pkg_conflicts) +def remove_conflicting_packages(conflicts): + if remove(conflicts, ignore_dep=True, ignore_safety=True) == False: + raise Error(_("Conflicts remain")) + def check_conflicts(order, packagedb): """check if upgrading to the latest versions will cause havoc done in a simple minded way without regard for dependencies of @@ -243,8 +249,7 @@ def check_conflicts(order, packagedb): if not ctx.ui.confirm(_('Remove the following conflicting packages?')): raise Error(_("Conflicts remain")) - if remove(list(C), ignore_dep=True, ignore_safety=True) == False: - raise Error(_("Conflicts remain")) + return list(C) def expand_components(A): Ap = set() @@ -375,7 +380,9 @@ def plan_install_pkg_names(A, ignore_conflicts = False): order = G_f.topological_sort() order.reverse() if not ctx.get_option('ignore_package_conflicts') and not ignore_conflicts: - check_conflicts(order, ctx.packagedb) + conflicts = check_conflicts(order, ctx.packagedb) + if conflicts: + remove_conflicting_packages(conflicts) return G_f, order def upgrade(A): @@ -444,6 +451,9 @@ def upgrade_pkg_names(A = []): G_f = None order = list(A) + if not ctx.get_option('ignore_package_conflicts'): + conflicts = check_conflicts(order, ctx.packagedb) + ctx.ui.info(_('The following packages will be upgraded: ') + util.strlist(order)) @@ -468,7 +478,11 @@ def upgrade_pkg_names(A = []): # fetch to be upgraded packages but do not install them. if ctx.get_option('fetch_only'): return - + + if not ctx.get_option('ignore_package_conflicts'): + if conflicts: + remove_conflicting_packages(conflicts) + for path in paths: install_op = atomicoperations.Install(path, ignore_file_conflicts = True) install_op.install(True) @@ -543,8 +557,6 @@ def plan_upgrade(A, ignore_build = False, ignore_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_conflicts: - check_conflicts(order, ctx.packagedb) return G_f, order def remove(A, ignore_dep = False, ignore_safety = False): diff --git a/scenarios/bug3732scen.py b/scenarios/bug3732scen.py new file mode 100644 index 00000000..8277d8c5 --- /dev/null +++ b/scenarios/bug3732scen.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# +# Scenario : bug3732scen.py +# +# Source : http://bugs.pardus.org.tr/show_bug.cgi?id=3732 +# +# Problem : If conflicting packages found while upgrading, by removing those prior to +# fetching and installing the desktop may become unusable while upgrading +# process +# +# Problem Description: +# +# This problem appeared in our xorg package split process. The divided packages were +# all marked as conflicting packages to xorg package. But because the xorg package was +# a conflicting package, it is removed before any fetch operation and installing began. +# So some desktop processes could not be started or used properly until the upgrade +# process ends. +# +# Expected: +# +# PiSi should not remove the conflicting packages unless fetching of all the new upgrade +# packages has finished. + +from pisi.scenarioapi.scenario import * + +XORG = "xorg" +QT = "qt" +XORG_SERVER = "xorg-server" +XORG_VIDEO = "xorg-video" +XORG_FONT = "xorg-font" + +let_repo_had(XORG) +let_repo_had(QT, with_dependencies(XORG)) +let_pisi_had(XORG, QT) + +def run(): + repo_added_package(XORG_VIDEO, with_conflicts(XORG)) + repo_added_package(XORG_FONT, with_conflicts(XORG)) + repo_added_package(XORG_SERVER, with_conflicts(XORG), with_dependencies(XORG_VIDEO, XORG_FONT)) + repo_version_bumped(QT, with_removed_dependencies(XORG), with_added_dependencies(XORG_SERVER)) + repo_updated_index() + pisi_upgraded()