summaryrefslogtreecommitdiffstats
path: root/findpackageset.py
diff options
context:
space:
mode:
authorPaul Nasrat <pnasrat@redhat.com>2004-11-10 16:57:16 +0000
committerPaul Nasrat <pnasrat@redhat.com>2004-11-10 16:57:16 +0000
commit616c1db1e10cd1ee41447c62e5019a083c07517d (patch)
treeb63f4404b312fe215629f76ec2e4c59df75a1b1c /findpackageset.py
parentb910c683b6d7ea2dd48c97628b5eaf6a68cfae7d (diff)
downloadanaconda-616c1db1e10cd1ee41447c62e5019a083c07517d.tar.gz
anaconda-616c1db1e10cd1ee41447c62e5019a083c07517d.tar.xz
anaconda-616c1db1e10cd1ee41447c62e5019a083c07517d.zip
Fix for obsoletes E being long. Gratuitously borrowed from rpmUtils
Diffstat (limited to 'findpackageset.py')
-rw-r--r--findpackageset.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/findpackageset.py b/findpackageset.py
index cfcc659c3..df9904136 100644
--- a/findpackageset.py
+++ b/findpackageset.py
@@ -1,6 +1,7 @@
import rpm
import rhpl.arch
import string
+import types
from constants import *
# set DB_PRIVATE to make rpm happy
@@ -146,7 +147,7 @@ def findpackageset(hdrlist, dbPath='/'):
epoch = '0'
else:
epoch = str(h[rpm.RPMTAG_EPOCH])
- val = rpm.labelCompare(oevr,(epoch,h[rpm.RPMTAG_VERSION],h[rpm.RPMTAG_RELEASE]))
+ val = compareEVR(oevr,(epoch,h[rpm.RPMTAG_VERSION],h[rpm.RPMTAG_RELEASE]))
if val > 0:
# dEBUG("adding %(name)s %(version)s to the upgrade set for obsoletes" % pkg)
updDict[(name,arch)] = pkg
@@ -154,6 +155,26 @@ def findpackageset(hdrlist, dbPath='/'):
return updDict.values()
+def rpmOutToStr(arg):
+ if type(arg) != types.StringType:
+ # and arg is not None:
+ arg = str(arg)
+
+ return arg
+
+def compareEVR((e1, v1, r1), (e2, v2, r2)):
+ # return 1: a is newer than b
+ # 0: a and b are the same version
+ # -1: b is newer than a
+ e1 = rpmOutToStr(e1)
+ v1 = rpmOutToStr(v1)
+ r1 = rpmOutToStr(r1)
+ e2 = rpmOutToStr(e2)
+ v2 = rpmOutToStr(v2)
+ r2 = rpmOutToStr(r2)
+ rc = rpm.labelCompare((e1, v1, r1), (e2, v2, r2))
+ return rc
+
def strToVersion(str):
"""Parse a string such as in obsoleteversion into evr.
Gratuitously borrowed from yum str_to_version