From 5c17359c4b91133ad44c037452cfea6df894021b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 6 Sep 2006 20:07:30 +0000 Subject: [PATCH] Properly lock the critical section of portage.unmerge() for bug #101240. svn path=/main/trunk/; revision=4417 --- pym/portage.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pym/portage.py b/pym/portage.py index ef6f32c9c..38a5755e3 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3244,12 +3244,16 @@ def merge(mycat, mypkg, pkgloc, infloc, myroot, mysettings, myebuild=None, def unmerge(cat, pkg, myroot, mysettings, mytrimworld=1, vartree=None, ldpath_mtimes=None): mylink = dblink( cat, pkg, myroot, mysettings, treetype="vartree", vartree=vartree) - if mylink.exists(): - mylink.unmerge(trimworld=mytrimworld, cleanup=1, - ldpath_mtimes=ldpath_mtimes) - mylink.delete() - return 0 - return 1 + try: + mylink.lockdb() + if mylink.exists(): + mylink.unmerge(trimworld=mytrimworld, cleanup=1, + ldpath_mtimes=ldpath_mtimes) + mylink.delete() + return 0 + return 1 + finally: + mylink.unlockdb() def getCPFromCPV(mycpv): """Calls pkgsplit on a cpv and returns only the cp.""" @@ -5677,8 +5681,6 @@ class dblink: global dircache dircache={} - self.lockdb() - self.settings.load_infodir(self.dbdir) if not pkgfiles: @@ -5843,7 +5845,7 @@ class dblink: doebuild(myebuildpath, "cleanrm", self.myroot, self.settings, tree="vartree", mydbapi=self.vartree.dbapi, vartree=self.vartree) - self.unlockdb() + env_update(target_root=self.myroot, prev_mtimes=ldpath_mtimes) def isowner(self,filename,destroot): -- 2.26.2