From: Zac Medico Date: Sat, 9 Dec 2006 00:09:36 +0000 (-0000) Subject: Remove locking from dbapi.aux_update() implementations so that the caller can handle... X-Git-Tag: v2.1.2~354 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6a06177f04ab2c5bb02c8cc98b098f478585a65c;p=portage.git Remove locking from dbapi.aux_update() implementations so that the caller can handle locking instead. svn path=/main/trunk/; revision=5230 --- diff --git a/pym/portage.py b/pym/portage.py index e6dcc48bc..93a304b73 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -4490,16 +4490,12 @@ class bindbapi(fakedbapi): if not self.bintree.populated: self.bintree.populate() 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) + 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)) def cp_list(self, *pargs, **kwargs): if not self.bintree.populated: @@ -4814,18 +4810,11 @@ class vardbapi(dbapi): def aux_update(self, cpv, values): cat, pkg = cpv.split("/") mylink = dblink(cat, pkg, self.root, self.settings, - treetype="vartree", vartree=self.vartree) - try: - mylink.lockdb() - except portage_exception.DirectoryNotFound: + treetype="vartree", vartree=self.vartree) + if not mylink.exists(): raise KeyError(cpv) - try: - if not mylink.exists(): - raise KeyError(cpv) - for k, v in values.iteritems(): - mylink.setfile(k, v) - finally: - mylink.unlockdb() + for k, v in values.iteritems(): + mylink.setfile(k, v) def counter_tick(self,myroot,mycpv=None): return self.counter_tick_core(myroot,incrementing=1,mycpv=mycpv)