return rval
if cleanlist:
- if unmerge(root_config, myopts, "unmerge",
+ rval = unmerge(root_config, myopts, "unmerge",
cleanlist, ldpath_mtimes, ordered=ordered,
- scheduler=scheduler):
- rval = os.EX_OK
- else:
- rval = 1
+ scheduler=scheduler)
if action == "prune":
return rval
(action == 'prune' and "--nodeps" in opts):
# When given a list of atoms, unmerge them in the order given.
ordered = action == 'unmerge'
- unmerge(trees[settings['EROOT']]['root_config'], opts, action,
+ rval = unmerge(trees[settings['EROOT']]['root_config'], opts, action,
valid_atoms, ldpath_mtimes, ordered=ordered,
scheduler=sched._sched_iface)
- rval = os.EX_OK
else:
rval = action_depclean(settings, trees, ldpath_mtimes,
opts, action, valid_atoms, spinner, scheduler=sched._sched_iface)
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
import logging
+import signal
import sys
import textwrap
import portage
clean_world=1, clean_delay=1, ordered=0, raise_on_error=0,
scheduler=None, writemsg_level=portage.util.writemsg_level):
"""
- Returns 1 if successful, otherwise 0.
+ Returns os.EX_OK if no errors occur, 1 if an error occurs, and
+ 130 if interrupted due to a 'no' answer for --ask.
"""
if clean_world:
writemsg_level=writemsg_level)
if rval != os.EX_OK:
- return 0
+ return rval
enter_invalid = '--ask-enter-invalid' in myopts
vartree = root_config.trees["vartree"]
if "--pretend" in myopts:
#we're done... return
- return 1
+ return os.EX_OK
if "--ask" in myopts:
if userquery("Would you like to unmerge these packages?",
enter_invalid) == "No":
print()
print("Quitting.")
print()
- return 0
+ return 128 + signal.SIGINT
#the real unmerging begins, after a short delay....
if clean_delay and not autoclean:
countdown(int(settings["CLEAN_DELAY"]), ">>> Unmerging")
sets["selected"].remove(SETPREFIX + s)
sets["selected"].unlock()
- return 1
+ return os.EX_OK