Remove locking from dbapi.aux_update() implementations so that the caller can handle...
authorZac Medico <zmedico@gentoo.org>
Sat, 9 Dec 2006 00:09:36 +0000 (00:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 9 Dec 2006 00:09:36 +0000 (00:09 -0000)
svn path=/main/trunk/; revision=5230

pym/portage.py

index e6dcc48bc99951e0d787b6ce25f41b9819591c7d..93a304b7394db96f270c05e4ea4acdbd77c2ccec 100644 (file)
@@ -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)