diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-04-28 20:31:12 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-04-28 20:31:12 +0000 |
commit | 22942f33824ab654e6a52ce552e2f9c06b908abf (patch) | |
tree | 903fd466abc03728f7f42313eb8cd62162bfaa75 /bin | |
parent | 9118cbb6309a4f64f87ce759f0a46e4bb857b16f (diff) | |
download | portage-22942f33824ab654e6a52ce552e2f9c06b908abf.tar.gz portage-22942f33824ab654e6a52ce552e2f9c06b908abf.tar.bz2 portage-22942f33824ab654e6a52ce552e2f9c06b908abf.zip |
Add a Package.pv_split attibute to optimize version comparison
operators. (trunk r10026)
svn path=/main/branches/2.1.2/; revision=10027
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/emerge | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/bin/emerge b/bin/emerge index 1242eb5ca..63de21c38 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1404,12 +1404,13 @@ class Blocker(Task): class Package(Task): __slots__ = ("built", "cpv", "depth", "installed", "metadata", "root", "onlydeps", "type_name", - "cp", "cpv_slot", "slot_atom") + "cp", "cpv_slot", "pv_split", "slot_atom") def __init__(self, **kwargs): Task.__init__(self, **kwargs) self.cp = portage.cpv_getkey(self.cpv) self.slot_atom = "%s:%s" % (self.cp, self.metadata["SLOT"]) self.cpv_slot = "%s:%s" % (self.cpv, self.metadata["SLOT"]) + self.pv_split = portage.catpkgsplit(self.cpv)[1:] def _get_hash_key(self): hash_key = getattr(self, "_hash_key", None) @@ -1422,38 +1423,30 @@ class Package(Task): return self._hash_key def __lt__(self, other): - other_split = portage.catpkgsplit(other.cpv) - self_split = portage.catpkgsplit(self.cpv) - if other_split[:2] != self_split[:2]: + if other.cp != self.cp: return False - if portage.pkgcmp(self_split[1:], other_split[1:]) < 0: + if portage.pkgcmp(self.pv_split, other.pv_split) < 0: return True return False def __le__(self, other): - other_split = portage.catpkgsplit(other.cpv) - self_split = portage.catpkgsplit(self.cpv) - if other_split[:2] != self_split[:2]: + if other.cp != self.cp: return False - if portage.pkgcmp(self_split[1:], other_split[1:]) <= 0: + if portage.pkgcmp(self.pv_split, other.pv_split) <= 0: return True return False def __gt__(self, other): - other_split = portage.catpkgsplit(other.cpv) - self_split = portage.catpkgsplit(self.cpv) - if other_split[:2] != self_split[:2]: + if other.cp != self.cp: return False - if portage.pkgcmp(self_split[1:], other_split[1:]) > 0: + if portage.pkgcmp(self.pv_split, other.pv_split) > 0: return True return False def __ge__(self, other): - other_split = portage.catpkgsplit(other.cpv) - self_split = portage.catpkgsplit(self.cpv) - if other_split[:2] != self_split[:2]: + if other.cp != self.cp: return False - if portage.pkgcmp(self_split[1:], other_split[1:]) >= 0: + if portage.pkgcmp(self.pv_split, other.pv_split) >= 0: return True return False |