summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-08-18 08:09:26 +0000
committerZac Medico <zmedico@gentoo.org>2008-08-18 08:09:26 +0000
commitbaee3d09c69f3a57a232bd3849da79e7b1a0d8fd (patch)
tree79789b0cd6fd98a4540e781a1c6af48234246cf4
parentee21f4b0c7301379f5df243f9c196a06e8132826 (diff)
downloadportage-baee3d09c69f3a57a232bd3849da79e7b1a0d8fd.tar.gz
portage-baee3d09c69f3a57a232bd3849da79e7b1a0d8fd.tar.bz2
portage-baee3d09c69f3a57a232bd3849da79e7b1a0d8fd.zip
Don't assume that the "world" set is an instance of WorldSet, allowing the
user to substitute some other set type if desired. svn path=/main/trunk/; revision=11433
-rw-r--r--pym/_emerge/__init__.py46
1 files changed, 33 insertions, 13 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 6ea8c2bd4..47d058105 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -7537,8 +7537,15 @@ class depgraph(object):
return
root_config = self.roots[self.target_root]
world_set = root_config.sets["world"]
- world_set.lock()
- world_set.load() # maybe it's changed on disk
+
+ world_locked = False
+ if hasattr(world_set, "lock"):
+ world_set.lock()
+ world_locked = True
+
+ if hasattr(world_set, "load"):
+ world_set.load() # maybe it's changed on disk
+
args_set = self._sets["args"]
portdb = self.trees[self.target_root]["porttree"].dbapi
added_favorites = set()
@@ -7574,7 +7581,9 @@ class depgraph(object):
colorize("INFORM", str(a))
if all_added:
world_set.update(all_added)
- world_set.unlock()
+
+ if world_locked:
+ world_set.unlock()
def loadResumeCommand(self, resume_data, skip_masked=False):
"""
@@ -10026,18 +10035,29 @@ class Scheduler(PollScheduler):
pkg_count = self._pkg_count
root_config = pkg.root_config
world_set = root_config.sets["world"]
- world_set.lock()
+ world_locked = False
+ if hasattr(world_set, "lock"):
+ world_set.lock()
+ world_locked = True
+
try:
- world_set.load() # maybe it's changed on disk
+ if hasattr(world_set, "load"):
+ world_set.load() # maybe it's changed on disk
+
atom = create_world_atom(pkg, args_set, root_config)
if atom:
- self._status_msg(('Recording %s in "world" ' + \
- 'favorites file...') % atom)
- logger.log(" === (%s of %s) Updating world file (%s)" % \
- (pkg_count.curval, pkg_count.maxval, pkg.cpv))
- world_set.add(atom)
+ if hasattr(world_set, "add"):
+ self._status_msg(('Recording %s in "world" ' + \
+ 'favorites file...') % atom)
+ logger.log(" === (%s of %s) Updating world file (%s)" % \
+ (pkg_count.curval, pkg_count.maxval, pkg.cpv))
+ world_set.add(atom)
+ else:
+ writemsg_level('\n!!! Unable to record %s in "world"\n' % \
+ (atom,), level=logging.WARN, noiselevel=-1)
finally:
- world_set.unlock()
+ if world_locked:
+ world_set.unlock()
def _pkg(self, cpv, type_name, root_config, installed=False):
"""
@@ -10629,10 +10649,10 @@ def unmerge(root_config, myopts, unmerge_action,
raise UninstallFailure(retval)
sys.exit(retval)
else:
- if clean_world:
+ if clean_world and hasattr(sets["world"], "cleanPackage"):
sets["world"].cleanPackage(vartree.dbapi, y)
emergelog(xterm_titles, " >>> unmerge success: "+y)
- if clean_world:
+ if clean_world and hasattr(sets["world"], "remove"):
for s in root_config.setconfig.active:
sets["world"].remove(SETPREFIX+s)
return 1