From: Zac Medico Date: Sun, 9 Jul 2006 21:05:28 +0000 (-0000) Subject: Add a bindbapi.aux_update() method for database maintenance. See bug #122089. X-Git-Tag: v2.1.1~254 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5bae27f6ea2842af68ea09f63168cc8dc1029b0c;p=portage.git Add a bindbapi.aux_update() method for database maintenance. See bug #122089. svn path=/main/trunk/; revision=3825 --- diff --git a/pym/portage.py b/pym/portage.py index 1372ecb4e..01a59726f 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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):