From: Zac Medico Date: Mon, 16 Nov 2009 00:31:08 +0000 (-0000) Subject: Implement dblink.__hash__ and __eq__, so that `portageq owners` correctly groups X-Git-Tag: v2.1.7.5~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=10e3eac93731fae3fc8b157314495c31cb067e41;p=portage.git Implement dblink.__hash__ and __eq__, so that `portageq owners` correctly groups search results. Also, increase iter_owners dblink cache size from 25 to 100 instances. (trunk r14817) svn path=/main/branches/2.1.7/; revision=14835 --- diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index cb9c57216..a6b69e9ff 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -908,7 +908,7 @@ class vardbapi(dbapi): def dblink(cpv): x = dblink_cache.get(cpv) if x is None: - if len(dblink_fifo) >= 25: + if len(dblink_fifo) >= 100: # Ensure that we don't run out of memory. del dblink_cache[dblink_fifo.popleft().mycpv] x = self._vardb._dblink(cpv) @@ -1201,6 +1201,14 @@ class dblink(object): self._contents_inodes = None self._contents_basenames = None self._md5_merge_map = {} + self._hash_key = (self.myroot, self.mycpv) + + def __hash__(self): + return hash(self._hash_key) + + def __eq__(self, other): + return isinstance(other, dblink) and \ + self._hash_key == other._hash_key def lockdb(self): if self._lock_vdb: