summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMounir Lamouri <volkmar@gentoo.org>2009-08-15 19:28:53 +0000
committerMounir Lamouri <volkmar@gentoo.org>2009-08-15 19:28:53 +0000
commit2aa5871b1a92d6224b6a28bb7c30ea931d0f5b72 (patch)
tree1cfde6d716e32d830621be3b53dcdee81e22e20f
parent3273deb3408f0b460954e97f0a815a2485d0c2d8 (diff)
downloadportage-2aa5871b1a92d6224b6a28bb7c30ea931d0f5b72.tar.gz
portage-2aa5871b1a92d6224b6a28bb7c30ea931d0f5b72.tar.bz2
portage-2aa5871b1a92d6224b6a28bb7c30ea931d0f5b72.zip
Scheduler is now able to clean world set when removing a package.
world_atom function has been updated and PackageUninstall is calling it after unmerge. svn path=/main/trunk/; revision=14070
-rw-r--r--pym/_emerge/MergeListItem.py3
-rw-r--r--pym/_emerge/PackageUninstall.py9
-rw-r--r--pym/_emerge/Scheduler.py34
3 files changed, 30 insertions, 16 deletions
diff --git a/pym/_emerge/MergeListItem.py b/pym/_emerge/MergeListItem.py
index 7e4556ec2..0205e6595 100644
--- a/pym/_emerge/MergeListItem.py
+++ b/pym/_emerge/MergeListItem.py
@@ -132,7 +132,8 @@ class MergeListItem(CompositeTask):
uninstall = PackageUninstall(background=self.background,
ldpath_mtimes=ldpath_mtimes, opts=self.emerge_opts,
- pkg=pkg, scheduler=scheduler, settings=settings)
+ pkg=pkg, scheduler=scheduler, settings=settings,
+ world_atom=world_atom)
uninstall.start()
retval = uninstall.wait()
diff --git a/pym/_emerge/PackageUninstall.py b/pym/_emerge/PackageUninstall.py
index ff1b5e189..d86947c4a 100644
--- a/pym/_emerge/PackageUninstall.py
+++ b/pym/_emerge/PackageUninstall.py
@@ -12,11 +12,12 @@ from _emerge.UninstallFailure import UninstallFailure
class PackageUninstall(AsynchronousTask):
- __slots__ = ("ldpath_mtimes", "opts", "pkg", "scheduler", "settings")
+ __slots__ = ("world_atom", "ldpath_mtimes", "opts",
+ "pkg", "scheduler", "settings")
def _start(self):
try:
- unmerge(self.pkg.root_config, self.opts, "unmerge",
+ retval = unmerge(self.pkg.root_config, self.opts, "unmerge",
[self.pkg.cpv], self.ldpath_mtimes, clean_world=0,
clean_delay=0, raise_on_error=1, scheduler=self.scheduler,
writemsg_level=self._writemsg_level)
@@ -24,6 +25,10 @@ class PackageUninstall(AsynchronousTask):
self.returncode = e.status
else:
self.returncode = os.EX_OK
+
+ if retval == 1:
+ self.world_atom(self.pkg)
+
self.wait()
def _writemsg_level(self, msg, level=0, noiselevel=0):
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index cef4ee6ca..1e05aac0f 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -1566,8 +1566,8 @@ class Scheduler(PollScheduler):
def _world_atom(self, pkg):
"""
- Add the package to the world file, but only if
- it's supposed to be added. Otherwise, do nothing.
+ Add or remove the package to the world file, but only if
+ it's supposed to be added or removed. Otherwise, do nothing.
"""
if set(("--buildpkgonly", "--fetchonly",
@@ -1596,17 +1596,25 @@ class Scheduler(PollScheduler):
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:
- 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)
+ if pkg.operation == "uninstall":
+ if hasattr(world_set, "cleanPackage"):
+ world_set.cleanPackage(pkg.root_config.trees["vartree"].dbapi,
+ pkg.cpv)
+ if hasattr(world_set, "remove"):
+ for s in pkg.root_config.setconfig.active:
+ world_set.remove(SETPREFIX+s)
+ else:
+ atom = create_world_atom(pkg, args_set, root_config)
+ if 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:
if world_locked:
world_set.unlock()