]> git.ipfire.org Git - pakfire.git/commitdiff
Move packages that do not have all metadata to bottom of sorted lists.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 8 Mar 2011 17:18:50 +0000 (18:18 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 8 Mar 2011 17:18:50 +0000 (18:18 +0100)
pakfire/packages/base.py
pakfire/packages/installed.py

index 2e6fd11bdadde453bfe9f1608bc8ec43a829f62d..5b346253c161d08be3471f5923db2ff1d0549d50 100644 (file)
@@ -26,11 +26,23 @@ class Package(object):
                        return cmp(self.name, other.name)
 
                # Compare the uuids: if packages have the same id they are totally equal.
-               if self.uuid and self.uuid == other.uuid:
+               if self.uuid and other.uuid and self.uuid == other.uuid:
                        return 0
 
                ret = util.version_compare(self.version_tuple, other.version_tuple)
 
+               # 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
+               # XXX hack end
+
                # Compare the build times if we have a rebuilt package.
                if not ret and self.build_time and other.build_time:
                        ret = cmp(self.build_time, other.build_time)
index 8e9c9792211be1c90ef4be564addeb99284b4c4d..22c2a942106cf08b2f65f940a04d28644ede6826 100644 (file)
@@ -85,7 +85,12 @@ class DatabasePackage(Package):
 
        @property
        def build_time(self):
-               return self.metadata.get("build_time")
+               build_time = self.metadata.get("build_time", 0)
+
+               if build_time == "X"*3:
+                       build_time = 0
+
+               return int(build_time)
 
        @property
        def build_host(self):