From 3273deb3408f0b460954e97f0a815a2485d0c2d8 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Sat, 15 Aug 2009 19:24:12 +0000 Subject: [PATCH] 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 --- pym/_emerge/unmerge.py | 15 +++++++++++++-- pym/portage/sets/files.py | 10 +++++++--- 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"]) -- 2.26.2