* We will pass the conflicting package if it is in the order at the first check,

because the package that is installed may be a conflicting one but the same 
  package in the order (that is going to be installed) may not be a conflicting 
  one. The second test shows us that. If it is then nothing can be done.

  example:
             a version 4 is installed
	     b version 1 is installed
 
             a is upgraded to 5
             b is upgraded to version 2 but now conflicts with a versionTo 4

  now the first check finds the installed a and complains that this is a conflict.
  But a version 5 is already in the order that is going to replace version 4.
  And if the second test does not fail (packages that are going to be installed
  are not conflicting with each other) then this is a go go go. (see bug3865scen)

* more comments added.
This commit is contained in:
Faik Uygur
2006-10-26 10:58:39 +00:00
parent fcc40af294
commit ffc64fc06f
+6 -6
View File
@@ -194,11 +194,11 @@ in the respective order to satisfy extra dependencies:
if 'pisi' in order and pisi_installed:
upgrade_pisi()
def check_conflict(pkg):
def check_conflict(pkg, order):
conflicts = []
for conflict in pkg.conflicts:
if pisi.conflict.installed_package_conflicts(conflict):
if conflict.package not in order and pisi.conflict.installed_package_conflicts(conflict):
conflicts.append(conflict)
return conflicts
@@ -210,17 +210,17 @@ def calculate_conflicts(order, packagedb):
for x in order:
pkg = packagedb.get_package(x)
conflicts = check_conflict(pkg)
# check if any package has conflicts with the installed packages
conflicts = check_conflict(pkg, order)
if conflicts:
pkg_conflicts[x] = map(lambda c:str(c), conflicts)
C = C.union(map(lambda c:c.package, conflicts))
# now check if any package has conflicts with each other
B_i = B_0.intersection(set(map(lambda c:c.package, pkg.conflicts)))
D_i = set()
# check if there are any conflicts within the packages that are
# going to be installed
for p in map(lambda x:packagedb.get_package(x), B_i):
# check if they are really conflicting
conflicted = pisi.conflict.package_conflicts(p, pkg.conflicts)
if conflicted:
D_i.add(str(conflicted))