Add a bindbapi.aux_update() method for database maintenance. See bug #122089.
authorZac Medico <zmedico@gentoo.org>
Sun, 9 Jul 2006 21:05:28 +0000 (21:05 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 9 Jul 2006 21:05:28 +0000 (21:05 -0000)
svn path=/main/trunk/; revision=3825

pym/portage.py

index 1372ecb4ec84d7f6174c04d2c6ad531abf33bdbc..01a59726f2a32d1eec530353f55ed855b7ed1e6b 100644 (file)
@@ -4273,6 +4273,18 @@ class bindbapi(fakedbapi):
                                mylist[idx] = "0"
                return mylist
 
+       def aux_update(self, cpv, values):
+               tbz2path = self.bintree.getname(cpv)
+               mylock = portage_locks.lockfile(tbz2path, wantnewlockfile=1)
+               try:
+                       if not os.path.exists(tbz2path):
+                               raise KeyError(cpv)
+                       mytbz2 = xpak.tbz2(tbz2path)
+                       mydata = mytbz2.get_data()
+                       mydata.update(values)
+                       mytbz2.recompose_mem(xpak.xpak_mem(mydata))
+               finally:
+                       portage_locks.unlockfile(mylock)
 
 cptot=0
 class vardbapi(dbapi):