def matches(self, prv): if not isinstance(prv, RPMProvides) and type(prv) is not Provides: return False if not self.version or not prv.version: return True selfver, selfarch = splitarch(self.version) prvver, prvarch = splitarch(prv.version) return checkdep(prvver, self.relation, selfver)
def __lt__(self, other): rc = cmp(self.name, other.name) if type(other) is RPMPackage: if rc == 0 and self.version != other.version: selfver, selfarch = splitarch(self.version) otherver, otherarch = splitarch(other.version) if selfver != otherver: rc = vercmp(self.version, other.version) if rc == 0: rc = -cmp(archscore(selfarch), archscore(otherarch)) return rc == -1
def coexists(self, other): if not isinstance(other, RPMPackage): return True if self.version == other.version: return False selfver, selfarch = splitarch(self.version) otherver, otherarch = splitarch(other.version) if getArchColor(selfarch) != getArchColor(otherarch): return True if not pkgconf.testFlag("multi-version", self): return False return selfver != otherver
def matches(self, prv): if not isinstance(prv, RPMNameProvides) and type(prv) is not Provides: return False if self.version and not prv.version: return False if not self.version and prv.version: return True selfver, selfarch = splitarch(self.version) prvver, prvarch = splitarch(prv.version) if (prvarch and selfarch and getArchColor(selfarch) != getArchColor(prvarch)): return False return checkdep(prvver, self.relation, selfver)
def coexists(self, other): if not isinstance(other, RPMPackage): return True if self.version == other.version: return False selfver, selfarch = splitarch(self.version) otherver, otherarch = splitarch(other.version) selfcolor = getArchColor(selfarch) othercolor = getArchColor(otherarch) if (selfcolor and othercolor and selfcolor != othercolor and not sysconf.get("rpm-strict-multilib")): return True if not pkgconf.testFlag("multi-version", self): return False return selfver != otherver
def search(self, searcher, _epochre=re.compile("[0-9]+:")): myname = self.name myversionwithepoch, myarch = splitarch(self.version) myversionwithoutepoch = _epochre.sub("", myversionwithepoch) ratio = 0 ic = searcher.ignorecase for nameversion, cutoff in searcher.nameversion: if _epochre.search(nameversion): myversion = myversionwithepoch else: myversion = myversionwithoutepoch if '@' in nameversion: _, ratio1 = globdistance(nameversion, "%s-%s@%s" % (myname, myversion, myarch), cutoff, ic) _, ratio2 = globdistance(nameversion, "%s@%s" % (myname, myarch), cutoff, ic) _, ratio3 = globdistance(nameversion, "%s-%s@%s" % (myname, splitrelease(myversion)[0], myarch), cutoff, ic) else: _, ratio1 = globdistance(nameversion, myname, cutoff, ic) _, ratio2 = globdistance(nameversion, "%s-%s" % (myname, myversion), cutoff, ic) _, ratio3 = globdistance(nameversion, "%s-%s" % (myname, splitrelease(myversion)[0]), cutoff, ic) ratio = max(ratio, ratio1, ratio2, ratio3) if ratio: searcher.addResult(self, ratio)
def search(self, searcher, _epochre=re.compile("[0-9]+:")): myname = self.name myversionwithepoch, myarch = splitarch(self.version) myversionwithoutepoch = _epochre.sub("", myversionwithepoch) ratio = 0 ic = searcher.ignorecase for nameversion, cutoff in searcher.nameversion: if _epochre.search(nameversion): myversion = myversionwithepoch else: myversion = myversionwithoutepoch if '@' in nameversion: _, ratio1 = globdistance( nameversion, "%s-%s@%s" % (myname, myversion, myarch), cutoff, ic) _, ratio2 = globdistance(nameversion, "%s@%s" % (myname, myarch), cutoff, ic) _, ratio3 = globdistance( nameversion, "%s-%s@%s" % (myname, splitrelease(myversion)[0], myarch), cutoff, ic) else: _, ratio1 = globdistance(nameversion, myname, cutoff, ic) _, ratio2 = globdistance(nameversion, "%s-%s" % (myname, myversion), cutoff, ic) _, ratio3 = globdistance( nameversion, "%s-%s" % (myname, splitrelease(myversion)[0]), cutoff, ic) ratio = max(ratio, ratio1, ratio2, ratio3) if ratio: searcher.addResult(self, ratio)
def search(self, searcher, _epochre=re.compile("[0-9]+:")): myname = self.name myversion, myarch = splitarch(self.version) myversion = _epochre.sub("", myversion) ratio = 0 for nameversion, cutoff in searcher.nameversion: nameversion = _epochre.sub("", nameversion) if '@' in nameversion: _, ratio1 = globdistance(nameversion, "%s-%s" % (myname, self.version), cutoff) _, ratio2 = globdistance(nameversion, "%s@%s" % (myname, myarch), cutoff) _, ratio3 = globdistance(nameversion, "%s-%s@%s" % (myname, splitrelease(myversion)[0], myarch), cutoff) else: _, ratio1 = globdistance(nameversion, myname, cutoff) _, ratio2 = globdistance(nameversion, "%s-%s" % (myname, myversion), cutoff) _, ratio3 = globdistance(nameversion, "%s-%s" % (myname, splitrelease(myversion)[0]), cutoff) ratio = max(ratio, ratio1, ratio2, ratio3) if ratio: searcher.addResult(self, ratio)
def __lt__(self, other): rc = cmp(self.name, other.name) if type(other) is RPMPackage: if rc == 0 and self.version != other.version: selfver, selfarch = splitarch(self.version) otherver, otherarch = splitarch(other.version) if selfarch != otherarch: selfcolor = getArchColor(selfarch) othercolor = getArchColor(otherarch) if selfcolor and othercolor: rc = cmp(selfcolor, othercolor) if rc == 0: if selfver != otherver: rc = vercmp(selfver, otherver) if rc == 0: rc = -cmp(getArchScore(selfarch), getArchScore(otherarch)) return rc == -1
def coexists(self, other): if not isinstance(other, RPMPackage): return True if self.version == other.version: return False selfver, selfarch = splitarch(self.version) otherver, otherarch = splitarch(other.version) if selfarch != otherarch: return True selfcolor = getArchColor(selfarch) othercolor = getArchColor(otherarch) if (selfcolor and othercolor and selfcolor != othercolor and not sysconf.get("rpm-strict-multilib")): return True if not pkgconf.testFlag("multi-version", self): return False return selfver != otherver
def matches(self, relation, version): if not relation: return True selfver, selfarch = splitarch(self.version) ver, arch = splitarch(version) return checkdep(selfver, relation, ver)