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()
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)
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):
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",
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()