def rpmspec(self): if not self._rpmspec: if not RPM_AVAILABLE: raise exception.RpmModuleNotAvailable() rpm.addMacro('_sourcedir', os.path.dirname(os.path.realpath(self.fn))) try: self._rpmspec = rpm.spec(self.fn) except ValueError, e: raise exception.SpecFileParseError(spec_fn=self.fn, error=e.args[0])
def nvr2version(nvr): if not RPM_AVAILABLE: raise exception.RpmModuleNotAvailable() _, v, _, _, _ = rpmUtils.miscutils.splitFilename(nvr) return v
def vcmp(v1, v2): if not RPM_AVAILABLE: raise exception.RpmModuleNotAvailable() t1 = ('0', v1, '') t2 = ('0', v2, '') return rpm.labelCompare(t1, t2)
def nvrcmp(nvr1, nvr2): if not RPM_AVAILABLE: raise exception.RpmModuleNotAvailable() t1 = rpmUtils.miscutils.stringToVersion(nvr1) t2 = rpmUtils.miscutils.stringToVersion(nvr2) return rpm.labelCompare(t1, t2)