From: Michael Tremer Date: Sun, 2 Oct 2011 12:35:17 +0000 (+0200) Subject: Fix transaction check to work more reliable. X-Git-Tag: 0.9.10~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0d6d9075aa18c3813fa53da23f3f2a2eb50e479;p=pakfire.git Fix transaction check to work more reliable. --- diff --git a/python/pakfire/filelist.py b/python/pakfire/filelist.py index 53ef346c4..2eb7e7fc0 100644 --- a/python/pakfire/filelist.py +++ b/python/pakfire/filelist.py @@ -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) diff --git a/python/pakfire/packages/base.py b/python/pakfire/packages/base.py index 9684fd125..8c5ae374e 100644 --- a/python/pakfire/packages/base.py +++ b/python/pakfire/packages/base.py @@ -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. diff --git a/python/pakfire/transaction.py b/python/pakfire/transaction.py index c7b6e72ad..5f21c9c83 100644 --- a/python/pakfire/transaction.py +++ b/python/pakfire/transaction.py @@ -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)