]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
Fix transaction check to work more reliable.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 2 Oct 2011 12:35:17 +0000 (14:35 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 2 Oct 2011 12:35:17 +0000 (14:35 +0200)
python/pakfire/filelist.py
python/pakfire/packages/base.py
python/pakfire/transaction.py

index 53ef346c43c10512f325095a4b8832d8f2de58d6..2eb7e7fc033f7435cce21ab925488035b281d638 100644 (file)
@@ -36,8 +36,6 @@ class File(_File):
        def __cmp__(self, other):
                ret = cmp(self.name, other.name)
 
-               print self.pkg, other.pkg
-
                if not ret:
                        ret = cmp(self.pkg, other.pkg)
 
index 9684fd12582aaecc2ae7305f29b006e4ecec1b1b..8c5ae374e437827c4139c78fa8f93a7d8ae831c1 100644 (file)
@@ -43,19 +43,24 @@ class Package(object):
                if not self.name == other.name:
                        return cmp(self.name, other.name)
 
+               # If UUIDs match, the packages are absolutely equal.
+               if self.uuid == other.uuid:
+                       #logging.debug("%s is equal to %s by UUID" % (self, other))
+                       return 0
+
                ret = util.version_compare(self.pakfire.pool,
                        self.friendly_version, other.friendly_version)
 
                # XXX this is to move packages that have been built a while ago and
                # do not have all the meta information that they won't be evaluated
                # as the best match.
-               if not ret:
-                       if "X"*3 in (self.build_id, other.build_id):
-                               if self.build_id == "X"*3 and not other.build_id == "X"*3:
-                                       ret = -1
-
-                               elif not self.build_id == "X"*3 and other.build_id == "X"*3:
-                                       ret = 1
+               #if not ret:
+               #       if "X"*3 in (self.build_id, other.build_id):
+               #               if self.build_id == "X"*3 and not other.build_id == "X"*3:
+               #                       ret = -1
+               #
+               #               elif not self.build_id == "X"*3 and other.build_id == "X"*3:
+               #                       ret = 1
                # XXX hack end
 
                # Compare the build times if we have a rebuilt package.
index c7b6e72ad416759555c4e70b5c669a7f21b5581b..5f21c9c83fd456af98f4c1b0a624254352f46fd8 100644 (file)
@@ -104,10 +104,11 @@ class TransactionCheck(object):
 
        def remove(self, pkg):
                for file in pkg.filelist:
-                       try:
-                               self.filelist[file.name].remove(file)
-                       except (KeyError, ValueError):
-                               pass
+                       for f in self.filelist[file.name]:
+                               if not f.pkg == pkg:
+                                       continue
+
+                               self.filelist[file.name].remove(f)
 
        def update(self, pkg):
                self.install(pkg)