diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-12-09 00:09:36 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-12-09 00:09:36 +0000 |
commit | 6a06177f04ab2c5bb02c8cc98b098f478585a65c (patch) | |
tree | 2484f13a7a6d1e3b3884c8a0b029706495702b7d | |
parent | f66720b6a5898f1b57ffa2ef3a0d04d98a5e4bdd (diff) | |
download | portage-6a06177f04ab2c5bb02c8cc98b098f478585a65c.tar.gz portage-6a06177f04ab2c5bb02c8cc98b098f478585a65c.tar.bz2 portage-6a06177f04ab2c5bb02c8cc98b098f478585a65c.zip |
Remove locking from dbapi.aux_update() implementations so that the caller can handle locking instead.
svn path=/main/trunk/; revision=5230
-rw-r--r-- | pym/portage.py | 31 |
1 files changed, 10 insertions, 21 deletions
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) |