From 0ac299616c5cb22befdd9fcd4091d80ca889ef19 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 2 Dec 2011 10:30:25 -0800 Subject: [PATCH] action_depclean: fix return code The fixes some cases where emerge.log would show that depclean was unsuccessful when it was really successful but there was nothing to remove. --- pym/_emerge/actions.py | 13 +++++++++---- pym/_emerge/unmerge.py | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index ba2e631f2..a62b30510 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -588,15 +588,18 @@ def action_depclean(settings, trees, ldpath_mtimes, return rval if cleanlist: - unmerge(root_config, myopts, "unmerge", + if unmerge(root_config, myopts, "unmerge", cleanlist, ldpath_mtimes, ordered=ordered, - scheduler=scheduler) + scheduler=scheduler): + rval = os.EX_OK + else: + rval = 1 if action == "prune": - return + return rval if not cleanlist and "--quiet" in myopts: - return + return rval print("Packages installed: " + str(len(vardb.cpv_all()))) print("Packages in world: " + \ @@ -609,6 +612,8 @@ def action_depclean(settings, trees, ldpath_mtimes, else: print("Number removed: "+str(len(cleanlist))) + return rval + def calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spinner): allow_missing_deps = bool(args_set) diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py index 852ad936a..c76afdf73 100644 --- a/pym/_emerge/unmerge.py +++ b/pym/_emerge/unmerge.py @@ -526,7 +526,7 @@ def unmerge(root_config, myopts, unmerge_action, if "--pretend" in myopts: #we're done... return - return 0 + return 1 if "--ask" in myopts: if userquery("Would you like to unmerge these packages?", enter_invalid) == "No": -- 2.26.2