[yum-cvs] yum/yum rpmsack.py,1.39,1.40
James Bowes
jbowes at linux.duke.edu
Sun Apr 1 17:48:44 UTC 2007
Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv14974/yum
Modified Files:
rpmsack.py
Log Message:
Rpmsack _search optimization
If we have the full pkgtup, then just look it up in the header dict.
Takes 'yum remove glibc' from 1m2s to 0m41s on my machine.
Index: rpmsack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/rpmsack.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- rpmsack.py 30 Mar 2007 15:32:15 -0000 1.39
+++ rpmsack.py 1 Apr 2007 17:48:42 -0000 1.40
@@ -261,14 +261,21 @@
self._make_header_dict()
ret = []
- for (pkgtup, (hdr, idx)) in self._header_dict.items():
- ok = True
- for idx, val in lookfor:
- if pkgtup[idx] != val:
- ok = False
- break
- if ok:
+ # We have the full pkgtup, just grab it from the header dict
+ if len(lookfor) == 5:
+ pkgtup = (name, arch, epoch, ver, rel)
+ if self._header_dict.has_key(pkgtup):
+ hdr, idx = self._header_dict[pkgtup]
ret.append( (hdr, pkgtup, idx) )
+ else:
+ for (pkgtup, (hdr, idx)) in self._header_dict.items():
+ ok = True
+ for idx, val in lookfor:
+ if pkgtup[idx] != val:
+ ok = False
+ break
+ if ok:
+ ret.append( (hdr, pkgtup, idx) )
return ret
More information about the Yum-cvs-commits
mailing list