Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15488 - main/trunk/pym/portage/dbapi
Date: Sun, 28 Feb 2010 03:33:32
Message-Id: E1NlZuK-0004ee-Jr@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-02-28 03:33:26 +0000 (Sun, 28 Feb 2010)
3 New Revision: 15488
4
5 Modified:
6 main/trunk/pym/portage/dbapi/bintree.py
7 Log:
8 Make bindbapi override cpv_inject and cpv_remove, for deleting stale values
9 from self._aux_cache. Also, add a comment about stale cache handling inside
10 aux_update.
11
12
13 Modified: main/trunk/pym/portage/dbapi/bintree.py
14 ===================================================================
15 --- main/trunk/pym/portage/dbapi/bintree.py 2010-02-28 03:05:44 UTC (rev 15487)
16 +++ main/trunk/pym/portage/dbapi/bintree.py 2010-02-28 03:33:26 UTC (rev 15488)
17 @@ -65,6 +65,14 @@
18 self.bintree.populate()
19 return fakedbapi.match(self, *pargs, **kwargs)
20
21 + def cpv_inject(self, cpv, **kwargs):
22 + self._aux_cache.pop(cpv, None)
23 + fakedbapi.cpv_inject(cpv, **kwargs)
24 +
25 + def cpv_remove(self, cpv):
26 + self._aux_cache.pop(cpv, None)
27 + fakedbapi.cpv_remove(cpv)
28 +
29 def aux_get(self, mycpv, wants):
30 if self.bintree and not self.bintree.populated:
31 self.bintree.populate()
32 @@ -135,6 +143,7 @@
33 if not v:
34 del mydata[k]
35 mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
36 + # inject will clear stale caches via cpv_inject.
37 self.bintree.inject(cpv)
38
39 def cp_list(self, *pargs, **kwargs):
40 @@ -917,7 +926,6 @@
41 return
42 slot = slot.strip()
43 self.dbapi.cpv_inject(cpv)
44 - self.dbapi._aux_cache.pop(cpv, None)
45
46 # Reread the Packages index (in case it's been changed by another
47 # process) and then updated it, all while holding a lock.