replaced packages are also obsoleted packages, they will already be

removed in remove_obsoleted_packages
This commit is contained in:
Faik Uygur
2008-11-05 09:30:21 +00:00
parent 9661a234b8
commit 860844cf8d
2 changed files with 1 additions and 20 deletions
-16
View File
@@ -114,27 +114,11 @@ def plan_remove(A):
order = G_f.topological_sort() order = G_f.topological_sort()
return G_f, order return G_f, order
# FIXME: this should be done in atomicoperations automatically.
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 Exception(_("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 Exception(_("Conflicts remain")) raise Exception(_("Conflicts remain"))
def remove_obsoleted_packages(): def remove_obsoleted_packages():
installdb = pisi.db.installdb.InstallDB() installdb = pisi.db.installdb.InstallDB()
packagedb = pisi.db.packagedb.PackageDB() packagedb = pisi.db.packagedb.PackageDB()
obsoletes = filter(installdb.has_package, packagedb.get_obsoletes()) obsoletes = filter(installdb.has_package, packagedb.get_obsoletes())
+1 -4
View File
@@ -147,11 +147,8 @@ def upgrade_pkg_names(A = []):
if conflicts: if conflicts:
operations.remove.remove_conflicting_packages(conflicts) operations.remove.remove_conflicting_packages(conflicts)
if replaces:
operations.remove.remove_replaced_packages(order, replaces)
operations.remove.remove_obsoleted_packages() operations.remove.remove_obsoleted_packages()
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, ignore_file_conflicts = True) install_op = atomicoperations.Install(path, ignore_file_conflicts = True)