- replaced packages should be calculated after order

This commit is contained in:
Faik Uygur
2007-07-02 11:03:35 +00:00
parent e325517ed6
commit 1cf5bd7dd0
+16 -8
View File
@@ -207,6 +207,20 @@ in the respective order to satisfy extra dependencies:
if 'pisi' in order and pisi_installed: if 'pisi' in order and pisi_installed:
upgrade_pisi() upgrade_pisi()
def remove_replaced_packages(order, replaces):
replaced = []
inorder = set(order).intersection(replaces.values())
if inorder:
for pkg in replaces.keys():
if replaces[pkg] in inorder:
replaced.append(pkg)
if replaced:
if remove(replaced, ignore_dep=True, ignore_safety=True):
raise Error(_("Replaced package remains"))
def remove_conflicting_packages(conflicts): def remove_conflicting_packages(conflicts):
if remove(conflicts, ignore_dep=True, ignore_safety=True): if remove(conflicts, ignore_dep=True, ignore_safety=True):
raise Error(_("Conflicts remain")) raise Error(_("Conflicts remain"))
@@ -393,15 +407,10 @@ def upgrade_pkg_names(A = []):
# Handling of replacement packages # Handling of replacement packages
if x in replaces.values(): if x in replaces.values():
Ap.append(x) Ap.append(x)
pkg = ctx.packagedb.get_package(x)
for r in pkg.replaces:
if pisi.replace.installed_package_replaced(r):
replaced.append(r.package)
continue continue
if x in replaces.keys(): if x in replaces.keys():
Ap.append(replaces[x]) Ap.append(replaces[x])
replaced.append(x)
continue continue
if not ctx.installdb.is_installed(x): if not ctx.installdb.is_installed(x):
@@ -486,9 +495,8 @@ def upgrade_pkg_names(A = []):
if conflicts: if conflicts:
remove_conflicting_packages(conflicts) remove_conflicting_packages(conflicts)
# remove replaced or obsoleted packages if replaces:
if replaced: remove_replaced_packages(order, replaces)
remove(replaced, ignore_dep=True, ignore_safety=True)
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"))