### Eclipse Workspace Patch 1.0 #P yum Index: yum/packages.py =================================================================== RCS file: /cvsroot/yum/cvs/yum/yum/packages.py,v retrieving revision 1.73 diff -u -r1.73 packages.py --- yum/packages.py 2 Oct 2006 14:42:55 -0000 1.73 +++ yum/packages.py 12 Oct 2006 07:43:13 -0000 @@ -171,6 +171,7 @@ for (csumtype, csum, csumid) in self.checksums: if csumid: return (csumtype, csum) + class RpmBase: """return functions and storage for rpm-specific data""" @@ -188,37 +189,8 @@ self._changelog = [] # (ctime, cname, ctext) self.licenses = [] - def __lt__(self, other): - if comparePoEVR(self, other) < 0: - return True - return False - - - def __gt__(self, other): - if comparePoEVR(self, other) > 0: - return True - return False - - def __le__(self, other): - if comparePoEVR(self, other) <= 0: - return True - return False - - def __ge__(self, other): - if comparePoEVR(self, other) >= 0: - return True - return False - - def __eq__(self, other): - if comparePoEVR(self, other) == 0: - return True - return False - - def __ne__(self, other): - if comparePoEVR(self, other) != 0: - return True - return False - + def returnEVR(self): + return packageEVR(self.epoch,self.ver,self.rel) def __hash__(self): mystr = '%s - %s:%s-%s-%s.%s' % (self.repo.id, self.epoch, self.name, @@ -347,8 +319,50 @@ conflicts_print = property(fget=lambda self: self.returnPrco('conflicts', True)) obsoletes_print = property(fget=lambda self: self.returnPrco('obsoletes', True)) changelog = property(fget=lambda self: self.returnChangelog()) + EVR = property(fget=self.returnEVR()) + +class PackageEVR: + def init(self,e,v,r): + self.epoch = e + self.ver = v + self.release + + def compare(self,other): + return rpmUtils.miscutils.compareEVR((self.epoch, self.ver, self.rel), (other.epoch, other.ver, other.rel)) + def __lt__(self, other): + if self.compare(other) < 0: + return True + return False + + + def __gt__(self, other): + if self.compare(other) > 0: + return True + return False + + def __le__(self, other): + if self.compare(other) <= 0: + return True + return False + + def __ge__(self, other): + if self.compare(other) >= 0: + return True + return False + + def __eq__(self, other): + if self.compare(other) == 0: + return True + return False + + def __ne__(self, other): + if self.compare(other) != 0: + return True + return False + + class YumAvailablePackage(PackageObject, RpmBase): """derived class for the packageobject and RpmBase packageobject yum