summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMounir Lamouri <volkmar@gentoo.org>2009-08-15 19:24:12 +0000
committerMounir Lamouri <volkmar@gentoo.org>2009-08-15 19:24:12 +0000
commit3273deb3408f0b460954e97f0a815a2485d0c2d8 (patch)
treed0f9bb9d878774703605acd30a50a0ddd6c97bb1
parent68a3a0a29a7d422a09aeb5c2b14010904bb683b7 (diff)
downloadportage-3273deb3408f0b460954e97f0a815a2485d0c2d8.tar.gz
portage-3273deb3408f0b460954e97f0a815a2485d0c2d8.tar.bz2
portage-3273deb3408f0b460954e97f0a815a2485d0c2d8.zip
sets/files.py cleanPackages function stop calling lock and load
and requires the caller to do that changing unmerge to reflect this change svn path=/main/trunk/; revision=14069
-rw-r--r--pym/_emerge/unmerge.py15
-rw-r--r--pym/portage/sets/files.py10
2 files changed, 20 insertions, 5 deletions
diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py
index 25c3e4e4f..2c9e7576e 100644
--- a/pym/_emerge/unmerge.py
+++ b/pym/_emerge/unmerge.py
@@ -510,11 +510,22 @@ def unmerge(root_config, myopts, unmerge_action,
raise UninstallFailure(retval)
sys.exit(retval)
else:
- if clean_world and hasattr(sets["world"], "cleanPackage"):
+ if clean_world and hasattr(sets["world"], "cleanPackage")\
+ and hasattr(sets["world"], "lock"):
+ sets["world"].lock()
+ if hasattr(sets["world"], "load"):
+ sets["world"].load()
sets["world"].cleanPackage(vartree.dbapi, y)
+ sets["world"].unlock()
emergelog(xterm_titles, " >>> unmerge success: "+y)
- if clean_world and hasattr(sets["world"], "remove"):
+
+ if clean_world and hasattr(sets["world"], "remove")\
+ and hasattr(sets["world"], "lock"):
+ sets["world"].lock()
+ # load is called inside remove()
for s in root_config.setconfig.active:
sets["world"].remove(SETPREFIX+s)
+ sets["world"].unlock()
+
return 1
diff --git a/pym/portage/sets/files.py b/pym/portage/sets/files.py
index acf556b7f..035c2dc99 100644
--- a/pym/portage/sets/files.py
+++ b/pym/portage/sets/files.py
@@ -294,8 +294,13 @@ class WorldSet(EditablePackageSet):
self._lock = None
def cleanPackage(self, vardb, cpv):
- self.lock()
- self._load() # loads latest from disk
+ '''
+ Before calling this function you should call lock and load.
+ After calling this function you should call unlock.
+ '''
+ if not self._lock:
+ raise AssertionError('cleanPackage needs the set to be locked')
+
worldlist = list(self._atoms)
mykey = cpv_getkey(cpv)
newworldlist = []
@@ -317,7 +322,6 @@ class WorldSet(EditablePackageSet):
newworldlist.extend(self._nonatoms)
self.replace(newworldlist)
- self.unlock()
def singleBuilder(self, options, settings, trees):
return WorldSet(settings["ROOT"])