diff options
-rw-r--r-- | pym/_emerge/actions.py | 10 | ||||
-rw-r--r-- | pym/_emerge/unmerge.py | 14 |
2 files changed, 11 insertions, 13 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 0fb49442a..afb62bbc6 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -586,12 +586,9 @@ def action_depclean(settings, trees, ldpath_mtimes, 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 @@ -2674,10 +2671,9 @@ def action_uninstall(settings, trees, ldpath_mtimes, (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) diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py index c76afdf73..0acdf998c 100644 --- a/pym/_emerge/unmerge.py +++ b/pym/_emerge/unmerge.py @@ -1,9 +1,10 @@ -# 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 @@ -503,7 +504,8 @@ def unmerge(root_config, myopts, unmerge_action, 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: @@ -515,7 +517,7 @@ def unmerge(root_config, myopts, unmerge_action, 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"] @@ -526,7 +528,7 @@ def unmerge(root_config, myopts, unmerge_action, 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": @@ -535,7 +537,7 @@ def unmerge(root_config, myopts, unmerge_action, 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") @@ -574,5 +576,5 @@ def unmerge(root_config, myopts, unmerge_action, sets["selected"].remove(SETPREFIX + s) sets["selected"].unlock() - return 1 + return os.EX_OK |