Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
 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)
Пример #7
0
 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)
Пример #8
0
 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
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
 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)
Пример #12
0
 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
Пример #13
0
 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
Пример #14
0
 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
Пример #15
0
 def matches(self, relation, version):
     if not relation:
         return True
     selfver, selfarch = splitarch(self.version)
     ver, arch = splitarch(version)
     return checkdep(selfver, relation, ver)
Пример #16
0
 def matches(self, relation, version):
     if not relation:
         return True
     selfver, selfarch = splitarch(self.version)
     ver, arch = splitarch(version)
     return checkdep(selfver, relation, ver)